@@ -884,7 +884,6 @@ def __new__(cls, *args, **kwds):
884884 return collections .deque (* args , ** kwds )
885885 return _generic_new (collections .deque , cls , * args , ** kwds )
886886
887-
888887else :
889888
890889 class Deque (
@@ -912,7 +911,6 @@ class ContextManager(
912911 ):
913912 __slots__ = ()
914913
915-
916914else :
917915
918916 class ContextManager (typing .Generic [T_co ]):
@@ -994,7 +992,6 @@ def __new__(cls, *args, **kwds):
994992 return collections .defaultdict (* args , ** kwds )
995993 return _generic_new (collections .defaultdict , cls , * args , ** kwds )
996994
997-
998995else :
999996
1000997 class DefaultDict (
@@ -1032,7 +1029,6 @@ def __new__(cls, *args, **kwds):
10321029 return collections .OrderedDict (* args , ** kwds )
10331030 return _generic_new (collections .OrderedDict , cls , * args , ** kwds )
10341031
1035-
10361032else :
10371033
10381034 class OrderedDict (
@@ -1073,7 +1069,6 @@ def __new__(cls, *args, **kwds):
10731069 return collections .Counter (* args , ** kwds )
10741070 return _generic_new (collections .Counter , cls , * args , ** kwds )
10751071
1076-
10771072elif _geqv_defined :
10781073
10791074 class Counter (
@@ -1090,7 +1085,6 @@ def __new__(cls, *args, **kwds):
10901085 return collections .Counter (* args , ** kwds )
10911086 return _generic_new (collections .Counter , cls , * args , ** kwds )
10921087
1093-
10941088else :
10951089
10961090 class Counter (
@@ -1353,9 +1347,7 @@ def __new__(
13531347 bases = tuple (b for b in bases if b is not Generic )
13541348 namespace .update ({'__origin__' : origin , '__extra__' : extra })
13551349 self = super (GenericMeta , cls ).__new__ (cls , name , bases , namespace , _root = True )
1356- super (GenericMeta , self ).__setattr__ (
1357- '_gorg' , self if not origin else _gorg (origin )
1358- )
1350+ super (GenericMeta , self ).__setattr__ ('_gorg' , self if not origin else _gorg (origin ))
13591351 self .__parameters__ = tvars
13601352 self .__args__ = (
13611353 tuple (
@@ -1479,9 +1471,7 @@ def __getitem__(self, params):
14791471 if not isinstance (params , tuple ):
14801472 params = (params ,)
14811473 if not params and _gorg (self ) is not Tuple :
1482- raise TypeError (
1483- "Parameter list to %s[...] cannot be empty" % self .__qualname__
1484- )
1474+ raise TypeError ("Parameter list to %s[...] cannot be empty" % self .__qualname__ )
14851475 msg = "Parameters to generic types must be types."
14861476 params = tuple (_type_check (p , msg ) for p in params )
14871477 if self in (Generic , Protocol ):
@@ -2108,7 +2098,6 @@ def get_type_hints(obj, globalns=None, localns=None, include_extras=False):
21082098 return hint
21092099 return {k : _strip_annotations (t ) for k , t in hint .items ()}
21102100
2111-
21122101elif HAVE_ANNOTATED :
21132102
21142103 def _is_dunder (name ):
@@ -2344,7 +2333,6 @@ def TypeAlias(self, parameters):
23442333 """
23452334 raise TypeError ("{} is not subscriptable" .format (self ))
23462335
2347-
23482336elif sys .version_info [:2 ] >= (3 , 7 ):
23492337
23502338 class _TypeAliasForm (typing ._SpecialForm , _root = True ):
@@ -2672,7 +2660,6 @@ def Concatenate(self, parameters):
26722660 """
26732661 return _concatenate_getitem (self , parameters )
26742662
2675-
26762663elif sys .version_info [:2 ] >= (3 , 7 ):
26772664
26782665 class _ConcatenateForm (typing ._SpecialForm , _root = True ):
@@ -2821,7 +2808,6 @@ def is_str(val: Union[str, float]):
28212808 item = typing ._type_check (parameters , '{} accepts only single type.' .format (self ))
28222809 return _GenericAlias (self , (item ,))
28232810
2824-
28252811elif sys .version_info [:2 ] >= (3 , 7 ):
28262812
28272813 class _TypeGuardForm (typing ._SpecialForm , _root = True ):
0 commit comments