Author: Alex Gaynor <[email protected]>
Branch: 
Changeset: r67641:181f9933574a
Date: 2013-10-26 20:20 -0700
http://bitbucket.org/pypy/pypy/changeset/181f9933574a/

Log:    kill trailing whitespace and a few unused vars

diff --git a/pypy/config/makerestdoc.py b/pypy/config/makerestdoc.py
--- a/pypy/config/makerestdoc.py
+++ b/pypy/config/makerestdoc.py
@@ -1,6 +1,6 @@
 import py
 from pypy.tool.rest.rst import Rest, Paragraph, Strong, ListItem, Title, Link
-from pypy.tool.rest.rst import Directive, Em, Quote, Text
+from pypy.tool.rest.rst import Directive, Text
 
 from rpython.config.config import ChoiceOption, BoolOption, StrOption, 
IntOption
 from rpython.config.config import FloatOption, OptionDescription, Option, 
Config
@@ -45,7 +45,7 @@
             content.add(ListItem(Strong("default:"), str(self.default)))
 
         requirements = []
-        
+
         for val in self.values:
             if val not in self._requires:
                 continue
@@ -138,9 +138,6 @@
         content.join(
             ListItem(Strong("name:"), self._name),
             ListItem(Strong("description:"), self.doc))
-        stack = []
-        curr = content
-        config = Config(self)
         return content
 
 
@@ -166,7 +163,6 @@
     for path in config.getpaths(include_groups=False):
         subconf, step = config._cfgimpl_get_home_by_path(path)
         fullpath = (descr._name + "." + path)
-        prefix = fullpath.rsplit(".", 1)[0]
         subdescr = getattr(subconf._cfgimpl_descr, step)
         cmdline = get_cmdline(subdescr.cmdline, fullpath)
         if cmdline is not None:
@@ -183,7 +179,7 @@
         curr.add(ListItem(Link(cmdline + ":", fullpath + ".html"),
                           Text(subdescr.doc)))
     return content
-    
+
 
 def register_config_role(docdir):
     """ register a :config: ReST link role for use in documentation. """
diff --git a/pypy/tool/rest/rst.py b/pypy/tool/rest/rst.py
--- a/pypy/tool/rest/rst.py
+++ b/pypy/tool/rest/rst.py
@@ -38,7 +38,7 @@
             class_list = parent_cls
         if obj.allow_nesting:
             class_list.append(obj)
-        
+
         for _class in class_list:
             if not _class.allowed_child:
                 _class.allowed_child = {obj:True}
@@ -56,7 +56,7 @@
     allow_nesting = False
     allowed_child = {}
     defaults = {}
-    
+
     _reg_whitespace = py.std.re.compile('\s+')
 
     def __init__(self, *args, **kwargs):
@@ -66,53 +66,53 @@
             self._add(child)
         for arg in kwargs:
             setattr(self, arg, kwargs[arg])
-    
+
     def join(self, *children):
         """ add child nodes
-        
+
             returns a reference to self
         """
         for child in children:
             self._add(child)
         return self
-    
+
     def add(self, child):
         """ adds a child node
-            
+
             returns a reference to the child
         """
         self._add(child)
         return child
-        
+
     def _add(self, child):
         if child.__class__ not in self.allowed_child:
             raise RestError("%r cannot be child of %r" % \
                 (child.__class__, self.__class__))
         self.children.append(child)
         child.parent = self
-    
+
     def __getitem__(self, item):
         return self.children[item]
-    
+
     def __setitem__(self, item, value):
         self.children[item] = value
 
     def text(self):
         """ return a ReST string representation of the node """
         return self.sep.join([child.text() for child in self.children])
-    
+
     def wordlist(self):
-        """ return a list of ReST strings for this node and its children """ 
+        """ return a list of ReST strings for this node and its children """
         return [self.text()]
 
 class Rest(AbstractNode):
     """ Root node of a document """
-    
+
     sep = "\n\n"
     def __init__(self, *args, **kwargs):
         AbstractNode.__init__(self, *args, **kwargs)
         self.links = {}
-    
+
     def render_links(self, check=False):
         """render the link attachments of the document"""
         assert not check, "Link checking not implemented"
@@ -132,7 +132,7 @@
                                'transition')
         for child in self.children:
             outcome.append(child.text())
-        
+
         # always a trailing newline
         text = self.sep.join([i for i in outcome if i]) + "\n"
         return text + self.render_links()
@@ -145,7 +145,7 @@
         self.char = char
         self.width = width
         super(Transition, self).__init__(*args, **kwargs)
-        
+
     def text(self):
         return (self.width - 1) * self.char
 
@@ -156,7 +156,7 @@
     sep = " "
     indent = ""
     width = 80
-    
+
     def __init__(self, *args, **kwargs):
         # make shortcut
         args = list(args)
@@ -164,19 +164,19 @@
             if isinstance(arg, str):
                 args[num] = Text(arg)
         super(Paragraph, self).__init__(*args, **kwargs)
-    
+
     def text(self):
         texts = []
         for child in self.children:
             texts += child.wordlist()
-        
+
         buf = []
         outcome = []
         lgt = len(self.indent)
-        
+
         def grab(buf):
             outcome.append(self.indent + self.sep.join(buf))
-        
+
         texts.reverse()
         while texts:
             next = texts[-1]
@@ -193,19 +193,19 @@
                 buf = []
         grab(buf)
         return "\n".join(outcome)
-    
+
 class SubParagraph(Paragraph):
     """ indented sub paragraph """
 
     indent = " "
-    
+
 class Title(Paragraph):
     """ title element """
 
     parentclass = Rest
     belowchar = "="
     abovechar = ""
-    
+
     def text(self):
         txt = self._get_text()
         lines = []
@@ -228,7 +228,7 @@
     end = ""
     def __init__(self, _text):
         self._text = _text
-    
+
     def text(self):
         text = self.escape(self._text)
         return self.start + text + self.end
@@ -241,7 +241,7 @@
         if self.end and self.end != self.start:
             text = text.replace(self.end, '\\%s' % (self.end,))
         return text
-    
+
 class Text(AbstractText):
     def wordlist(self):
         text = escape(self._text)
@@ -287,7 +287,7 @@
 class ListItem(Paragraph):
     allow_nesting = True
     item_chars = '*+-'
-    
+
     def text(self):
         idepth = self.get_indent_depth()
         indent = self.indent + (idepth + 1) * '  '
@@ -296,7 +296,7 @@
         item_char = self.item_chars[idepth]
         ret += [indent[len(item_char)+1:], item_char, ' ', txt[len(indent):]]
         return ''.join(ret)
-    
+
     def render_children(self, indent):
         txt = []
         buffer = []
@@ -352,7 +352,7 @@
         self._text = _text
         self.target = target
         self.rest = None
-    
+
     def text(self):
         if self.rest is None:
             self.rest = self.find_rest()
@@ -372,12 +372,12 @@
 class InternalLink(AbstractText):
     start = '`'
     end = '`_'
-    
+
 class LinkTarget(Paragraph):
     def __init__(self, name, target):
         self.name = name
         self.target = target
-    
+
     def text(self):
         return ".. _`%s`:%s\n" % (self.name, self.target)
 
@@ -392,7 +392,7 @@
         self.content = args
         super(Directive, self).__init__()
         self.options = options
-        
+
     def text(self):
         # XXX not very pretty...
         txt = '.. %s::' % (self.name,)
@@ -405,6 +405,6 @@
             txt += '\n'
             for item in self.content:
                 txt += '\n    ' + item
-        
+
         return txt
 
diff --git a/rpython/config/config.py b/rpython/config/config.py
--- a/rpython/config/config.py
+++ b/rpython/config/config.py
@@ -215,7 +215,7 @@
         self._name = name
         self.doc = doc
         self.cmdline = cmdline
-        
+
     def validate(self, value):
         raise NotImplementedError('abstract base class')
 
@@ -388,7 +388,7 @@
 
 class StrOption(Option):
     opt_type = 'string'
-    
+
     def __init__(self, name, doc, default=None, cmdline=DEFAULT_OPTION_NAME):
         super(StrOption, self).__init__(name, doc, cmdline)
         self.default = default
@@ -447,7 +447,7 @@
 
     def getpaths(self, include_groups=False, currpath=None):
         """returns a list of all paths in self, recursively
-        
+
             currpath should not be provided (helps with recursion)
         """
         if currpath is None:
@@ -492,15 +492,15 @@
                     defl = "default"
             else:
                 defl = "default: %s" % val
-                
+
         if option.type == 'choice':
             choices = option.choices
-            
+
         if choices is not None:
             choices = "%s=%s" % (option.metavar, '|'.join(choices))
         else:
             choices = ""
-        
+
         if '%default' in option.help:
             if choices and defl:
                 sep = ", "
@@ -511,7 +511,7 @@
                 defl = ""
             return option.help.replace("%default", defl)
         elif choices:
-            return option.help + ' [%s]' % choices 
+            return option.help + ' [%s]' % choices
 
         return option.help
 
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to