From 0ea609bfa71ba22a61e48f020580594404a71b9e Mon Sep 17 00:00:00 2001 From: remimd Date: Mon, 26 May 2025 15:52:30 +0200 Subject: [PATCH] =?UTF-8?q?refactoring:=20=E2=99=BB=EF=B8=8F=20Small=20cha?= =?UTF-8?q?nges?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- injection/__init__.pyi | 6 +++--- injection/ext/fastapi.py | 2 +- tests/core/test_module.py | 6 ++++-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/injection/__init__.pyi b/injection/__init__.pyi index 2e8628c..1689796 100644 --- a/injection/__init__.pyi +++ b/injection/__init__.pyi @@ -178,9 +178,9 @@ class Module: mode: Mode | ModeStr = ..., ) -> Any: """ - Decorator applicable to a class or function. It is used to indicate how the - constant is constructed. At injection time, the injected instance will always - be the same. Unlike `@singleton`, dependencies will not be resolved. + Decorator applicable to a class. It is used to indicate how the constant is + constructed. At injection time, the injected instance will always be the same. + Unlike `@singleton`, dependencies will not be resolved. """ def set_constant[T]( diff --git a/injection/ext/fastapi.py b/injection/ext/fastapi.py index 7568133..62309ae 100644 --- a/injection/ext/fastapi.py +++ b/injection/ext/fastapi.py @@ -12,7 +12,7 @@ @dataclass(eq=False, frozen=True, slots=True) class FastAPIInject: module: Module = field(default_factory=mod) - threadsafe: bool = field(default=False) + threadsafe: bool = field(default=False, kw_only=True) def __call__[T]( self, diff --git a/tests/core/test_module.py b/tests/core/test_module.py index 94afad4..19d7b4b 100644 --- a/tests/core/test_module.py +++ b/tests/core/test_module.py @@ -90,13 +90,15 @@ async def test_aget_instance_with_success_return_instance(self, module): assert isinstance(instance, SomeClass) async def test_aget_instance_with_no_injectable_return_not_implemented( - self, module + self, + module, ): instance = await module.aget_instance(SomeClass) assert instance is NotImplemented async def test_aget_instance_with_empty_annotated_return_not_implemented( - self, module + self, + module, ): instance = await module.aget_instance(Annotated) assert instance is NotImplemented