| 58 | super().headings([h.upper() for h in headers]) |
| 59 | |
| 60 | def 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 | |