betty.machine_name module - Betty documentation

Hide navigation sidebar
Hide table of contents sidebar
Skip to content
Back to top
View this page
Toggle table of contents sidebar

# betty.machine_name module

Define portable machine names.

exception betty.machine_name.InvalidMachineName

  Bases: `UserFacingError`, `ValueError`

  Raised when something is not a valid machine name.

  classmethod new(value: str) → Self

    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]

  Assert that a string is a machine name.

betty.machine_name.machinify(source: str) → str | None

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

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

  Validate that a string is a machine name.