I’m trying to get a group of dependencies based on a string in the configuration. However, no matter what I try—using the built-in providers and selectors for this—in the final class I still end up with a provider instead of a dependency. What am I doing wrong? (An example is shown in the code below.)
class SomeValue():
...
class SomeClass():
def __init__(self, v) -> None:
assert not isinstance(v, Factory) # Goal: pass it
...
class SomeValueContainer(DeclarativeContainer):
value = Factory(SomeValue)
class MasterContainer(DeclarativeContainer):
config = Configuration()
value = Selector(
config.x,
b=Container(SomeValueContainer)
)
factory = Factory(SomeClass, v=value.provided.value.provided)
container = MasterContainer()
container.config.from_dict({"x": "b"})
container.factory()
I’m trying to get a group of dependencies based on a string in the configuration. However, no matter what I try—using the built-in providers and selectors for this—in the final class I still end up with a provider instead of a dependency. What am I doing wrong? (An example is shown in the code below.)