We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 4825dcf commit fa40616Copy full SHA for fa40616
1 file changed
extract_README.py
@@ -31,10 +31,15 @@
31
32
33
def dirmod():
34
- r'''Same as dir(mod), but returns only functions, in the definition order'''
+ r'''Returns all non-internal functions in a module
35
+
36
+ Same as dir(mod), but returns only functions, in the order of definition.
37
+ Anything starting with _ is skipped
38
39
+ '''
40
with open('{}.py'.format(modname), 'r') as f:
41
for l in f:
- m = re.match(r'def +([a-zA-Z0-9_]+)\(', l)
42
+ m = re.match(r'def +([a-zA-Z0-9][a-zA-Z0-9_]*)\(', l)
43
if m:
44
yield m.group(1)
45
@@ -158,9 +163,6 @@ def write(s, verbatim):
158
163
write('* GLOBAL FUNCTIONS\n', verbatim=True)
159
164
160
165
for func in dirmod():
161
- if re.match('_', func):
162
- continue
-
166
if not inspect.isfunction(mod.__dict__[func]):
167
continue
168
0 commit comments