betty.service package¶
Subpackages¶
Submodules¶
Module contents¶
An API for providing application-wide services.
- final class betty.service.Service¶
Bases:
GenericWrap a service so it can be type-checked as such.
- service: ServiceT¶
- exception betty.service.ServiceAlreadyInitialized¶
Bases:
ServiceErrorA service was unexpectedly initialized already.
- exception betty.service.ServiceError¶
Bases:
RuntimeErrorA service API error.
- class betty.service.ServiceManager¶
Bases:
Prop[ServiceProviderT,GetServiceT,Any],GenericManage a single service for a service provider.
- __init__(factory: ServiceOrFactory[ServiceProviderT, ServiceT, FactoryServiceT], /)¶
- final get(service_provider: ServiceProviderT, /) GetServiceT¶
Get the property value from the owner.
- final override(service_provider: ServiceProviderT, service: ServiceOrFactory[ServiceProviderT, ServiceT, FactoryServiceT], /) None¶
Override the service for the given service provider.
Calling this will prevent the existing factory from being called.
This MUST only be called from
instance.__init__().
- exception betty.service.ServiceNotYetInitialized¶
Bases:
ServiceErrorA service was unexpectedly not yet initialized.
- class betty.service.ServiceProvider¶
Bases:
HasPropsA service provider.
- __init__(*args: Any, services: ServiceLevel, **kwargs: Any)¶
- property services: ServiceLevel¶
The service level the services are provided for.