File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2525import typing
2626
2727try :
28- _MyGenericAlias = typing ._GenericAlias
28+ _MyGenericAlias = typing ._GenericAlias # Python 3.7+
2929except AttributeError : # Python 3.6 and earlier
3030 class _MyGenericAlias : # unused, but must be a class to support isinstance() check.
3131 pass
3232
33+ try :
34+ _MyCollection = typing .Collection # Python 3.6+
35+ except AttributeError : # Python 3.5 and earlier
36+ class _MyCollection :
37+ pass
38+
3339from .misc import safeissubclass
3440
3541__all__ = ["isoftype" ]
@@ -196,7 +202,7 @@ def get_args(tp):
196202 typing .Iterable , # can't non-destructively check element type
197203 typing .Reversible , # can't non-destructively check element type
198204 typing .Container , # can't check element type
199- typing . Collection , # Sized Iterable Container; can't check element type
205+ _MyCollection , # Sized Iterable Container; can't check element type
200206 typing .Hashable ,
201207 typing .Sized ):
202208 if U is T :
You can’t perform that action at this time.
0 commit comments