コード例 #1
0
def elifFWSpshiv():
    """Let notation."""

    return Injector.let(bar=(this << 1).SubContainer2.baz)
コード例 #2
0
def e4b38a38de7e(Foo):
    """Let notation."""

    Summator = Injector.let(foo=Foo)

    Summator.foo
コード例 #3
0
ファイル: test_nested.py プロジェクト: thedrow/dependencies
def heSHjuBBFVLp():
    """Let notation."""

    return Injector.let(bar=(this << 2).foo)
コード例 #4
0
def b54832f696e9(Foo, Bar):
    """Let notation."""

    Summator = Injector.let(foo=Foo, bar=Bar)

    Summator.foo
コード例 #5
0
def c729e6952fee(Foo, Bar, Baz):
    """Let notation."""

    Summator = Injector.let(foo=Foo, bar=Bar, baz=Baz)

    Summator.foo
コード例 #6
0
def f7ef2aa82c18(Foo):
    """Let notation."""
    Injector.let(foo=Foo, args=(1, 2, 3))
コード例 #7
0
def c4362558f312(Foo):
    """Let notation."""

    Injector.let(foo=Foo, args=(1, 2, 3), kwargs={"start": 5})
コード例 #8
0
ファイル: test_this.py プロジェクト: thedrow/dependencies
def bd05271fb831():
    """Let notation with parent access."""

    Injector.let(foo=(this << 1))
コード例 #9
0
ファイル: test_this.py プロジェクト: thedrow/dependencies
def ww6xNI4YrNr6():
    """Let notation."""

    Injector.let(foo=(this << 1).bar).foo
コード例 #10
0
ファイル: test_this.py プロジェクト: thedrow/dependencies
def pKanncCIsUww():
    """Let notation."""

    return Injector.let(foo=this.bar(), bar=lambda: 1)
コード例 #11
0
ファイル: test_this.py プロジェクト: thedrow/dependencies
def a37783b6d1ad():
    """Let notation."""

    Injector.let(foo=this)
コード例 #12
0
def ydZEbpRNlHEO():

    Injector.let(foo=this.bar, bar=this.baz, baz=this.foo).foo
コード例 #13
0
def ySnRrxW6M79T():
    """Let notation.  Complex loop."""

    Injector.let(foo=this.bar, bar=this.foo).foo
コード例 #14
0
def rRsNsCaBSxke():
    """Let notation."""

    return Injector.let(baz=(this << 1).SubContainer1.bar)
コード例 #15
0
def f9c50c81e8c9():
    """Let notation."""

    Foo = Injector.let()

    Foo.test
コード例 #16
0
ファイル: test_this.py プロジェクト: thedrow/dependencies
def rN3suiVzhqMM():
    """Let notation with nested layer."""

    Injector.let(SubContainer=Injector.let(
        foo=(this << 2).bar)).SubContainer.foo
コード例 #17
0
def zlZoLka31ndk():
    """Let notation."""

    return Injector.let(foo=1)
コード例 #18
0
ファイル: test_this.py プロジェクト: thedrow/dependencies
def vnmkIELBH3MN():
    """Let notation."""

    Injector.let(foo=this.bar).foo
コード例 #19
0
def bcf7c5881b2c(Foo):
    """Let notation."""

    Injector.let(foo=Foo, kwargs={"start": 5})
コード例 #20
0
ファイル: test_this.py プロジェクト: thedrow/dependencies
def pG9M52ZRQr2S():
    """Let notation with nested layer."""

    Injector.let(SubContainer=Injector.let(
        foo=(this << 1).bar)).SubContainer.foo
コード例 #21
0
def test_task_arguments(celery_app, code):
    """
    Allow task decorator arguments customization through `Injector`
    subclass attributes.
    """

    class Foo(object):
        def __call__(self, a, b):
            return a + b

    class Bar(object):
        def __init__(self, foo, task, args, kwargs):
            self.foo = foo
            self.task = task
            self.args = args
            self.kwargs = kwargs

        def do(self):
            one = self.args[0]
            two = self.kwargs["two"]
            assert isinstance(self.task, MyTask)
            return self.foo(one, two)

    class MyTask(celery.Task):
        pass

    code(
        celery_app,
        Injector.let(
            foo=Foo,
            bar=Bar,
            base_class=MyTask,
            bind=True,
            typing=False,
            max_retries=1,
            default_retry_delay=1,
            rate_limit="100/h",
            ignore_result=True,
            trail=False,
            send_events=False,
            store_errors_even_if_ignored=True,
            serializer="yaml",
            time_limit=500,
            soft_time_limit=250,
            track_started=True,
            acks_late=True,
            reject_on_worker_lost=True,
            throws=(ValueError, AttributeError),
        ),
    )

    task_instance = celery_app.tasks["foo.bar.baz"]
    assert task_instance(1, two=2) == 3
    assert isinstance(task_instance, MyTask)
    assert task_instance.typing is False
    assert task_instance.max_retries == 1
    assert task_instance.default_retry_delay == 1
    assert task_instance.rate_limit == "100/h"
    assert task_instance.ignore_result is True
    assert task_instance.trail is False
    assert task_instance.send_events is False
    assert task_instance.store_errors_even_if_ignored is True
    assert task_instance.serializer == "yaml"
    assert task_instance.time_limit == 500
    assert task_instance.soft_time_limit == 250
    assert task_instance.track_started is True
    assert task_instance.acks_late is True
    assert task_instance.reject_on_worker_lost is True
    assert task_instance.throws == (ValueError, AttributeError)
コード例 #22
0
def bccb4f621e70(Foo, Bar):
    """Let notation."""

    Injector.let(bar=Bar)
コード例 #23
0
def c039a81e8dce(Foo, Bar):
    """Let notation chain."""

    Summator = Injector.let(foo=Foo).let(bar=Bar)

    Summator.foo
コード例 #24
0
def b859e98f2913(Bar):
    """Let notation."""

    Injector.let(bar=Bar)
コード例 #25
0
def d701f88a5c42(Foo, Bar, Baz):
    """Let notation chain."""

    Summator = Injector.let(foo=Foo).let(bar=Bar).let(baz=Baz)

    Summator.foo
コード例 #26
0
def pHfF0rbEjCsV():
    """Let notation."""

    Container = Injector.let()
    Container.foo = 1
コード例 #27
0
ファイル: test_nested.py プロジェクト: thedrow/dependencies
def gYijGKMqAbZN(lowest):
    """Let notation."""

    return Injector.let(SubSubContainer=lowest)
コード例 #28
0
def jShuBfttg97c():
    """Delete attribute let notation."""

    Container = Injector.let(foo=1)
    del Container.foo
コード例 #29
0
ファイル: test_nested.py プロジェクト: thedrow/dependencies
def f607abc82079(sub):
    """Let notation."""

    return Injector.let(foo=1, SubContainer=sub)
コード例 #30
0
def n8NHZqiZN43Q():
    """Let notation.  Link to self."""

    Injector.let(foo=this.foo).foo