Skip to content

Commit

Permalink
fix: incorrect feature sets path, linting
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinBernstorff committed Oct 3, 2022
1 parent 34524c0 commit 605ccb7
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/application/t2d/generate_features_and_write_to_disk.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def create_save_dir_path(

# Split and save to disk
# Create directory to store all files related to this run
save_dir = proj_path / feature_set_id
save_dir = proj_path / "feature_sets" / feature_set_id

if not save_dir.exists():
save_dir.mkdir()
Expand Down Expand Up @@ -366,22 +366,22 @@ def setup_for_main(
return predictor_combinations, proj_path, feature_set_id


def assert_no_duplicate_dicts_in_list(predictor_spec_list):
def assert_no_duplicate_dicts_in_list(predictor_spec_list: list[dict[str, Any]]):
"""Find potential duplicates in list of dicts.
Args:
predictor_combinations (list[dict[str, dict[str, Any]]]): List of predictor combinations.
predictor_spec_list (list[dict[str, dict[str, Any]]]): List of predictor combinations.
"""
# Find duplicates in list of dicts
seen = set()
duplicates = set()

for d in predictor_spec_list:
t = tuple(d.items())
if t in seen:
duplicates.add(t)
d_as_tuple = tuple(d.items())
if tuple(d.items()) in seen:
duplicates.add(d_as_tuple)
else:
seen.add(t)
seen.add(d_as_tuple)

if len(duplicates) > 0:
raise ValueError(f"Found duplicates in list of dicts: {duplicates}")
Expand Down

0 comments on commit 605ccb7

Please sign in to comment.