betty.factory module¶
Functionality for creating new class instances.
- class betty.factory.DependentFactory[source]¶
-
Provide a factory for classes that depend on
self
.- abstract async new(cls: type[_T]) _T [source]¶
Create a new instance.
- Raises:
FactoryError – raised when the class could not be instantiated.
- exception betty.factory.FactoryError[source]¶
Bases:
RuntimeError
Raised when a class could not be instantiated by a factory API.
- async betty.factory.new(cls: type[_T]) _T [source]¶
Create a new instance.
- Raises:
FactoryError – raised when the class could not be instantiated.