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:
		    if 1 or i + 1 < len(r):
			s = s + fill
		so += s + ' '
	    out.append(so)
    return maxlens, out
dataset/ETHPy150Open cloudera/hue/desktop/core/ext-py/guppy-0.1.10/guppy/etc/etc.py/reptable/original