Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
csst-sims
csst_msc_sim
Commits
4325fe99
Commit
4325fe99
authored
Nov 15, 2024
by
Wei Chengliang
Browse files
format codestyle-PEP8
parent
cda41165
Pipeline
#7337
passed with stage
in 0 seconds
Changes
1
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
tools/setConfig/reset_overall.py
View file @
4325fe99
...
...
@@ -4,7 +4,7 @@ import ast
app
=
Flask
(
__name__
)
key_type_map
=
{
key_type_map
=
{
'work_dir'
:
str
,
'run_name'
:
str
,
'project_cycle'
:
int
,
...
...
@@ -23,11 +23,11 @@ key_type_map = {
'galaxy_SED'
:
str
,
'AGN_SED'
:
str
,
},
'star_only'
:
bool
,
'star_only'
:
bool
,
'galaxy_only'
:
bool
,
'rotateEll'
:
float
,
'enable_mw_ext_gal'
:
bool
,
'planck_ebv_map'
:
str
,
'planck_ebv_map'
:
str
,
},
'obs_setting'
:
{
'pointing_file'
:
str
,
...
...
@@ -68,11 +68,11 @@ key_type_map = {
}
def
convert_dict_values
(
d
,
key_type_map
):
for
key
,
value
in
d
.
items
():
if
isinstance
(
value
,
dict
):
convert_dict_values
(
value
,
key_type_map
[
key
])
elif
key
in
key_type_map
:
def
convert_dict_values
(
d
,
key_type_map
):
for
key
,
value
in
d
.
items
():
if
isinstance
(
value
,
dict
):
convert_dict_values
(
value
,
key_type_map
[
key
])
elif
key
in
key_type_map
:
if
key_type_map
[
key
]
is
int
:
d
[
key
]
=
int
(
value
)
if
key_type_map
[
key
]
is
float
:
...
...
@@ -94,7 +94,7 @@ def load_yaml():
def
save_yaml
(
data
):
convert_dict_values
(
data
,
key_type_map
)
convert_dict_values
(
data
,
key_type_map
)
with
open
(
'config_reset/config_overall_reset.yaml'
,
'w'
)
as
file
:
yaml
.
dump
(
data
,
file
,
default_flow_style
=
False
,
sort_keys
=
False
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment