@@ -1694,7 +1694,8 @@ def _typeddict_new(*args, total=True, **kwargs):
16941694
16951695 class _TypedDictMeta (type ):
16961696 def __init__ (cls , name , bases , ns , total = True ):
1697- # In Python 3.4 and 3.5 the __init__ method also needs to support the keyword arguments.
1697+ # In Python 3.4 and 3.5 the __init__ method also needs to support the
1698+ # keyword arguments.
16981699 # See https://www.python.org/dev/peps/pep-0487/#implementation-details
16991700 super (_TypedDictMeta , cls ).__init__ (name , bases , ns )
17001701
@@ -2072,7 +2073,6 @@ class Annotated(metaclass=AnnotatedMeta):
20722073 get_origin = typing .get_origin
20732074 get_args = typing .get_args
20742075elif PEP_560 :
2075- from typing import _GenericAlias
20762076 try :
20772077 # 3.9+
20782078 from typing import _BaseGenericAlias
@@ -2386,6 +2386,7 @@ def _get_type_vars(self, tvars):
23862386 if self not in tvars :
23872387 tvars .append (self )
23882388
2389+
23892390# Inherits from list as a workaround for Callable checks in Python < 3.9.2.
23902391class _ConcatenateGenericAlias (list ):
23912392
@@ -2433,6 +2434,7 @@ def _get_type_vars(self, tvars):
24332434 if self .__origin__ and self .__parameters__ :
24342435 typing ._get_type_vars (self .__parameters__ , tvars )
24352436
2437+
24362438@_tp_cache
24372439def _concatenate_getitem (self , parameters ):
24382440 if parameters == ():
@@ -2473,7 +2475,8 @@ def __repr__(self):
24732475 def __getitem__ (self , parameters ):
24742476 return _concatenate_getitem (self , parameters )
24752477
2476- Concatenate = _ConcatenateForm ('Concatenate' ,
2478+ Concatenate = _ConcatenateForm (
2479+ 'Concatenate' ,
24772480 doc = """Used in conjunction with ``ParamSpec`` and ``Callable`` to represent a
24782481 higher order function which adds, removes or transforms parameters of a
24792482 callable.
@@ -2616,8 +2619,8 @@ def __getitem__(self, parameters):
26162619 return _GenericAlias (self , (item ,))
26172620
26182621 TypeGuard = _TypeGuardForm (
2619- 'TypeGuard' ,
2620- doc = """Special typing form used to annotate the return type of a user-defined
2622+ 'TypeGuard' ,
2623+ doc = """Special typing form used to annotate the return type of a user-defined
26212624 type guard function. ``TypeGuard`` only accepts a single type argument.
26222625 At runtime, functions marked this way should return a boolean.
26232626
0 commit comments