dependencies icon indicating copy to clipboard operation
dependencies copied to clipboard

Shield object should pass keyword arguments.

Open proofit404 opened this issue 5 years ago • 0 comments

from dependencies import Injector, shield, this

class ClassWithKwargs:
    def __init__(self, **kwargs):
        ...

class Container(Injector):
    foo = shield(ClassWithKwargs, x=this.x, y=this.y)
    x = 1
    y = 2

Container.foo # will pass x and y to the class **kwargs

proofit404 avatar Jan 26 '21 12:01 proofit404