Coverage for skema/gromet/execution_engine/types/iterable.py: 89%

18 statements  

« prev     ^ index     » next       coverage.py v7.5.0, created at 2024-04-30 17:15 +0000

1from typing import Iterator, Union, Any, List, Dict, Set, Tuple 

2from skema.gromet.execution_engine.types.defined_types import Field, Iterable 

3 

4 

5class Iterable_new_Iterator(object): 

6 source_language_name = { 

7 "CAST": "_iter" 

8 } # TODO: What should this be (iter, next, etc) 

9 inputs = [Field("iterable_input", "Iterable")] 

10 outputs = [Field("iterator_output", "Iterator")] 

11 shorthand = "_iter" 

12 documentation = "" 

13 

14 def exec(iterable_input: Iterable) -> Iterator: 

15 return iter(iterable_input) 

16 

17 

18class Iterable_in(object): 

19 source_language_name = {"CAST": "_in"} # TODO: What should this be 

20 inputs = [Field("iterable_input", "Iterable"), Field("element", "Any")] 

21 outputs = [Field("iterator_output", "Iterator")] 

22 shorthand = "_in" 

23 documentation = "" 

24 

25 def exec(iterable_input: Iterable, element: Any) -> bool: 

26 return element in iterable_input