Skip to content

Commit

Permalink
Fix nested decorator annotation (#370)
Browse files Browse the repository at this point in the history
Type checkers cannot solve an aliased, generic callable.
  • Loading branch information
layday authored Dec 19, 2020
1 parent 4e18422 commit a188be7
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions nox/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
from ._typing import Python

F = TypeVar("F", bound=Callable[..., Any])
G = Callable[[F], F]

_REGISTRY = collections.OrderedDict() # type: collections.OrderedDict[str, Func]

Expand All @@ -40,7 +39,7 @@ def session_decorator(
name: Optional[str] = ...,
venv_backend: Any = ...,
venv_params: Any = ...,
) -> G:
) -> Callable[[F], F]:
...


Expand All @@ -52,7 +51,7 @@ def session_decorator(
name: Optional[str] = None,
venv_backend: Any = None,
venv_params: Any = None,
) -> Union[F, G]:
) -> Union[F, Callable[[F], F]]:
"""Designate the decorated function as a session."""
# If `func` is provided, then this is the decorator call with the function
# being sent as part of the Python syntax (`@nox.session`).
Expand Down

0 comments on commit a188be7

Please sign in to comment.