diff options
author | Claudiu Popa <pcmanticore@gmail.com> | 2015-10-16 16:22:59 +0300 |
---|---|---|
committer | Claudiu Popa <pcmanticore@gmail.com> | 2015-10-16 16:22:59 +0300 |
commit | 1a63781afd12efc2279dc96c87ea6e0b0331ccc7 (patch) | |
tree | a8bb5b13b938215d2afe3f81d81efbc762847ef6 | |
parent | af9129e7c7c6cec7e88e1458bb7c653389d07538 (diff) | |
download | pylint-1a63781afd12efc2279dc96c87ea6e0b0331ccc7.tar.gz |
Remove BaseComponent and additional attributes and methods
The BaseComponent's arguments weren't actually used and by removing
them, a bunch of other methods were removed as well.
-rw-r--r-- | pylint/reporters/ureports/html_writer.py | 18 | ||||
-rw-r--r-- | pylint/reporters/ureports/nodes.py | 21 | ||||
-rw-r--r-- | pylint/reporters/ureports/text_writer.py | 12 |
3 files changed, 7 insertions, 44 deletions
diff --git a/pylint/reporters/ureports/html_writer.py b/pylint/reporters/ureports/html_writer.py index db90171..c5f74d3 100644 --- a/pylint/reporters/ureports/html_writer.py +++ b/pylint/reporters/ureports/html_writer.py @@ -27,18 +27,6 @@ class HTMLWriter(BaseWriter): super(HTMLWriter, self).__init__() self.snippet = snippet - @staticmethod - def handle_attrs(layout): - """get an attribute string from layout member attributes""" - attrs = u'' - klass = getattr(layout, 'klass', None) - if klass: - attrs += u' class="%s"' % klass - nid = getattr(layout, 'id', None) - if nid: - attrs += u' id="%s"' % nid - return attrs - def begin_format(self): """begin to format a layout""" super(HTMLWriter, self).begin_format() @@ -55,20 +43,20 @@ class HTMLWriter(BaseWriter): def visit_section(self, layout): """display a section as html, using div + h[section level]""" self.section += 1 - self.writeln(u'<div%s>' % self.handle_attrs(layout)) + self.writeln(u'<div>') self.format_children(layout) self.writeln(u'</div>') self.section -= 1 def visit_title(self, layout): """display a title using <hX>""" - self.write(u'<h%s%s>' % (self.section, self.handle_attrs(layout))) + self.write(u'<h%s>' % self.section) self.format_children(layout) self.writeln(u'</h%s>' % self.section) def visit_table(self, layout): """display a table as html""" - self.writeln(u'<table%s>' % self.handle_attrs(layout)) + self.writeln(u'<table>') table_content = self.get_table_content(layout) for i, row in enumerate(table_content): if i == 0 and layout.rheaders: diff --git a/pylint/reporters/ureports/nodes.py b/pylint/reporters/ureports/nodes.py index 1c0dc7d..104ba83 100644 --- a/pylint/reporters/ureports/nodes.py +++ b/pylint/reporters/ureports/nodes.py @@ -64,29 +64,16 @@ class VNode(object): return func(self, *args, **kwargs) -class BaseComponent(VNode): - """base report component - - attributes - * id : the component's optional id - * klass : the component's optional klass - """ - def __init__(self, id=None, klass=None): - super(BaseComponent, self).__init__(id) - self.klass = klass - - -class BaseLayout(BaseComponent): +class BaseLayout(VNode): """base container node attributes - * BaseComponent attributes * children : components in this table (i.e. the table's cells) """ def __init__(self, children=(), **kwargs): super(BaseLayout, self).__init__(**kwargs) for child in children: - if isinstance(child, BaseComponent): + if isinstance(child, VNode): self.append(child) else: self.add_text(child) @@ -110,11 +97,10 @@ class BaseLayout(BaseComponent): # non container nodes ######################################################### -class Text(BaseComponent): +class Text(VNode): """a text portion attributes : - * BaseComponent attributes * data : the text value as an encoded or unicode string """ def __init__(self, data, escaped=True, **kwargs): @@ -130,7 +116,6 @@ class VerbatimText(Text): """a verbatim text, display the raw data attributes : - * BaseComponent attributes * data : the text value as an encoded or unicode string """ diff --git a/pylint/reporters/ureports/text_writer.py b/pylint/reporters/ureports/text_writer.py index 3693ad6..271fe35 100644 --- a/pylint/reporters/ureports/text_writer.py +++ b/pylint/reporters/ureports/text_writer.py @@ -73,10 +73,7 @@ class TextWriter(BaseWriter): for row in table_content: for index, col in enumerate(row): cols_width[index] = max(cols_width[index], len(col)) - if layout.klass == 'field': - self.field_table(layout, table_content, cols_width) - else: - self.default_table(layout, table_content, cols_width) + self.default_table(layout, table_content, cols_width) self.writeln() def default_table(self, layout, table_content, cols_width): @@ -99,13 +96,6 @@ class TextWriter(BaseWriter): else: self.write(table_linesep) - def field_table(self, layout, table_content, cols_width): - """special case for field table""" - assert layout.cols == 2 - format_string = u'%s%%-%ss: %%s' % (os.linesep, cols_width[0]) - for field, value in table_content: - self.write(format_string % (field, value)) - def visit_verbatimtext(self, layout): """display a verbatim layout as text (so difficult ;) """ |