I'm trying to create a Dependency provider for some python interface I have in the form of abstract-base-class (ABC).
Trying creating the provider raises an error.
What is the correct way for achieving this?
# file testc.pyfromabcimportABCfromdependency_injectorimportprovidersclassBase(ABC):
passclassImpl(Base):
passp=providers.Dependency(Base) # this line raisesp.provided_by(providers.Object(Impl()))
I get the following error:
Traceback (most recent call last):
File "testc.py", line 13, in <module>
p = providers.Dependency(Base)
TypeError: Argument 'instance_of' has incorrect type (expected type, got ABCMeta)
Thanks
The text was updated successfully, but these errors were encountered:
Hi,
I'm trying to create a Dependency provider for some python interface I have in the form of abstract-base-class (ABC).
Trying creating the provider raises an error.
What is the correct way for achieving this?
I get the following error:
Thanks
The text was updated successfully, but these errors were encountered: