diff options
| author | Scott Shawcroft <scott@tannewt.org> | 2020-05-27 10:47:08 -0700 |
|---|---|---|
| committer | Scott Shawcroft <scott@tannewt.org> | 2020-05-27 10:47:08 -0700 |
| commit | 9380c34cf744fb7d3a0a3116a4779f4e897c2ee1 (patch) | |
| tree | c88b5e6fc651fa1855a90fb158eb33b247904de0 /tools | |
| parent | aa0445228ba79ac042e2802ae9f1a5e71b9a3ed6 (diff) | |
| parent | 0db8b888d3e1928ae2a81f0ec9d3834a69989ed4 (diff) | |
Merge remote-tracking branch 'adafruit/master' into wdt-nrf
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/extract_pyi.py | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/tools/extract_pyi.py b/tools/extract_pyi.py index e590e25f1..d749d202b 100644 --- a/tools/extract_pyi.py +++ b/tools/extract_pyi.py @@ -52,7 +52,22 @@ def convert_folder(top_level, stub_directory): # Validate that the module is a parseable stub. total += 1 try: - astroid.parse(stub_contents) + tree = astroid.parse(stub_contents) + for i in tree.body: + if 'name' in i.__dict__: + 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") + if j.returns: + if 'Any' in j.returns.__dict__.values(): + print(f"Missing return type: {j.__dict__['name']} on line {j.__dict__['lineno']}") + elif isinstance(j, astroid.node_classes.AnnAssign): + if 'name' in j.__dict__['annotation'].__dict__: + if j.__dict__['annotation'].__dict__['name'] == 'Any': + print(f"missing attribute type on line {j.__dict__['lineno']}") + ok += 1 except astroid.exceptions.AstroidSyntaxError as e: e = e.__cause__ |
