Made more modifications to extract_pyi.py

This commit is contained in:
dherrada 2020-07-02 11:10:43 -04:00
parent d1664bdde2
commit 1e96ca582e

View File

@ -62,10 +62,14 @@ def convert_folder(top_level, stub_directory):
print(i.__dict__['name']) print(i.__dict__['name'])
for j in i.body: for j in i.body:
if isinstance(j, astroid.scoped_nodes.FunctionDef): if isinstance(j, astroid.scoped_nodes.FunctionDef):
for i in j.args.__dict__['annotations']: for k, l in zip(j.args.__dict__['annotations'], j.args.__dict__['args']):
if type(i) == astroid.node_classes.Name: # K is type, l is name
if i.name == 'Any': if l.name != 'self':
if not k:
print(f"Missing parameter type: {j.__dict__['name']} on line {j.__dict__['lineno']}\n") print(f"Missing parameter type: {j.__dict__['name']} on line {j.__dict__['lineno']}\n")
elif str(type(k)) == "<class 'astroid.node_classes.Name'>":
if k.name == 'Any':
print(f"'Any' parameter type: {j.__dict__['name']} on line {j.__dict__['lineno']}\n")
if j.returns: if j.returns:
if 'Any' in j.returns.__dict__.values(): if 'Any' in j.returns.__dict__.values():
print(f"Missing return type: {j.__dict__['name']} on line {j.__dict__['lineno']}") print(f"Missing return type: {j.__dict__['name']} on line {j.__dict__['lineno']}")