Commit 4325fe99 authored by Wei Chengliang's avatar Wei Chengliang
Browse files

format codestyle-PEP8

parent cda41165
Pipeline #7337 passed with stage
in 0 seconds
...@@ -4,7 +4,7 @@ import ast ...@@ -4,7 +4,7 @@ import ast
app = Flask(__name__) app = Flask(__name__)
key_type_map = { key_type_map = {
'work_dir': str, 'work_dir': str,
'run_name': str, 'run_name': str,
'project_cycle': int, 'project_cycle': int,
...@@ -23,11 +23,11 @@ key_type_map = { ...@@ -23,11 +23,11 @@ key_type_map = {
'galaxy_SED': str, 'galaxy_SED': str,
'AGN_SED': str, 'AGN_SED': str,
}, },
'star_only': bool, 'star_only': bool,
'galaxy_only': bool, 'galaxy_only': bool,
'rotateEll': float, 'rotateEll': float,
'enable_mw_ext_gal': bool, 'enable_mw_ext_gal': bool,
'planck_ebv_map':str, 'planck_ebv_map': str,
}, },
'obs_setting': { 'obs_setting': {
'pointing_file': str, 'pointing_file': str,
...@@ -68,11 +68,11 @@ key_type_map = { ...@@ -68,11 +68,11 @@ key_type_map = {
} }
def convert_dict_values(d, key_type_map): def convert_dict_values(d, key_type_map):
for key, value in d.items(): for key, value in d.items():
if isinstance(value, dict): if isinstance(value, dict):
convert_dict_values(value, key_type_map[key]) convert_dict_values(value, key_type_map[key])
elif key in key_type_map: elif key in key_type_map:
if key_type_map[key] is int: if key_type_map[key] is int:
d[key] = int(value) d[key] = int(value)
if key_type_map[key] is float: if key_type_map[key] is float:
...@@ -94,7 +94,7 @@ def load_yaml(): ...@@ -94,7 +94,7 @@ def load_yaml():
def save_yaml(data): 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: with open('config_reset/config_overall_reset.yaml', 'w') as file:
yaml.dump(data, file, default_flow_style=False, sort_keys=False) yaml.dump(data, file, default_flow_style=False, sort_keys=False)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment