From 1e96ca582ee1d5e728dd6cd8b744a40ea1c98fe5 Mon Sep 17 00:00:00 2001 From: dherrada Date: Thu, 2 Jul 2020 11:10:43 -0400 Subject: [PATCH] Made more modifications to extract_pyi.py --- tools/extract_pyi.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tools/extract_pyi.py b/tools/extract_pyi.py index 131cef15f2..9d22af93af 100644 --- a/tools/extract_pyi.py +++ b/tools/extract_pyi.py @@ -62,10 +62,14 @@ def convert_folder(top_level, stub_directory): print(i.__dict__['name']) for j in i.body: if isinstance(j, astroid.scoped_nodes.FunctionDef): - for i in j.args.__dict__['annotations']: - if type(i) == astroid.node_classes.Name: - if i.name == 'Any': + for k, l in zip(j.args.__dict__['annotations'], j.args.__dict__['args']): + # K is type, l is name + if l.name != 'self': + if not k: print(f"Missing parameter type: {j.__dict__['name']} on line {j.__dict__['lineno']}\n") + elif str(type(k)) == "": + if k.name == 'Any': + print(f"'Any' 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']}")