# HG changeset patch
# User emellor@ewan
# Node ID ba10ee566ab7551b3a0257ffe0d00e11ae8649b4
# Parent 1196da5782bf4d529042ddc0b0c3ae6dfd1a6578
Lots of minor changes to please pylint, including matching the number of
parameters between functions in the base classes and those that override them
in subclasses. It's hard to see how this code worked at all.
Signed-off-by: Ewan Mellor <ewan@xxxxxxxxxxxxx>
diff -r 1196da5782bf -r ba10ee566ab7 tools/python/xen/xend/PrettyPrint.py
--- a/tools/python/xen/xend/PrettyPrint.py Wed Sep 21 10:24:26 2005
+++ b/tools/python/xen/xend/PrettyPrint.py Wed Sep 21 10:26:31 2005
@@ -13,6 +13,7 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#============================================================================
# Copyright (C) 2004, 2005 Mike Wray <mike.wray@xxxxxx>
+# Copyright (C) 2005 XenSource Ltd
#============================================================================
"""General pretty-printer, including support for SXP.
@@ -34,11 +35,11 @@
def get_width(self):
return self.width
- def output(self, out):
+ def output(self, _):
print '***PrettyItem>output>', self
pass
- def prettyprint(self, out, width):
+ def prettyprint(self, _, width):
print '***PrettyItem>prettyprint>', self
return width
@@ -51,7 +52,7 @@
def output(self, out):
out.write(self.value)
- def prettyprint(self, line):
+ def prettyprint(self, line, _):
line.output(self)
def show(self, out):
@@ -62,7 +63,7 @@
def output(self, out):
out.write(' ' * self.width)
- def prettyprint(self, line):
+ def prettyprint(self, line, _):
line.output(self)
def show(self, out):
@@ -79,7 +80,7 @@
def output(self, out):
out.write(' ' * self.width)
- def prettyprint(self, line):
+ def prettyprint(self, line, _):
if line.breaks(self.space):
self.active = 1
line.newline(self.indent)
@@ -88,26 +89,20 @@
def show(self, out):
print >> out, ("(break (width %d) (indent %d) (space %d) (active %d))"
- % (self.width, self.indent, self.space, self.lspace,
self.active))
+ % (self.width, self.indent, self.space, self.active))
class PrettyNewline(PrettySpace):
-
- def __init__(self, indent):
- PrettySpace.__init__(self, indent)
def insert(self, block):
block.newline()
block.addtoline(self)
- def output(self, out):
- out.write(' ' * self.width)
-
- def prettyprint(self, line):
+ def prettyprint(self, line, _):
line.newline(0)
line.output(self)
def show(self, out):
- print >> out, ("(nl (indent %d))" % self.indent)
+ print >> out, ("(nl (width %d))" % self.width)
class PrettyLine(PrettyItem):
def __init__(self):
@@ -132,7 +127,7 @@
lastbreak.space = (width - lastwidth)
self.width = width
- def prettyprint(self, line):
+ def prettyprint(self, line, _):
for x in self.content:
x.prettyprint(line)
@@ -145,7 +140,8 @@
class PrettyBlock(PrettyItem):
def __init__(self, all=0, parent=None):
- self.width = 0
+ PrettyItem.__init__(self, 0)
+
self.lines = []
self.parent = parent
self.indent = 0
@@ -163,7 +159,7 @@
if self.width < l.width:
self.width = l.width
- def breaks(self, n):
+ def breaks(self, _):
return self.all and self.broken
def newline(self):
@@ -172,7 +168,7 @@
def addtoline(self, x):
self.lines[-1].write(x)
- def prettyprint(self, line):
+ def prettyprint(self, line, _):
self.indent = line.used
line.block = self
if not line.fits(self.width):
@@ -191,6 +187,7 @@
class Line:
def __init__(self, out, width):
+ self.block = None
self.out = out
self.width = width
self.used = 0
@@ -255,8 +252,7 @@
self.block = self.block.parent
def prettyprint(self, out=sys.stdout):
- line = Line(out, self.width)
- self.top.prettyprint(line)
+ self.top.prettyprint(Line(out, self.width))
class SXPPrettyPrinter(PrettyPrinter):
"""An SXP prettyprinter.
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|