MCPcopy
hub / github.com/sartography/SpiffWorkflow / valueof

Function valueof

SpiffWorkflow/operators.py:180–199  ·  view source on GitHub ↗
(scope, op, default=None)

Source from the content-addressed store, hash-verified

178
179
180def valueof(scope, op, default=None):
181 if op is None:
182 return default
183 elif isinstance(op, Attrib):
184 if op.name not in scope.data:
185 logger.debug("Attrib('{op.name}') not present in task data", extra=scope.collect_log_extras({'data': scope.data}))
186 return scope.get_data(op.name, default)
187 elif isinstance(op, PathAttrib):
188 if not op.path:
189 return default
190 parts = op.path.split('/')
191 data = scope.data
192 for part in parts:
193 if part not in data:
194 logger.debug(f"PathAttrib('{op.name}') not present in task data", extra=scope.collect_log_extras({'data': scope.data}))
195 return default
196 data = data[part] # move down the path
197 return data
198 else:
199 return op
200
201def is_number(text):
202 try:

Callers 8

_get_valuesMethod · 0.85
_create_subworkflowMethod · 0.85
_run_hookMethod · 0.85
_startMethod · 0.85

Calls 2

collect_log_extrasMethod · 0.45
get_dataMethod · 0.45

Tested by

no test coverage detected