From d1664bdde2764e1a72a792dcfb23d4b650085e97 Mon Sep 17 00:00:00 2001 From: dherrada Date: Thu, 2 Jul 2020 10:25:20 -0400 Subject: [PATCH] Fixed extract_pyi script to allow NoneType --- tools/extract_pyi.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tools/extract_pyi.py b/tools/extract_pyi.py index d749d202b3..131cef15f2 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']}")