merged dependencies for mergable operations

This commit is contained in:
Laura Klünder 2024-10-29 12:21:10 +01:00
parent c05760b767
commit 54920a2f54

View file

@ -1,3 +1,5 @@
import operator
from functools import reduce
from itertools import chain
from typing import Type, Any, Optional, Annotated, Union
@ -62,6 +64,10 @@ class SingleOperationWithDependencies(BaseSchema):
class MergableOperationsWithDependencies(BaseSchema):
children: list[SingleOperationWithDependencies]
@property
def dependencies(self) -> set[OperationDependency]:
return reduce(operator.or_, (c.dependencies for c in self.children), set())
OperationWithDependencies = Union[
SingleOperationWithDependencies,