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