from io import StringIO def reptable(tb): if not tb: return 0, [] maxlens = [0]*len(tb[0]) for r in tb: if r == '-': continue for i, e in enumerate(r): maxlens[i] = max(maxlens[i], len(str(e))+1) sumlens = len(maxlens) for s in maxlens: sumlens += s out = [] for r in tb: if r == '-': out.append('-'*min(sumlens, 75)) else: so = '' for i, e in enumerate(r): s = str(e) if s.startswith('!>'): s = s[2:] fillright = 1 elif s.isdigit(): fillright = 1 else: fillright = 0 ml = maxlens[i]-1 fill = ' '*(ml - len(s)) if fillright: s = fill + s else: s = s + fill so += s + ' ' out.append(so) return maxlens, out def ptable(tb, f=None): if f is None: import sys f = sys.stdout _, lines = reptable(tb) for line in lines: line = line.rstrip() print(line, file=f) def strtable(tb): f = StringIO() ptable(tb, f) return f.getvalue() def str2int(s, msg='Hexadecimal literal in the form [-]0x... expected'): # xxx clumsy -- there should be a builtin function for this ! if s.startswith('-'): sign = -1 s = s[1:] else: sign = 1 if not s.startswith('0x'): raise ValueError(msg) s = s[2:] if s.endswith('l') or s.endswith('L'): s = s[:-1] return int(s, 16) * sign
Name | Type | Size | Permission | Actions |
---|---|---|---|---|
__pycache__ | Folder | 0755 |
|
|
Cat.py | File | 3.99 KB | 0644 |
|
Code.py | File | 1.03 KB | 0644 |
|
Descriptor.py | File | 903 B | 0644 |
|
FSA.py | File | 7.2 KB | 0644 |
|
Glue.py | File | 13.68 KB | 0644 |
|
Help.py | File | 6.71 KB | 0644 |
|
IterPermute.py | File | 2.22 KB | 0644 |
|
KanExtension.py | File | 20.71 KB | 0644 |
|
KnuthBendix.py | File | 8.81 KB | 0644 |
|
RE.py | File | 23.59 KB | 0644 |
|
RE_Rect.py | File | 10.39 KB | 0644 |
|
__init__.py | File | 87 B | 0644 |
|
cmd.py | File | 14.72 KB | 0644 |
|
etc.py | File | 1.66 KB | 0644 |
|
textView.py | File | 3.07 KB | 0644 |
|
tkcursors.py | File | 2.13 KB | 0644 |
|
xterm.py | File | 2.31 KB | 0644 |
|