Skip to content

Commit

Permalink
update type annotations for the constructor parameters of Factory/Sin…
Browse files Browse the repository at this point in the history
…gleton (#102)
  • Loading branch information
stkrizh authored Oct 13, 2024
1 parent 5a0e25f commit 7595531
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion tests/tricky_cases/test_falsy_instances.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ async def create_async_resource() -> typing.AsyncIterator[dict[str, typing.Any]]


class TrickyDIContainer(BaseContainer):
singleton = providers.Singleton(list)
singleton = providers.Singleton(list[object])
sync_resource = providers.Resource(create_sync_resource)
async_resource = providers.Resource(create_async_resource)

Expand Down
2 changes: 1 addition & 1 deletion that_depends/providers/factories.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
class Factory(AbstractFactory[T_co]):
__slots__ = "_factory", "_args", "_kwargs", "_override"

def __init__(self, factory: type[T_co] | typing.Callable[P, T_co], *args: P.args, **kwargs: P.kwargs) -> None:
def __init__(self, factory: typing.Callable[P, T_co], *args: P.args, **kwargs: P.kwargs) -> None:
super().__init__()
self._factory: typing.Final = factory
self._args: typing.Final = args
Expand Down
2 changes: 1 addition & 1 deletion that_depends/providers/singleton.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
class Singleton(AbstractProvider[T_co]):
__slots__ = "_factory", "_args", "_kwargs", "_override", "_instance", "_resolving_lock"

def __init__(self, factory: type[T_co] | typing.Callable[P, T_co], *args: P.args, **kwargs: P.kwargs) -> None:
def __init__(self, factory: typing.Callable[P, T_co], *args: P.args, **kwargs: P.kwargs) -> None:
super().__init__()
self._factory: typing.Final = factory
self._args: typing.Final = args
Expand Down

0 comments on commit 7595531

Please sign in to comment.