Adds iterate operator. New scope is added to stack before calling iteration result. This scope is then preserved in IterateOperator node and removed from the stack. Args: body: specification of an iterated body function call_operator: iterate opereat
(
self,
body: FunctionSpec,
call_operator: Callable[[operator.IterateOperator], T],
iteration_limit: int | None = None,
)
| 154 | return result |
| 155 | |
| 156 | def add_iterate( |
| 157 | self, |
| 158 | body: FunctionSpec, |
| 159 | call_operator: Callable[[operator.IterateOperator], T], |
| 160 | iteration_limit: int | None = None, |
| 161 | ) -> T: |
| 162 | """Adds iterate operator. |
| 163 | |
| 164 | New scope is added to stack before calling iteration result. This scope is then preserved |
| 165 | in IterateOperator node and removed from the stack. |
| 166 | |
| 167 | Args: |
| 168 | body: specification of an iterated body function |
| 169 | call_operator: iterate opereator callback |
| 170 | """ |
| 171 | |
| 172 | def create_node(id: int) -> operator.IterateOperator: |
| 173 | return operator.IterateOperator(body, id, iterate_scope, iteration_limit) |
| 174 | |
| 175 | def call_operator_in_scope(o: operator.IterateOperator) -> T: |
| 176 | with iterate_scope: |
| 177 | return call_operator(o) |
| 178 | |
| 179 | iterate_scope = self.new_scope() |
| 180 | return self.add_operator(create_node, call_operator_in_scope) |
| 181 | |
| 182 | def add_error_log(self, global_log: bool = False) -> Table[ErrorLogSchema]: |
| 183 | datasource = ErrorLogDataSource(schema=ErrorLogSchema) |
no test coverage detected