Skip to content

Commit

Permalink
not (a or b) = not a and not b
Browse files Browse the repository at this point in the history
  • Loading branch information
awegsche committed Dec 4, 2023
1 parent 668a595 commit ae7aa72
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions omc3/model/model_creators/abstract_model_creator.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,15 @@ def check_folder_choices(parent: Path, msg: str,
A helper function that scans a selected folder for children, which will then be displayed as possible choices
"""
choices = [d.name for d in parent.iterdir() if predicate(d)]
if selection is None or selection not in choices:
if list_choices:
for choice in choices:
print(choice)
return None
raise AttributeError(f"{msg}.\nSelected: '{selection}'.\nChoices: [{', '.join(choices)}]")
return parent / selection

if selection is not None and selection in choices:
return parent / selection

if list_choices:
for choice in choices:
print(choice)
return None
raise AttributeError(f"{msg}.\nSelected: '{selection}'.\nChoices: [{', '.join(choices)}]")


class ModelCreator(ABC):
Expand Down

0 comments on commit ae7aa72

Please sign in to comment.