aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThéo de la Hogue2024-04-03 15:36:50 +0200
committerThéo de la Hogue2024-04-03 15:36:50 +0200
commit9729d633983a1f013cb5675e172e4a329ec8815e (patch)
tree6479e1cdd66decadc77cf9c3c3c3c3287ff4ee78
parent3370c067bac219c5310ba15cf2f6d98a8a8259b9 (diff)
downloadargaze-9729d633983a1f013cb5675e172e4a329ec8815e.zip
argaze-9729d633983a1f013cb5675e172e4a329ec8815e.tar.gz
argaze-9729d633983a1f013cb5675e172e4a329ec8815e.tar.bz2
argaze-9729d633983a1f013cb5675e172e4a329ec8815e.tar.xz
Fixing children method.
-rw-r--r--src/argaze/DataFeatures.py37
1 files changed, 26 insertions, 11 deletions
diff --git a/src/argaze/DataFeatures.py b/src/argaze/DataFeatures.py
index 5e5ac08..19c45fe 100644
--- a/src/argaze/DataFeatures.py
+++ b/src/argaze/DataFeatures.py
@@ -842,11 +842,21 @@ class PipelineStepObject():
child.__enter__()
+ # Start observers
+ for observer in self.observers:
+
+ observer.__enter__()
+
return self
def __exit__(self, exception_type, exception_value, exception_traceback):
"""Define default method to exit from pipeline step object context."""
+ # Stop observers
+ for observer in self.observers:
+
+ observer.__exit__(exception_type, exception_value, exception_traceback)
+
# Stop children pipeline step objects
for child in self.children:
@@ -1063,25 +1073,30 @@ class PipelineStepObject():
def children(self) -> object:
"""Iterate over children pipeline step objects."""
- for name in dir(self):
+ for name, value in self.properties:
+
+ # Pipeline step object attribute
+ if issubclass(type(value), PipelineStepObject) and value != self.parent:
- if not name.startswith('_'):
+ yield value
+
+ # Pipeline step objects list attribute
+ elif type(value) == list:
- attr = getattr(self, name)
+ for p in value:
- # Pipeline step object attribute
- if issubclass(type(attr), PipelineStepObject) and attr != self.parent:
+ if issubclass(type(p), PipelineStepObject):
- yield attr
+ yield p
- # Pipeline step objects list attribute
- elif isinstance(attr, list):
+ # Pipeline step objects list attribute
+ elif type(value) == dict:
- for p in attr:
+ for p in value.values():
- if issubclass(type(p), PipelineStepObject):
+ if issubclass(type(p), PipelineStepObject):
- yield p
+ yield p
def PipelineStepMethod(method):
"""Define a decorator use into PipelineStepObject class to declare pipeline method.