MCPcopy Index your code
hub / github.com/dabeaz-course/python-mastery / create_formatter

Function create_formatter

Solutions/8_6/tableformat.py:60–78  ·  view source on GitHub ↗
(name, column_formats=None, upper_headers=False)

Source from the content-addressed store, hash-verified

58 super().headings([h.upper() for h in headers])
59
60def create_formatter(name, column_formats=None, upper_headers=False):
61 if name == 'text':
62 formatter_cls = TextTableFormatter
63 elif name == 'csv':
64 formatter_cls = CSVTableFormatter
65 elif name == 'html':
66 formatter_cls = HTMLTableFormatter
67 else:
68 raise RuntimeError('Unknown format %s' % name)
69
70 if column_formats:
71 class formatter_cls(ColumnFormatMixin, formatter_cls):
72 formats = column_formats
73
74 if upper_headers:
75 class formatter_cls(UpperHeadersMixin, formatter_cls):
76 pass
77
78 return formatter_cls()
79
80
81

Callers 1

tickerFunction · 0.90

Calls 1

formatter_clsClass · 0.70

Tested by

no test coverage detected