(scope, op, default=None)
| 178 | |
| 179 | |
| 180 | def 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 | |
| 201 | def is_number(text): |
| 202 | try: |
no test coverage detected