Fix various ParamSpec errors in typing (GH-24176)

1. ParamSpec -> TypeVar for ``typing.Concatenate``
2. ParamSpec's call signature should align with its documentation.
Noticed in GH-24169
This commit is contained in:
Ken Jin 2021-01-11 08:11:41 +08:00 committed by GitHub
parent 81f87bbf9f
commit ace008c531
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View file

@ -695,10 +695,10 @@ These can be used as types in annotations using ``[]``, each having a unique syn
from collections.abc import Callable
from threading import Lock
from typing import Any, Concatenate, ParamSpec
from typing import Any, Concatenate, ParamSpec, TypeVar
P = ParamSpec('P')
R = ParamSpec('R')
R = TypeVar('R')
# Use this lock to ensure that only one thread is executing a function
# at any time.

View file

@ -779,7 +779,7 @@ def add_two(x: float, y: float) -> float:
args = object()
kwargs = object()
def __init__(self, name, bound=None, covariant=False, contravariant=False):
def __init__(self, name, *, bound=None, covariant=False, contravariant=False):
self.__name__ = name
super().__init__(bound, covariant, contravariant)
try: