aboutsummaryrefslogtreecommitdiff
path: root/src/argaze/DataFeatures.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/argaze/DataFeatures.py')
-rw-r--r--src/argaze/DataFeatures.py14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/argaze/DataFeatures.py b/src/argaze/DataFeatures.py
index 849601f..6d471e4 100644
--- a/src/argaze/DataFeatures.py
+++ b/src/argaze/DataFeatures.py
@@ -752,17 +752,23 @@ def PipelineStepMethod(method):
PipelineStepMethod must have a timestamp as first argument.
"""
- def wrapper(self, timestamp, *args, unwrap: bool = False, **kwargs):
+ def wrapper(self, *args, timestamp: int|float = None, unwrap: bool = False, **kwargs):
"""Wrap pipeline step method to measure execution time.
Parameters:
- timestamp: PipelineStepMethod must define timestamp as first parameter.
args: Any arguments defined by PipelineStepMethod.
+ timestamp: Optional method call timestamp (unit does'nt matter) if first args parameter is not a TimestampedObject instance.
unwrap: Extra arguments used in wrapper function to call wrapped method directly.
"""
+ if timestamp is None:
+
+ if isinstance(args[0], TimestampedObject):
+
+ timestamp = args[0].timestamp
+
if unwrap:
- return method(self, timestamp, *args, **kwargs)
+ return method(self, *args, **kwargs)
# Initialize execution time assessment
start = time.perf_counter()
@@ -772,7 +778,7 @@ def PipelineStepMethod(method):
try:
# Execute wrapped method
- result = method(self, timestamp, *args, **kwargs)
+ result = method(self, *args, **kwargs)
except Exception as e: