Skip to content

Commit d1664bd

Browse files
committed
Fixed extract_pyi script to allow NoneType
1 parent 596f2f6 commit d1664bd

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

tools/extract_pyi.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# Run with 'python tools/extract_pyi.py shared-bindings/ path/to/stub/dir
2+
# You can also test a specific library in shared-bindings by putting the path
3+
# to that directory instead
4+
15
import os
26
import sys
37
import astroid
@@ -58,8 +62,10 @@ def convert_folder(top_level, stub_directory):
5862
print(i.__dict__['name'])
5963
for j in i.body:
6064
if isinstance(j, astroid.scoped_nodes.FunctionDef):
61-
if None in j.args.__dict__['annotations']:
62-
print(f"Missing parameter type: {j.__dict__['name']} on line {j.__dict__['lineno']}\n")
65+
for i in j.args.__dict__['annotations']:
66+
if type(i) == astroid.node_classes.Name:
67+
if i.name == 'Any':
68+
print(f"Missing parameter type: {j.__dict__['name']} on line {j.__dict__['lineno']}\n")
6369
if j.returns:
6470
if 'Any' in j.returns.__dict__.values():
6571
print(f"Missing return type: {j.__dict__['name']} on line {j.__dict__['lineno']}")

0 commit comments

Comments
 (0)