betty.machine_name module

Machine names.

final exception betty.machine_name.InvalidMachineName

Bases: HumanFacingException, ValueError

Raised when something is not a valid machine name.

__init__(value: str, /)
final class betty.machine_name.MachineName

Bases: Portable[str], str, Data

A machine name.

A machine name is a string that meets these criteria: - At most 250 characters long. - Lowercase letters, numbers, and hyphens (-).

__init__(machine_name: str, /)
static __new__(cls, machine_name: str, /)
dump() str

Dump the instance to portable data.

Raises:

betty.portable.error.NotPortable – Raised if any part of the data is not portable.

classmethod load(portable: PortableData, /) Self

Create a new instance from portable data.

Raises:

betty.exception.HumanFacingException – Raised if the portable data is invalid.

classmethod machinify(source: str, /) Self | None

Attempt to convert a source string into a valid machine name.

classmethod resolve(machine_name: ResolvableMachineName) MachineName

Resolve a value to a machine name.