-
Notifications
You must be signed in to change notification settings - Fork 193
/
Copy pathsupport.py
executable file
·45 lines (34 loc) · 1.12 KB
/
support.py
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
#!/usr/bin/env python
from pythran import tables
TITLE = "Supported Modules and Functions"
DEPTHS = '=*-+:~#.^"`'
print(DEPTHS[0]*len(TITLE))
print(TITLE)
print(DEPTHS[0]*len(TITLE))
print("")
def format_name(name):
if name.endswith('_') and not name.startswith('_'):
name = name[:-1]
return name
def isiterable(obj):
return hasattr(obj, '__iter__')
def dump_entry(entry_name, entry_value, depth):
if isiterable(entry_value):
print(entry_name)
print(DEPTHS[depth] * len(entry_name))
print("")
sym_entries, sub_entries = [], []
for sym in entry_value:
w = sub_entries if isiterable(entry_value[sym]) else sym_entries
w.append(sym)
for k in sorted(sym_entries):
dump_entry(format_name(k), entry_value[k], depth + 1)
print("")
for k in sorted(sub_entries):
dump_entry(format_name(k), entry_value[k], depth + 1)
print("")
else:
print(entry_name)
for MODULE in sorted(tables.MODULES):
if MODULE != '__dispatch__':
dump_entry(format_name(MODULE), tables.MODULES[MODULE], 1)