harp.services¶
- exception CannotResolveParameterException[source]¶
Bases:
DIException
Exception risen when it is not possible to resolve a parameter, necessary to instantiate a type.
- exception CannotResolveTypeException[source]¶
Bases:
DIException
Exception risen when it is not possible to resolve a Type.
- exception CircularDependencyException[source]¶
Bases:
DIException
Exception risen when a circular dependency between a type and one of its parameters is detected.
- exception FactoryMissingContextException[source]¶
Bases:
DIException
- exception MissingTypeException[source]¶
Bases:
DIException
Exception risen when a type must be specified to use a factory
- exception OverridingServiceException[source]¶
Bases:
DIException
Exception risen when registering a service would override an existing one.
- exception UnsupportedUnionTypeException[source]¶
Bases:
DIException
Exception risen when a parameter type is defined as Optional or Union of several types.
- class Container[source]¶
Bases:
Container
Override’s rodi container with our way to load services. This is a working implementation, although it would need polishing. Maybe the container should be reworked entirely to avoid the rodi duplications entirely, here the api methods using the builtin rodi providers/resolvers are still available, and that’s maybe not what we want, for the long term.
- load(filename, *, bind_settings)[source]¶
Loads a declarative service collection from a yaml file, and bind settings for config resolution.
- Parameters:
filename – str
bind_settings – dict-like
- strict¶
- class LazyServiceReference[source]¶
Bases:
BaseReference
Reference to a service, that will be resolved the latest possible, when the instance will actually be needed.
Create a new model by parsing and validating input data from keyword arguments.
Raises
pydantic_core.ValidationError
if the input data cannot be validated.- classmethod build_from_yaml(loader, node)[source]¶
Secondary constructor implementing the pyyaml constructor interface.
- Return type:
- resolve(resolver, context)[source]¶
Resolve reference value in using the given resolver (callable) and resolution context.
- model_computed_fields: ClassVar[Dict[str, ComputedFieldInfo]] = {}¶
A dictionary of computed field names and their corresponding ComputedFieldInfo objects.
- model_config: ClassVar[ConfigDict] = {}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class Services[source]¶
Bases:
object
Provides methods to activate instances of classes, by cached activator functions.