Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ConditionSet: add ability to construct with multiple dicts #113

Merged
merged 1 commit into from
Dec 12, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion src/graph_scheduler/condition.py
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,10 @@ class ConditionSet(object):
Arguments
---------

*condition_sets
each item is a dict or ConditionSet mapping nodes to conditions
to be added via `ConditionSet.add_condition_set`

conditions : Dict[node: `Condition`]
specifies an iterable collection of nodes and the `Conditions <Condition>` associated
with each.
Expand All @@ -412,9 +416,14 @@ class ConditionSet(object):
ConditionSet using the ConditionSet's `add_condition` method.

"""
def __init__(self, conditions=None):
def __init__(self, *condition_sets, conditions=None):
self.conditions = {}

for cset in condition_sets:
if cset is None:
continue
self.add_condition_set(cset)

if conditions is not None:
self.add_condition_set(conditions)

Expand Down
Loading