File tree Expand file tree Collapse file tree 1 file changed +8
-8
lines changed Expand file tree Collapse file tree 1 file changed +8
-8
lines changed Original file line number Diff line number Diff line change 22
22
23
23
24
24
def is_iterable_type_annotation (annotation : object , pytype : object ) -> bool :
25
- is_iterable_anno = (
26
- typing_inspect .is_generic_type (annotation )
27
- and issubclass (typing_inspect .get_origin (annotation ),
28
- collections .abc .Iterable )
29
- )
30
-
31
25
if sys .version_info >= (3 , 9 ):
32
- # After python 3.9, standard collection types are supported in type hint
26
+ # Since python 3.9, standard collection types are supported in type hint
33
27
origin = get_origin (annotation )
34
28
is_iterable_anno = (origin is not None
35
29
and issubclass (origin , collections .abc .Iterable ))
36
-
30
+ else :
31
+ is_iterable_anno = (
32
+ typing_inspect .is_generic_type (annotation )
33
+ and issubclass (typing_inspect .get_origin (annotation ),
34
+ collections .abc .Iterable )
35
+ )
36
+
37
37
if not is_iterable_anno :
38
38
return False
39
39
You can’t perform that action at this time.
0 commit comments