MCPcopy Create free account
hub / github.com/NTNU-IHB/PythonFMU / String

Class String

pythonfmu/variables.py:187–208  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

185
186
187class String(ScalarVariable):
188 def __init__(self, name: str, start: Optional[Any] = None, **kwargs):
189 super().__init__(name, **kwargs)
190 self.__attrs = {"start": start}
191
192 @property
193 def start(self) -> Optional[Any]:
194 return self.__attrs["start"]
195
196 @start.setter
197 def start(self, value: float):
198 self.__attrs["start"] = value
199
200 def to_xml(self) -> Element:
201 attrib = dict()
202 for key, value in self.__attrs.items():
203 if value is not None:
204 attrib[key] = str(value)
205 parent = super().to_xml()
206 SubElement(parent, "String", attrib)
207
208 return parent

Callers 4

test_String_constructorFunction · 0.90
test_String_to_xmlFunction · 0.90
__init__Method · 0.85
__init__Method · 0.85

Calls

no outgoing calls

Tested by 2

test_String_constructorFunction · 0.72
test_String_to_xmlFunction · 0.72