@@ -1694,7 +1694,8 @@ def _typeddict_new(*args, total=True, **kwargs):
1694
1694
1695
1695
class _TypedDictMeta (type ):
1696
1696
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.
1698
1699
# See https://www.python.org/dev/peps/pep-0487/#implementation-details
1699
1700
super (_TypedDictMeta , cls ).__init__ (name , bases , ns )
1700
1701
@@ -2072,7 +2073,6 @@ class Annotated(metaclass=AnnotatedMeta):
2072
2073
get_origin = typing .get_origin
2073
2074
get_args = typing .get_args
2074
2075
elif PEP_560 :
2075
- from typing import _GenericAlias
2076
2076
try :
2077
2077
# 3.9+
2078
2078
from typing import _BaseGenericAlias
@@ -2386,6 +2386,7 @@ def _get_type_vars(self, tvars):
2386
2386
if self not in tvars :
2387
2387
tvars .append (self )
2388
2388
2389
+
2389
2390
# Inherits from list as a workaround for Callable checks in Python < 3.9.2.
2390
2391
class _ConcatenateGenericAlias (list ):
2391
2392
@@ -2433,6 +2434,7 @@ def _get_type_vars(self, tvars):
2433
2434
if self .__origin__ and self .__parameters__ :
2434
2435
typing ._get_type_vars (self .__parameters__ , tvars )
2435
2436
2437
+
2436
2438
@_tp_cache
2437
2439
def _concatenate_getitem (self , parameters ):
2438
2440
if parameters == ():
@@ -2473,7 +2475,8 @@ def __repr__(self):
2473
2475
def __getitem__ (self , parameters ):
2474
2476
return _concatenate_getitem (self , parameters )
2475
2477
2476
- Concatenate = _ConcatenateForm ('Concatenate' ,
2478
+ Concatenate = _ConcatenateForm (
2479
+ 'Concatenate' ,
2477
2480
doc = """Used in conjunction with ``ParamSpec`` and ``Callable`` to represent a
2478
2481
higher order function which adds, removes or transforms parameters of a
2479
2482
callable.
@@ -2616,8 +2619,8 @@ def __getitem__(self, parameters):
2616
2619
return _GenericAlias (self , (item ,))
2617
2620
2618
2621
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
2621
2624
type guard function. ``TypeGuard`` only accepts a single type argument.
2622
2625
At runtime, functions marked this way should return a boolean.
2623
2626
0 commit comments