Skip to content

File¤

File dataclass ¤

File(
    url: str,
    sha256: str,
    attributes: dict[str, str] = dict(),
    comment: str = "",
)

Represents the file element in an equipment register.

Parameters:

Name Type Description Default
url str

The location of the file. The syntax follows RFC 1738 scheme:scheme-specific-part. If scheme: is not specified, it is assumed to be file:.

required
sha256 str

The SHA-256 checksum of the file.

required
attributes dict[str, str]

XML attributes associated with the <url> element.

dict()
comment str

A comment to associate with the file.

''

attributes class-attribute instance-attribute ¤

attributes: dict[str, str] = field(default_factory=dict)

XML attributes associated with the <url> element.

comment class-attribute instance-attribute ¤

comment: str = ''

A comment associated with the file.

sha256 instance-attribute ¤

sha256: str

The SHA-256 checksum of the file.

url instance-attribute ¤

url: str

The location of the file. The syntax follows RFC 1738 scheme:scheme-specific-part. If scheme: is not specified, it is assumed to be file:.

from_xml classmethod ¤

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

Convert an XML element into a File instance.

Parameters:

Name Type Description Default
element Element[str]

A file XML element from an equipment register.

required

Returns:

Type Description
File

The File instance.

to_xml ¤

to_xml() -> Element[str]

Convert the File class into an XML element.

Returns:

Type Description
Element[str]

The File as an XML element.