13
13
# Technically "public" functions (they don't start with an underscore)
14
14
# that we don't want to include.
15
15
BLACKLIST = {
16
- ' numpy' : {
16
+ " numpy" : {
17
17
# Stdlib modules in the namespace by accident
18
- ' absolute_import' ,
19
- ' warnings' ,
18
+ " absolute_import" ,
19
+ " warnings" ,
20
20
# Accidentally public
21
- ' add_docstring' ,
22
- ' add_newdoc' ,
23
- ' add_newdoc_ufunc' ,
21
+ " add_docstring" ,
22
+ " add_newdoc" ,
23
+ " add_newdoc_ufunc" ,
24
24
# Builtins
25
- ' bool' ,
26
- ' complex' ,
27
- ' float' ,
28
- ' int' ,
29
- ' long' ,
30
- ' object' ,
31
- ' str' ,
32
- ' unicode' ,
25
+ " bool" ,
26
+ " complex" ,
27
+ " float" ,
28
+ " int" ,
29
+ " long" ,
30
+ " object" ,
31
+ " str" ,
32
+ " unicode" ,
33
33
# Should use numpy_financial instead
34
- 'fv' ,
35
- ' ipmt' ,
36
- ' irr' ,
37
- ' mirr' ,
38
- ' nper' ,
39
- ' npv' ,
40
- ' pmt' ,
41
- ' ppmt' ,
42
- 'pv' ,
43
- ' rate' ,
44
- },
34
+ "fv" ,
35
+ " ipmt" ,
36
+ " irr" ,
37
+ " mirr" ,
38
+ " nper" ,
39
+ " npv" ,
40
+ " pmt" ,
41
+ " ppmt" ,
42
+ "pv" ,
43
+ " rate" ,
44
+ }
45
45
}
46
46
47
47
@@ -60,7 +60,7 @@ def __init__(self):
60
60
self .attributes = set ()
61
61
62
62
def visit_FunctionDef (self , node ):
63
- if node .name == ' __getattr__' :
63
+ if node .name == " __getattr__" :
64
64
# Not really a module member.
65
65
return
66
66
self .attributes .add (node .name )
@@ -69,7 +69,7 @@ def visit_FunctionDef(self, node):
69
69
return
70
70
71
71
def visit_ClassDef (self , node ):
72
- if not node .name .startswith ('_' ):
72
+ if not node .name .startswith ("_" ):
73
73
self .attributes .add (node .name )
74
74
return
75
75
@@ -80,14 +80,13 @@ def visit_AnnAssign(self, node):
80
80
def find_missing (module_name ):
81
81
module_path = os .path .join (
82
82
STUBS_ROOT ,
83
- module_name .replace (' numpy' , ' numpy-stubs' ).replace ('.' , os .sep ),
84
- ' __init__.pyi' ,
83
+ module_name .replace (" numpy" , " numpy-stubs" ).replace ("." , os .sep ),
84
+ " __init__.pyi" ,
85
85
)
86
86
87
87
module = importlib .import_module (module_name )
88
88
module_attributes = {
89
- attribute for attribute in dir (module )
90
- if not attribute .startswith ('_' )
89
+ attribute for attribute in dir (module ) if not attribute .startswith ("_" )
91
90
}
92
91
93
92
if os .path .isfile (module_path ):
@@ -103,7 +102,7 @@ def find_missing(module_name):
103
102
blacklist = BLACKLIST .get (module_name , set ())
104
103
105
104
missing = module_attributes - stubs_attributes - blacklist
106
- print (' \n ' .join (sorted (missing )))
105
+ print (" \n " .join (sorted (missing )))
107
106
108
107
109
108
def run_pytest (argv ):
@@ -117,7 +116,7 @@ def run_pytest(argv):
117
116
118
117
def main ():
119
118
parser = argparse .ArgumentParser ()
120
- parser .add_argument (' --find-missing' )
119
+ parser .add_argument (" --find-missing" )
121
120
args , remaining_argv = parser .parse_known_args ()
122
121
123
122
if args .find_missing is not None :
0 commit comments