diff options
| author | dherrada <dylan.herrada@adafruit.com> | 2020-07-02 10:25:20 -0400 |
|---|---|---|
| committer | dherrada <dylan.herrada@adafruit.com> | 2020-07-02 10:25:20 -0400 |
| commit | d1664bdde2764e1a72a792dcfb23d4b650085e97 (patch) | |
| tree | 44a3fa5256e1f35bb40e24bd7f656b659cf8cc51 /tools | |
| parent | 596f2f6e7dd24ffe681ea01a8211fe8d69d55ff6 (diff) | |
Fixed extract_pyi script to allow NoneType
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/extract_pyi.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/tools/extract_pyi.py b/tools/extract_pyi.py index d749d202b..131cef15f 100644 --- a/tools/extract_pyi.py +++ b/tools/extract_pyi.py @@ -1,3 +1,7 @@ +# Run with 'python tools/extract_pyi.py shared-bindings/ path/to/stub/dir +# You can also test a specific library in shared-bindings by putting the path +# to that directory instead + import os import sys import astroid @@ -58,8 +62,10 @@ def convert_folder(top_level, stub_directory): print(i.__dict__['name']) for j in i.body: if isinstance(j, astroid.scoped_nodes.FunctionDef): - if None in j.args.__dict__['annotations']: - print(f"Missing parameter type: {j.__dict__['name']} on line {j.__dict__['lineno']}\n") + for i in j.args.__dict__['annotations']: + if type(i) == astroid.node_classes.Name: + if i.name == 'Any': + print(f"Missing parameter type: {j.__dict__['name']} on line {j.__dict__['lineno']}\n") if j.returns: if 'Any' in j.returns.__dict__.values(): print(f"Missing return type: {j.__dict__['name']} on line {j.__dict__['lineno']}") |
