Skip to content

Commit

Permalink
Extract trigger only (#85)
Browse files Browse the repository at this point in the history
* Make windows struct optional when loading config

* Update spacing
  • Loading branch information
justin13601 authored Jul 29, 2024
1 parent f8930ae commit c351ce4
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/aces/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -862,7 +862,7 @@ def load(cls, config_path: str | Path, predicates_path: str | Path = None) -> Ta
predicates = loaded_dict.pop("predicates")

trigger = loaded_dict.pop("trigger")
windows = loaded_dict.pop("windows")
windows = loaded_dict.pop("windows", None)

# Remove the description if it exists - currently unused except for readability in the YAML
_ = loaded_dict.pop("description", None)
Expand All @@ -880,7 +880,13 @@ def load(cls, config_path: str | Path, predicates_path: str | Path = None) -> Ta
trigger = EventConfig(trigger)

logger.info("Parsing windows...")
windows = {n: WindowConfig(**w) for n, w in windows.items()}
if windows is None:
windows = {}
logger.warning(

Check warning on line 885 in src/aces/config.py

View check run for this annotation

Codecov / codecov/patch

src/aces/config.py#L884-L885

Added lines #L884 - L885 were not covered by tests
"No windows specified in configuration file. Extracting only matching trigger events."
)
else:
windows = {n: WindowConfig(**w) for n, w in windows.items()}

return cls(predicates=predicates, trigger=trigger, windows=windows)

Expand Down

0 comments on commit c351ce4

Please sign in to comment.