Skip to content

Commit

Permalink
🚑 Fix try block indentation to be in for loop
Browse files Browse the repository at this point in the history
  • Loading branch information
jurrigerretsen committed Jan 23, 2024
1 parent 12324d5 commit e84f60b
Showing 1 changed file with 22 additions and 21 deletions.
43 changes: 22 additions & 21 deletions datadict/datadict_yaml.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,27 +109,28 @@ def updated_existing_files(yaml_obj, existing_file_yamls, models_to_be_updated,
for file in existing_file_yamls:
file_yaml = file["file_yaml"]
path = file["file_path"]
try:
for model_num, model in enumerate(file_yaml["models"]):
for model_to_be_updated in models_to_be_updated:
if model_to_be_updated["name"] == model["name"]:
logging.info(f"Model {model['name']} is being checked...")
combined_columns = combine_column_lists(
model, model_to_be_updated
)
file_yaml["models"][model_num] = combined_columns["yaml"]
updated = combined_columns["updated"]
if updated:
updated_count += 1
else:
logging.info(f"Model {model['name']} is correct")

if updated_count > 0:
datadict_helpers.output_model_file(yaml_obj, path, file_yaml, sort)
except Exception as error:
logging.error(
f"There was an issue processing file '{path}'. This is likely a badly formatted YAML file. Error: {error}"
)

try:
for model_num, model in enumerate(file_yaml["models"]):
for model_to_be_updated in models_to_be_updated:
if model_to_be_updated["name"] == model["name"]:
logging.info(f"Model {model['name']} is being checked...")
combined_columns = combine_column_lists(
model, model_to_be_updated
)
file_yaml["models"][model_num] = combined_columns["yaml"]
updated = combined_columns["updated"]
if updated:
updated_count += 1
else:
logging.info(f"Model {model['name']} is correct")

if updated_count > 0:
datadict_helpers.output_model_file(yaml_obj, path, file_yaml, sort)
except Exception as error:
logging.error(
f"There was an issue processing file '{path}'. This is likely a badly formatted YAML file. Error: {error}"
)


def add_missing_models(yaml_obj, path, models, sort):
Expand Down

0 comments on commit e84f60b

Please sign in to comment.