Fix bug while reading yaml file from utils/g5505_utils.py

This commit is contained in:
2025-06-10 14:38:29 +02:00
parent ab897018d9
commit 7d710c1e62
2 changed files with 5 additions and 4 deletions

View File

@ -2,4 +2,5 @@ exclude_paths:
containing : containing :
- .ipynb_checkpoints - .ipynb_checkpoints
- .renku - .renku
- .git - .git
# - params

View File

@ -308,17 +308,17 @@ def copy_directory_with_contraints(input_dir_path, output_dir_path,
select_dir_keywords = [keyword.replace('/',os.sep) for keyword in select_dir_keywords] select_dir_keywords = [keyword.replace('/',os.sep) for keyword in select_dir_keywords]
try: try:
with open(os.path.join(dimaPath, 'utils/exclude_path_keywords.yaml'), 'r') as stream: with open(os.path.join(dimaPath, 'dima/utils/exclude_path_keywords.yaml'), 'r') as stream:
exclude_path_dict = yaml.safe_load(stream) exclude_path_dict = yaml.safe_load(stream)
if isinstance(exclude_path_dict, dict): if isinstance(exclude_path_dict, dict):
exclude_path_keywords = exclude_path_dict.get('containing', []) exclude_path_keywords = exclude_path_dict.get('exclude_paths',{}).get('containing', [])
if not all(isinstance(keyword, str) for keyword in exclude_path_keywords): if not all(isinstance(keyword, str) for keyword in exclude_path_keywords):
exclude_path_keywords = [] exclude_path_keywords = []
else: else:
exclude_path_keywords = [] exclude_path_keywords = []
except (FileNotFoundError, yaml.YAMLError) as e: except (FileNotFoundError, yaml.YAMLError) as e:
print(f"Warning. Unable to load YAML file: {e}") print(f"Warning. Unable to load YAML file: {e}")
exclude_path_keywords = [] exclude_path_keywords = []
date = created_at('%Y_%m').replace(":", "-") date = created_at('%Y_%m').replace(":", "-")
log_dir='logs/' log_dir='logs/'