Skip to content

SpecifiedRequirements¤

SpecifiedRequirements ¤

SpecifiedRequirements(**attributes: str)

Bases: Any

Verification that equipment conforms with specified requirements before being placed or returned into service.

Since this class is currently represented by the any type in the XML Schema Definition, it is simply a subclass of Element. It may be updated to be a more specific class at a later date.

Parameters:

Name Type Description Default
attributes str

All keyword arguments are used as the element's attributes.

{}
Source code in src/msl/equipment/schema.py
146
147
148
149
150
151
152
def __init__(self, **attributes: str) -> None:
    """Base class that represents the [any][type_any] type in the XML Schema Definition.

    Args:
        attributes: All keyword arguments are used as the element's attributes.
    """
    super().__init__(self.tag, attrib={}, **attributes)

tag class-attribute instance-attribute ¤

tag: str = 'specifiedRequirements'

The element's name.

from_xml classmethod ¤

from_xml(element: Element[str]) -> A

Copies an XML element into the Any subclass.

Parameters:

Name Type Description Default
element Element[str]

An XML element from an equipment register.

required

Returns:

Type Description
A

The subclass instance.

Source code in src/msl/equipment/schema.py
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
@classmethod
def from_xml(cls: type[A], element: Element[str]) -> A:  # noqa: PYI019
    """Copies an XML element into the [Any][msl.equipment.schema.Any] subclass.

    Args:
        element: An XML element from an equipment register.

    Returns:
        The subclass instance.
    """
    prefix = f"{{{Register.NAMESPACE}}}"
    for e in element.iter():
        if e.tag.startswith(prefix):  # str.removeprefix() was added in Python 3.9
            e.tag = e.tag[len(prefix) :]

    c = cls(**element.attrib)
    c.tail = element.tail
    c.text = element.text
    c.extend(element)
    return c