SDF.data_model.parameter module¶
-
class
AnonymousParameterSet(items: typing.Optional[typing.Iterable[SDF.data_model.parameter.ParameterType]] = None)[source]¶ Bases:
SDF.data_model.element_set.ElementSet[SDF.data_model.parameter.ParameterType]Create an empty ElementSet.
- Parameters
key_func – Function to get a string key from an item (e.g. lambda item: item.name)
check_func – Function to check if an item is valid for this ElementSet (e.g. lambda item: hasattr(item, ‘name’) or lambda item: isinstance(item, …)). If it returns True, everything is fine. If it returns False, a default exception is raised. To raise a more specific exception, raise an exception instead of returning False.
-
add(item: T, as_first: bool = False) → None¶ Add an item to the collection. If as_first, the item is added at the beginning, else at the end.
-
add_from_structure(structure: typing.Sequence, parse_names_from_dicts: bool = False)[source]¶
-
copy() → SDF.data_model.element_set.ElementSet[T]¶ Return a shallow copy of this collection
-
items() → typing.ItemsView[str, T]¶ Like dict.items
-
keys() → typing.KeysView[str]¶ Like dict.keys
-
pop(key: typing.Optional[typing.Union[str, int]] = None) → T¶ Like dict.pop if key is str, else like list.pop
-
remove(item: typing.Union[str, T]) → None¶ Remove the item. If key is a string, remove the item specified by key
-
update(*items: typing.Union[T, typing.Iterable[T]]) → None¶ Like set.update
-
values() → typing.ValuesView[T]¶ Like dict.values
-
class
Parameter(name: typing.Union[str, SDF.data_model.name.Name], value: typing.Any, unit: typing.Optional[str] = None)[source]¶ Bases:
SDF.data_model.parameter.ParameterTypeRepresents a single-valued SDF <par> element
-
classmethod
from_xml_element(element: xml.etree.ElementTree.Element) → SDF.data_model.parameter.Parameter[source]¶ Generates an instance of this class from an Element
-
property
name¶
-
property
parsed_value¶ Try to parse self.value as a Python literal (e.g. int, float, list, tuple, str, bytes)
-
to_xml_element() → xml.etree.ElementTree.Element[source]¶ Returns an Element object that contains all information needed to export this object as XML.
-
classmethod
-
class
ParameterSet(name: typing.Union[str, SDF.data_model.name.Name], items: typing.Optional[typing.Iterable[SDF.data_model.parameter.ParameterType]] = None)[source]¶ Bases:
SDF.data_model.parameter.AnonymousParameterSet,SDF.data_model.parameter.ParameterTypeCreate an empty ElementSet.
- Parameters
key_func – Function to get a string key from an item (e.g. lambda item: item.name)
check_func – Function to check if an item is valid for this ElementSet (e.g. lambda item: hasattr(item, ‘name’) or lambda item: isinstance(item, …)). If it returns True, everything is fine. If it returns False, a default exception is raised. To raise a more specific exception, raise an exception instead of returning False.
-
add(item: T, as_first: bool = False) → None¶ Add an item to the collection. If as_first, the item is added at the beginning, else at the end.
-
add_from_structure(structure: typing.Sequence, parse_names_from_dicts: bool = False)¶
-
copy() → SDF.data_model.parameter.ParameterSet[source]¶ Return a shallow copy of this collection
-
classmethod
from_xml_element(element: xml.etree.ElementTree.Element) → SDF.data_model.parameter.ParameterSet[source]¶ Generates an instance of this class from an Element
-
items() → typing.ItemsView[str, T]¶ Like dict.items
-
keys() → typing.KeysView[str]¶ Like dict.keys
-
property
name¶
-
pop(key: typing.Optional[typing.Union[str, int]] = None) → T¶ Like dict.pop if key is str, else like list.pop
-
remove(item: typing.Union[str, T]) → None¶ Remove the item. If key is a string, remove the item specified by key
-
to_xml_element() → xml.etree.ElementTree.Element[source]¶ Returns an Element object that contains all information needed to export this object as XML.
-
update(*items: typing.Union[T, typing.Iterable[T]]) → None¶ Like set.update
-
values() → typing.ValuesView[T]¶ Like dict.values
-
class
ParameterType[source]¶ Bases:
SDF.data_model.abstract.XMLWritable-
static
from_xml_element(element: xml.etree.ElementTree.Element) → SDF.data_model.parameter.ParameterType[source]¶ Generates an instance of this class from an Element
-
abstract
to_xml_element() → xml.etree.ElementTree.Element¶ Returns an Element object that contains all information needed to export this object as XML.
-
static