mafw.storage.logical_reference

Portable logical file references, independent of runtime storage roots.

Classes

LogicalFileReference(volume, relative_path)

Identify a file by storage volume name and a portable relative path.

class mafw.storage.logical_reference.LogicalFileReference(volume: str, relative_path: PurePosixPath)[source]

Bases: object

Identify a file by storage volume name and a portable relative path.

The serialized form is <volume>:<relative/path>. Volume names contain only ASCII letters, digits, underscores, and hyphens. Paths use POSIX separators and cannot be absolute or contain .. components. Redundant separators and . components are normalized away. The reference is lexical; it does not validate a configured volume or resolve a filesystem path.

Parameters:
  • volume – Case-sensitive logical volume name.

  • relative_path – POSIX-style path relative to that volume.

Added in version 2.4.

classmethod from_parameter_value(value: object) → LogicalFileReference[source]

Convert a serialized processor parameter value into this type.

Parameters:

value – An existing reference or its serialized string.

Returns:

The typed logical file reference.

Raises:
  • TypeError – If value is neither a reference nor a string.

  • ValueError – If the serialized reference is malformed.

Added in version 2.4: Added the optional processor-parameter conversion hook.

classmethod from_string(value: str) → LogicalFileReference[source]

Parse and validate a serialized logical file reference.

Parameters:

value – String in <volume>:<relative/path> form.

Returns:

The validated logical reference.

Raises:
  • TypeError – If value is not a string.

  • ValueError – If the serialized reference is malformed.

Added in version 2.4.

to_string() → str[source]

Return the canonical portable serialization.

Returns:

Canonical <volume>:<relative/path> representation.

Added in version 2.4.