Skip to content

Competency¤

Competency dataclass ¤

Competency(worker: str, checker: str, technical_procedure: str)

Represents the competency element in an equipment register.

Parameters:

Name Type Description Default
worker str

The competent person who executed the technical procedure to accomplish the performance check.

required
checker str

The competent person who reviewed the work done by the worker.

required
technical_procedure str

The technical procedure that was executed to accomplish the performance check.

required

checker instance-attribute ¤

checker: str

The competent person who reviewed the work done by the worker.

technical_procedure instance-attribute ¤

technical_procedure: str

The technical procedure that was executed to accomplish the performance check.

worker instance-attribute ¤

worker: str

The competent person who executed the technical procedure to accomplish the performance check.

from_xml classmethod ¤

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

Convert an XML element into a Competency instance.

Parameters:

Name Type Description Default
element Element[str]

A competency XML element from an equipment register.

required

Returns:

Type Description
Competency

The Competency instance.

Source code in src/msl/equipment/schema.py
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
@classmethod
def from_xml(cls, element: Element[str]) -> Competency:
    """Convert an XML element into a [Competency][msl.equipment.schema.Competency] instance.

    Args:
        element: A [competency][type_competency] XML element from an equipment register.

    Returns:
        The [Competency][msl.equipment.schema.Competency] instance.
    """
    # Schema forces order
    return cls(
        worker=element[0].text or "",
        checker=element[1].text or "",
        technical_procedure=element[2].text or "",
    )

to_xml ¤

to_xml() -> Element[str]

Convert the Competency class into an XML element.

Returns:

Type Description
Element[str]

The Competency as an XML element.

Source code in src/msl/equipment/schema.py
860
861
862
863
864
865
866
867
868
869
870
871
872
873
def to_xml(self) -> Element[str]:
    """Convert the [Competency][msl.equipment.schema.Competency] class into an XML element.

    Returns:
        The [Competency][msl.equipment.schema.Competency] as an XML element.
    """
    e = Element("competency")
    worker = SubElement(e, "worker")
    worker.text = self.worker
    checker = SubElement(e, "checker")
    checker.text = self.checker
    tp = SubElement(e, "technicalProcedure")
    tp.text = self.technical_procedure
    return e