Skip to content

Commit

Permalink
remove protocol
Browse files Browse the repository at this point in the history
  • Loading branch information
JonathanSerafini committed Aug 18, 2023
1 parent faf655c commit 31976d6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 17 deletions.
6 changes: 1 addition & 5 deletions fast_depends/dependencies/provider.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
from typing import Any, Callable, Dict, Protocol


class HasDependencyOverrides(Protocol):
dependency_overrides: Dict[Callable[..., Any], Callable[..., Any]]
from typing import Any, Callable, Dict


class Provider:
Expand Down
17 changes: 5 additions & 12 deletions fast_depends/use.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

from fast_depends.core import CallModel, build_call_model
from fast_depends.dependencies import dependency_provider, model
from fast_depends.dependencies.provider import HasDependencyOverrides

P = ParamSpec("P")
T = TypeVar("T")
Expand Down Expand Up @@ -41,9 +40,7 @@ def __call__(
def inject( # pragma: no covers
func: None,
*,
dependency_overrides_provider: Optional[
HasDependencyOverrides
] = dependency_provider,
dependency_overrides_provider: Optional[Any] = dependency_provider,
extra_dependencies: Sequence[model.Depends] = (),
wrap_model: Callable[[CallModel[P, T]], CallModel[P, T]] = lambda x: x,
) -> _InjectWrapper[P, T]:
Expand All @@ -54,9 +51,7 @@ def inject( # pragma: no covers
def inject( # pragma: no covers
func: Callable[P, T],
*,
dependency_overrides_provider: Optional[
HasDependencyOverrides
] = dependency_provider,
dependency_overrides_provider: Optional[Any] = dependency_provider,
extra_dependencies: Sequence[model.Depends] = (),
wrap_model: Callable[[CallModel[P, T]], CallModel[P, T]] = lambda x: x,
) -> Callable[P, T]:
Expand All @@ -66,9 +61,7 @@ def inject( # pragma: no covers
def inject(
func: Optional[Union[Callable[P, T], Callable[P, Awaitable[T]]]] = None,
*,
dependency_overrides_provider: Optional[
HasDependencyOverrides
] = dependency_provider,
dependency_overrides_provider: Optional[Any] = dependency_provider,
extra_dependencies: Sequence[model.Depends] = (),
wrap_model: Callable[[CallModel[P, T]], CallModel[P, T]] = lambda x: x,
) -> Union[Union[Callable[P, T], Callable[P, Awaitable[T]]], _InjectWrapper[P, T],]:
Expand All @@ -86,7 +79,7 @@ def inject(


def _resolve_overrides_provider(
dependency_overrides_provider: Optional[HasDependencyOverrides],
dependency_overrides_provider: Optional[Any],
) -> Optional[dict[Callable[..., Any], Callable[..., Any]]]:
if not dependency_overrides_provider:
return None
Expand All @@ -95,7 +88,7 @@ def _resolve_overrides_provider(


def _wrap_inject(
dependency_overrides_provider: Optional[HasDependencyOverrides],
dependency_overrides_provider: Optional[Any],
wrap_model: Callable[
[CallModel[P, T]],
CallModel[P, T],
Expand Down

0 comments on commit 31976d6

Please sign in to comment.