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
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
@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
791
792
793
794
795
796
797
798
799
800
801
802
803
804
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