betty.machine_name module

Define portable machine names.

exception betty.machine_name.InvalidMachineName[source]

Bases: UserFacingError, ValueError

Raised when something is not a valid machine name.

classmethod new(value: str) Self[source]

Create a new instance.

betty.machine_name.MachineName

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

See betty.machine_name.validate_machine_name().

betty.machine_name.assert_machine_name() AssertionChain[Any, str][source]

Assert that something is a machine name.

betty.machine_name.machinify(source: str) str | None[source]

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

betty.machine_name.validate_machine_name(alleged_machine_name: str) TypeGuard[str][source]

Validate that a string is a machine name.