betty.mutability module¶
The mutability API.
This provides tools to mark objects as mutable or immutable, and to guard against mutations.
- exception betty.mutability.ImmutableError[source]¶
Bases:
MutabilityError
,RuntimeError
An error raised because something was unexpectedly immutable.
This is internal. It MAY be used anywhere in Betty’s source code, but MUST NOT be used by third-party code.
- exception betty.mutability.MutabilityError[source]¶
Bases:
Exception
A generic mutability API error.
- class betty.mutability.Mutable[source]¶
Bases:
object
A generic mutable type that can be marked immutable.
- assert_immutable() None [source]¶
Assert that the instance is immutable.
- Raises:
MutableError – if the instance is mutable.
- assert_mutable() None [source]¶
Assert that the instance is mutable.
- Raises:
ImmutableError – if the instance is immutable.
- get_mutable_instances() Iterable[Mutable] [source]¶
Get any other
betty.mutability.Mutable
instances contained by this one.
- exception betty.mutability.MutableError[source]¶
Bases:
MutabilityError
,RuntimeError
An error raised because something was unexpectedly mutable.
This is internal. It MAY be used anywhere in Betty’s source code, but MUST NOT be used by third-party code.