8000 Add missing attributes to `contextlib._(Async)GeneratorContextManager` by AlexWaygood · Pull Request #6676 · python/typeshed · GitHub
[go: up one dir, main page]

Skip to content
8000

Add missing attributes to contextlib._(Async)GeneratorContextManager #6676

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 20 commits into from
Dec 26, 2021
Merged
Changes from 1 commit
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix decorator
  • Loading branch information
AlexWaygood committed Dec 23, 2021
commit 81646129841f4db4ea0798fd1a1b989b1ac2ff4e
14 changes: 10 additions & 4 deletions stubs/decorator/decorator.pyi
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
import sys
from typing import Any, Callable, Iterator, NamedTuple, Pattern, Text, Tuple, TypeVar
from typing import Any, Callable, Generic, Iterator, NamedTuple, Pattern, Text, Tuple, TypeVar
from typing_extensions import ParamSpec

_C = TypeVar("_C", bound=Callable[..., Any])
_Func = TypeVar("_Func", bound=Callable[..., Any])
_P = ParamSpec("_P")
_T_co = TypeVar("_T_co", covariant=True)
_T_contra = TypeVar("_T_contra", contravariant=True)
_V = TypeVar("_V", covariant=True)
_T = TypeVar("_T")

def get_init(cls: type) -> None: ...
Expand Down Expand Up @@ -76,8 +80,10 @@ def decorator(
caller: Callable[..., Any], _func: Callable[..., Any] | None = ...
) -> Callable[[Callable[..., Any]], Callable[..., Any]]: ...

class ContextManager(_GeneratorContextManager[_T]):
def __call__(self, func: _C) -> _C: ...
if sys.version_info >= (3, 7):
class ContextManager(_GeneratorContextManager[_P, _T_co, _T_contra, _V], Generic[_P, _T_co, _T_contra, _V]): ...
else:
class ContextManager(_GeneratorContextManager[_T_co], Generic[_T_co]): ...

def contextmanager(func: Callable[..., Iterator[_T]]) -> Callable[..., ContextManager[_T]]: ...
def dispatch_on(*dispatch_args: Any) -> Callable[[Callable[..., Any]], Callable[..., Any]]: ...
0