Coverage for skema/gromet/execution_engine/types/record.py: 93%
29 statements
« prev ^ index » next coverage.py v7.5.0, created at 2024-04-30 17:15 +0000
« prev ^ index » next coverage.py v7.5.0, created at 2024-04-30 17:15 +0000
1from skema.gromet.execution_engine.types.defined_types import (
2 Field,
3 Record,
4 RecordField,
5)
8class new_Record(object):
9 source_language_name = {"Python": "new_Record"}
10 inputs = [Field("record_name", "String")]
11 outputs = [Field("record_output", "Record")]
12 shorthand = "new_Record"
13 documentation = ""
15 def exec(record_name: str) -> Record:
16 return Record(record_name)
19class new_Field(object):
20 source_language_name = {"Python": "new_Field"}
21 inputs = [
22 Field("record_input", "Record"),
23 Field("field_name", "String"),
24 Field("value_type", "Type"),
25 ]
26 outputs = [Field("record_output", "Record")]
27 shorthand = "new_Field"
28 documentation = ""
30 def exec(
31 record_input: Record, field_name: str, value_type: type
32 ) -> Record:
33 return record_input.fields.append(
34 RecordField(field_name, value_type, None)
35 ) # #TODO: Do we need to set a default value?
38class Record_get(object):
39 source_language_name = {"CAST": "record_get"}
40 inputs = [Field("record_input", "Record"), Field("index", "String")]
41 outputs = [Field("field_output", "Field")]
42 shorthand = "record_get"
43 documentation = ""
46class Record_set(object):
47 source_language_name = {"CAST": "record_set"}
48 inputs = [
49 Field("record_input", "Record"),
50 Field("index", "String"),
51 Field("element", "Any"),
52 ]
53 outputs = [Field("record_output", "Record")]
54 shorthand = "record_set"
55 documentation = ""