6666 ScopedInjectable ,
6767 ScopedSlotInjectable ,
6868 ShouldBeInjectable ,
69- SimpleInjectable ,
7069 SimpleScopedInjectable ,
7170 SingletonInjectable ,
71+ TransientInjectable ,
7272)
7373from injection ._core .slots import SlotKey
7474from injection .exceptions import (
@@ -430,7 +430,7 @@ def injectable[**P, T](
430430 wrapped : Recipe [P , T ] | None = None ,
431431 / ,
432432 * ,
433- cls : InjectableFactory [T ] = SimpleInjectable ,
433+ cls : InjectableFactory [T ] = TransientInjectable ,
434434 ignore_type_hint : bool = False ,
435435 inject : bool = True ,
436436 on : TypeInfo [T ] = (),
@@ -583,7 +583,12 @@ def make_injected_function[**P, T](
583583 threadsafe : bool = ...,
584584 ) -> AsyncInjectedFunction [P , T ]: ...
585585
586- def make_injected_function (self , wrapped , / , threadsafe = False ): # type: ignore[no-untyped-def]
586+ def make_injected_function [** P , T ](
587+ self ,
588+ wrapped : Callable [P , T ],
589+ / ,
590+ threadsafe : bool = False ,
591+ ) -> InjectedFunction [P , T ]:
587592 metadata = InjectMetadata (wrapped , threadsafe )
588593
589594 @metadata .task
@@ -592,7 +597,7 @@ def listen() -> None:
592597 self .add_listener (metadata )
593598
594599 if iscoroutinefunction (wrapped ):
595- return AsyncInjectedFunction (metadata )
600+ return AsyncInjectedFunction (metadata ) # type: ignore[arg-type, return-value]
596601
597602 return SyncInjectedFunction (metadata )
598603
@@ -630,7 +635,11 @@ async def aget_instance[T](
630635 default : None = ...,
631636 ) -> T | None : ...
632637
633- async def aget_instance (self , cls , default = None ): # type: ignore[no-untyped-def]
638+ async def aget_instance [T , Default ](
639+ self ,
640+ cls : InputType [T ],
641+ default : Default | None = None ,
642+ ) -> T | Default | None :
634643 try :
635644 return await self .afind_instance (cls )
636645 except (KeyError , SkipInjectable ):
@@ -650,7 +659,11 @@ def get_instance[T](
650659 default : None = ...,
651660 ) -> T | None : ...
652661
653- def get_instance (self , cls , default = None ): # type: ignore[no-untyped-def]
662+ def get_instance [T , Default ](
663+ self ,
664+ cls : InputType [T ],
665+ default : Default | None = None ,
666+ ) -> T | Default | None :
654667 try :
655668 return self .find_instance (cls )
656669 except (KeyError , SkipInjectable ):
@@ -674,7 +687,13 @@ def aget_lazy_instance[T](
674687 cache : bool = ...,
675688 ) -> Awaitable [T | None ]: ...
676689
677- def aget_lazy_instance (self , cls , default = None , * , cache = False ): # type: ignore[no-untyped-def]
690+ def aget_lazy_instance [T , Default ](
691+ self ,
692+ cls : InputType [T ],
693+ default : Default | None = None ,
694+ * ,
695+ cache : bool = False ,
696+ ) -> Awaitable [T | Default | None ]:
678697 if cache :
679698 return alazy (lambda : self .aget_instance (cls , default ))
680699
@@ -700,7 +719,13 @@ def get_lazy_instance[T](
700719 cache : bool = ...,
701720 ) -> Invertible [T | None ]: ...
702721
703- def get_lazy_instance (self , cls , default = None , * , cache = False ): # type: ignore[no-untyped-def]
722+ def get_lazy_instance [T , Default ](
723+ self ,
724+ cls : InputType [T ],
725+ default : Default | None = None ,
726+ * ,
727+ cache : bool = False ,
728+ ) -> Invertible [T | Default | None ]:
704729 if cache :
705730 return lazy (lambda : self .get_instance (cls , default ))
706731
@@ -790,8 +815,6 @@ def load_profile(self, *names: str) -> ContextManager[Self]:
790815
791816 self .unlock ().init_modules (* modules )
792817
793- del module , modules
794-
795818 @contextmanager
796819 def cleaner () -> Iterator [Self ]:
797820 yield self
0 commit comments