MCPcopy Index your code
hub / github.com/daviddrysdale/python-phonenumbers / Table

Class Table

python/appspot.py:42–65  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

40
41
42class Table(object):
43 def __init__(self, title):
44 self.title = title
45 self.lines = []
46 self.longest_msg = 0
47
48 def append(self, msg, val=None):
49 if val is None:
50 self.lines.append((msg,))
51 return
52 if len(msg) > self.longest_msg:
53 self.longest_msg = len(msg)
54 self.lines.append((msg, val))
55
56 def render(self):
57 print("")
58 print("## %s" % self.title)
59 for line in self.lines:
60 if len(line) == 1:
61 print(line[0])
62 else:
63 pad = ' ' * (self.longest_msg - len(line[0]))
64 fmt = line[0] + pad + ": %s"
65 print(fmt % line[1])
66
67
68def appspot(number, country, locale):

Callers 1

appspotFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected