Skip to content

Commit fa40616

Browse files
committed
extract_README.py clarified
no-op
1 parent 4825dcf commit fa40616

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

extract_README.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,15 @@
3131

3232

3333
def dirmod():
34-
r'''Same as dir(mod), but returns only functions, in the definition order'''
34+
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+
'''
3540
with open('{}.py'.format(modname), 'r') as f:
3641
for l in f:
37-
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)
3843
if m:
3944
yield m.group(1)
4045

@@ -158,9 +163,6 @@ def write(s, verbatim):
158163
write('* GLOBAL FUNCTIONS\n', verbatim=True)
159164

160165
for func in dirmod():
161-
if re.match('_', func):
162-
continue
163-
164166
if not inspect.isfunction(mod.__dict__[func]):
165167
continue
166168

0 commit comments

Comments
 (0)