File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 5353 # Validate that the module is a parseable stub.
5454 total += 1
5555 try :
56- astroid .parse (stub_contents )
56+ tree = astroid .parse (stub_contents )
57+ for i in tree .body :
58+ print (i .__dict__ ['name' ])
59+ for j in i .body :
60+ if isinstance (j , astroid .scoped_nodes .FunctionDef ):
61+ a = ''
62+ if None in j .args .__dict__ ['annotations' ]:
63+ a += f"Missing parameter type: { j .__dict__ ['name' ]} on line { j .__dict__ ['lineno' ]} \n "
64+ if j .returns :
65+ if 'Any' in j .returns .__dict__ .values ():
66+ a += f"Missing return type: { j .__dict__ ['name' ]} on line { j .__dict__ ['lineno' ]} "
67+ if a :
68+ raise TypeError (a )
69+ elif isinstance (j , astroid .node_classes .AnnAssign ):
70+ if 'Any' == j .__dict__ ['annotation' ].__dict__ ['name' ]:
71+ raise TypeError (f"missing attribute type on line { j .__dict__ ['lineno' ]} " )
72+
5773 ok += 1
5874 except astroid .exceptions .AstroidSyntaxError as e :
5975 e = e .__cause__
6076 traceback .print_exception (type (e ), e , e .__traceback__ )
61- print ()
77+ except TypeError as err :
78+ print (err )
6279
6380print (f"{ ok } ok out of { total } " )
6481
You can’t perform that action at this time.
0 commit comments