8000 ENH: Add the ability to blacklist functions we don't want stubs for · numpy/numpy-stubs@745dc65 · GitHub
[go: up one dir, main page]

10000 Skip to content
This repository was archived by the owner on Jun 10, 2020. It is now read-only.

Commit 745dc65

Browse files
committed
ENH: Add the ability to blacklist functions we don't want stubs for
Various things have accidentally made it into public namespaces, and we don't want to include stubs for those (since the stubs should promote best practices).
1 parent b0c0fd8 commit 745dc65

File tree

1 file changed

+37
-1
lines changed

1 file changed

+37
-1
lines changed

runtests.py

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,40 @@
1010

1111
STUBS_ROOT = os.path.dirname(os.path.abspath(__file__))
1212

13+
# Technically "public" functions (they don't start with an underscore)
14+
# that we don't want to include.
15+
BLACKLIST = {
16+
'numpy': {
17+
# Stdlib modules in the namespace by accident
18+
'absolute_import',
19+
'warnings',
20+
# Accidentally public
21+
'add_docstring',
22+
'add_newdoc',
23+
'add_newdoc_ufunc',
24+
# Builtins
25+
'bool',
26+
'complex',
27+
'float',
28+
'int',
29+
'long',
30+
'object',
31+
'str',
32+
'unicode',
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+
},
45+
}
46+
1347

1448
class FindAttributes(ast.NodeVisitor):
1549
"""Find top-level attributes/functions/classes in the stubs.
@@ -66,7 +100,9 @@ def find_missing(module_name):
66100
# No stubs for this module yet.
67101
stubs_attributes = set()
68102

69-
missing = module_attributes - stubs_attributes
103+
blacklist = BLACKLIST.get(module_name, set())
104+
105+
missing = module_attributes - stubs_attributes - blacklist
70106
print('\n'.join(sorted(missing)))
71107

72108

0 commit comments

Comments
 (0)
0