def configure_parameter_and_factory(config: Config): config.arguments(ParameterAndFactory, number=42, text="42") config.arg_factory(ParameterAndFactory, text=get_text)
def configure_arguments(config: Config): config.arguments(MyArg, arg1="foobar")
def configure_arg_factory(config: Config): config.arg_factory(ArgFactory, name=factory) config.arguments(NameProvider, name="foobar")
def configure_callable_with_context(config: Config): config.bind(T, foo) config.arguments(foo, a=1, where=UseT1) config.arguments(foo, a=2, where=UseT2)
def configure_lifetime_with_context(config: Config): config.bind(T, foo) config.arguments(foo, a=1, where=UseT1) config.arguments(foo, a=2, where=UseT2) config.lifetime(foo, Lifetime.SINGLETON, where=UseT2) config.lifetime(foo, where=UseT3, lifetime=Lifetime.SINGLETON)
def configure_singleton_with_context(config: Config): config.arguments(T, a=1, where=UseT1) config.arguments(T, a=2, where=UseT2) config.lifetime(T, Lifetime.SINGLETON, where=UseT1) config.lifetime(T, Lifetime.SINGLETON, where=UseT2)
def configure_configure_transient_with_context(config: Config): config.arguments(T, a=1, where=UseT1) config.arguments(T, a=2, where=UseT2)
def configure_callable(config: Config): config.bind(Transient, get_my_Transient) config.arguments(get_my_Transient, a=42)
def configure_singleton(config: Config): config.arguments(Transient, a=42, b=10.0) config.lifetime(Transient, Lifetime.SINGLETON)
def configure_transient(config: Config): config.arguments(Transient, a=42, b=10.0)