SDF.data_model.sample module¶
-
class
Sample(name: typing.Union[str, SDF.data_model.name.NameElement], comment: typing.Optional[typing.Union[str, SDF.data_model.comment.Comment]] = None)[source]¶ Bases:
SDF.data_model.abstract.XMLWritableRepresents an SDF <sample> element
-
property
comment¶
-
classmethod
from_xml_element(element: xml.etree.ElementTree.Element) → SDF.data_model.sample.Sample[source]¶ Generates an instance of this class from an Element
-
property
name¶
-
to_xml_element() → xml.etree.ElementTree.Element[source]¶ Returns an Element object that contains all information needed to export this object as XML.
-
property
-
class
SampleSet(items: typing.Optional[typing.Iterable[SDF.data_model.sample.Sample]] = None)[source]¶ Bases:
SDF.data_model.element_set.ElementSet[SDF.data_model.sample.Sample]Behaves like Dict[str, str], where the keys are sample names and the values are the associated comments
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.
-
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