ia64/xen-unstable

changeset 7000:ba10ee566ab7

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@xensource.com>
author emellor@ewan
date Wed Sep 21 11:26:31 2005 +0100 (2005-09-21)
parents 1196da5782bf
children 79f695037ab7
files tools/python/xen/xend/PrettyPrint.py
line diff
     1.1 --- a/tools/python/xen/xend/PrettyPrint.py	Wed Sep 21 11:24:26 2005 +0100
     1.2 +++ b/tools/python/xen/xend/PrettyPrint.py	Wed Sep 21 11:26:31 2005 +0100
     1.3 @@ -13,6 +13,7 @@
     1.4  # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
     1.5  #============================================================================
     1.6  # Copyright (C) 2004, 2005 Mike Wray <mike.wray@hp.com>
     1.7 +# Copyright (C) 2005 XenSource Ltd
     1.8  #============================================================================
     1.9  
    1.10  """General pretty-printer, including support for SXP.
    1.11 @@ -34,11 +35,11 @@ class PrettyItem:
    1.12      def get_width(self):
    1.13          return self.width
    1.14  
    1.15 -    def output(self, out):
    1.16 +    def output(self, _):
    1.17          print '***PrettyItem>output>', self
    1.18          pass
    1.19  
    1.20 -    def prettyprint(self, out, width):
    1.21 +    def prettyprint(self, _, width):
    1.22          print '***PrettyItem>prettyprint>', self
    1.23          return width
    1.24  
    1.25 @@ -51,7 +52,7 @@ class PrettyString(PrettyItem):
    1.26      def output(self, out):
    1.27          out.write(self.value)
    1.28  
    1.29 -    def prettyprint(self, line):
    1.30 +    def prettyprint(self, line, _):
    1.31          line.output(self)
    1.32  
    1.33      def show(self, out):
    1.34 @@ -62,7 +63,7 @@ class PrettySpace(PrettyItem):
    1.35      def output(self, out):
    1.36          out.write(' ' * self.width)
    1.37  
    1.38 -    def prettyprint(self, line):
    1.39 +    def prettyprint(self, line, _):
    1.40          line.output(self)
    1.41  
    1.42      def show(self, out):
    1.43 @@ -79,7 +80,7 @@ class PrettyBreak(PrettyItem):
    1.44      def output(self, out):
    1.45          out.write(' ' * self.width)
    1.46  
    1.47 -    def prettyprint(self, line):
    1.48 +    def prettyprint(self, line, _):
    1.49          if line.breaks(self.space):
    1.50              self.active = 1
    1.51              line.newline(self.indent)
    1.52 @@ -88,26 +89,20 @@ class PrettyBreak(PrettyItem):
    1.53  
    1.54      def show(self, out):
    1.55          print >> out, ("(break (width %d) (indent %d) (space %d) (active %d))"
    1.56 -                       % (self.width, self.indent, self.space, self.lspace, self.active))
    1.57 +                       % (self.width, self.indent, self.space, self.active))
    1.58  
    1.59  class PrettyNewline(PrettySpace):
    1.60  
    1.61 -    def __init__(self, indent):
    1.62 -        PrettySpace.__init__(self, indent)
    1.63 -
    1.64      def insert(self, block):
    1.65          block.newline()
    1.66          block.addtoline(self)
    1.67  
    1.68 -    def output(self, out):
    1.69 -        out.write(' ' * self.width)
    1.70 -
    1.71 -    def prettyprint(self, line):
    1.72 +    def prettyprint(self, line, _):
    1.73          line.newline(0)
    1.74          line.output(self)
    1.75  
    1.76      def show(self, out):
    1.77 -        print >> out, ("(nl (indent %d))" % self.indent)
    1.78 +        print >> out, ("(nl (width %d))" % self.width)
    1.79  
    1.80  class PrettyLine(PrettyItem):
    1.81      def __init__(self):
    1.82 @@ -132,7 +127,7 @@ class PrettyLine(PrettyItem):
    1.83              lastbreak.space = (width - lastwidth)
    1.84          self.width = width
    1.85   
    1.86 -    def prettyprint(self, line):
    1.87 +    def prettyprint(self, line, _):
    1.88          for x in self.content:
    1.89              x.prettyprint(line)
    1.90  
    1.91 @@ -145,7 +140,8 @@ class PrettyLine(PrettyItem):
    1.92  class PrettyBlock(PrettyItem):
    1.93  
    1.94      def __init__(self, all=0, parent=None):
    1.95 -        self.width = 0
    1.96 +        PrettyItem.__init__(self, 0)
    1.97 +
    1.98          self.lines = []
    1.99          self.parent = parent
   1.100          self.indent = 0
   1.101 @@ -163,7 +159,7 @@ class PrettyBlock(PrettyItem):
   1.102              if self.width < l.width:
   1.103                  self.width = l.width
   1.104  
   1.105 -    def breaks(self, n):
   1.106 +    def breaks(self, _):
   1.107          return self.all and self.broken
   1.108  
   1.109      def newline(self):
   1.110 @@ -172,7 +168,7 @@ class PrettyBlock(PrettyItem):
   1.111      def addtoline(self, x):
   1.112          self.lines[-1].write(x)
   1.113  
   1.114 -    def prettyprint(self, line):
   1.115 +    def prettyprint(self, line, _):
   1.116          self.indent = line.used
   1.117          line.block = self
   1.118          if not line.fits(self.width):
   1.119 @@ -191,6 +187,7 @@ class PrettyBlock(PrettyItem):
   1.120  class Line:
   1.121  
   1.122      def __init__(self, out, width):
   1.123 +        self.block = None
   1.124          self.out = out
   1.125          self.width = width
   1.126          self.used = 0
   1.127 @@ -255,8 +252,7 @@ class PrettyPrinter:
   1.128          self.block = self.block.parent
   1.129  
   1.130      def prettyprint(self, out=sys.stdout):
   1.131 -        line = Line(out, self.width)
   1.132 -        self.top.prettyprint(line)
   1.133 +        self.top.prettyprint(Line(out, self.width))
   1.134  
   1.135  class SXPPrettyPrinter(PrettyPrinter):
   1.136      """An SXP prettyprinter.