@@ -47,68 +47,6 @@ def format_table(self, l, options={}, help_text=""):
47
47
def format_list (self , l , options = {}, help_text = "" ):
48
48
return l
49
49
50
- class HTMLSCFormatter : # This might be dead, but idk maybe someone still wants it
51
- #requires: d, a two level dictionary where the the first set of
52
- # keys are the headings expected on the side of the table, and
53
- # the second set are the headings expected on the top of the table
54
- def format_table (self , d , options = {}, help_text = "" ):
55
- if isinstance (d , list ):
56
- return self ._format_list_table (d , options ['headings' ], help_text = help_text )
57
- else :
58
- return self ._format_dict_table (d , options ['headings' ], help_text = help_text )
59
-
60
- def format_list (self , l , help_text = "" ):
61
- output = self ._table_start (help_text )
62
- for row in l :
63
- output += self ._table_row ([row ])
64
- output += "</table>"
65
- return output
66
-
67
- def _table_start (self , help_text = "" ):
68
- output = ''
69
- if help_text :
70
- output += '<div class="help-text">%s</div>' % help_text
71
- output += '<table cellpadding=10>'
72
- return output
73
-
74
- def _table_headings (self , headings ):
75
- #column headings
76
- next_row = ""
77
- for h in headings :
78
- next_row = next_row + "<th><div style=\" cursor: pointer;\" >" + str (h ) + "</div></th>"
79
- next_row = next_row + "</tr></thread>"
80
- return next_row
81
-
82
- def _table_row (self , row ):
83
- next_row = ""
84
- for r in row :
85
- #displaying lists is sometimes borked. This makes it not borked
86
- if isinstance (r , list ):
87
- r = [str (i ) for i in r ]
88
- next_row += "<td>" + str (r ) + "</td>"
89
- next_row += "</tr>"
90
- return next_row
91
-
92
- def _format_list_table (self , d , headings , help_text = "" ):
93
- output = self ._table_start (help_text )
94
- output = output + self ._table_headings (headings )
95
- for row in d :
96
- ordered_row = [row [h ] for h in headings ]
97
- output = output + self ._table_row (ordered_row )
98
- output = output + "</table>"
99
- return output
100
-
101
- def _format_dict_table (self , d , headings , help_text = "" ):
102
- headings = ["" ] + headings [:]
103
- output = self ._table_start (help_text )
104
- output = output + self ._table_headings (headings )
105
-
106
- for key , row in sorted (d .iteritems ()):
107
- ordered_row = [row [h ] for h in headings if h ]
108
- output = output + self ._table_row ([key ] + ordered_row )
109
- output += "</table>"
110
- return output
111
-
112
50
# Builds JSON output for an object with attributes help_text, headings, and body.
113
51
class JSONFormatter :
114
52
#requires: d, a two level dictionary where the the first set of
0 commit comments