Menu

[r7974]: / branches / mathtex / doc / utils / pylab_names.py  Maximize  Restore  History

Download this file

61 lines (51 with data), 1.6 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
"""
autogenerate some tables for pylab namespace
"""
from pylab import *
d = locals()
keys = d.keys()
keys.sort()
modd = dict()
for k in keys:
o = d[k]
if not callable(o):
continue
doc = getattr(o, '__doc__', None)
if doc is not None:
doc = ' - '.join([line for line in doc.split('\n') if line.strip()][:2])
mod = getattr(o, '__module__', None)
if mod is None:
mod = 'unknown'
if mod is not None:
if mod.startswith('matplotlib'):
if k[0].isupper():
k = ':class:`~%s.%s`'%(mod, k)
else:
k = ':func:`~%s.%s`'%(mod, k)
mod = ':mod:`%s`'%mod
elif mod.startswith('numpy'):
#k = '`%s <%s>`_'%(k, 'http://scipy.org/Numpy_Example_List_With_Doc#%s'%k)
k = '`%s <%s>`_'%(k, 'http://sd-2116.dedibox.fr/pydocweb/doc/%s.%s'%(mod, k))
if doc is None: doc = 'TODO'
mod, k, doc = mod.strip(), k.strip(), doc.strip()[:80]
modd.setdefault(mod, []).append((k, doc))
mods = modd.keys()
mods.sort()
for mod in mods:
border = '*'*len(mod)
print mod
print border
print
funcs, docs = zip(*modd[mod])
maxfunc = max([len(f) for f in funcs])
maxdoc = max(40, max([len(d) for d in docs]) )
border = ' '.join(['='*maxfunc, '='*maxdoc])
print border
print ' '.join(['symbol'.ljust(maxfunc), 'description'.ljust(maxdoc)])
print border
for func, doc in modd[mod]:
row = ' '.join([func.ljust(maxfunc), doc.ljust(maxfunc)])
print row
print border
print
#break
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.