File: support.py

package info (click to toggle)
pythran 0.17.0%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 12,700 kB
  • sloc: cpp: 65,021; python: 41,083; sh: 137; makefile: 87
file content (45 lines) | stat: -rwxr-xr-x 1,151 bytes parent folder | download | duplicates (3)
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)