Commits

Alex Gaynor committed 181f993

kill trailing whitespace and a few unused vars

Comments (0)

Files changed (3)

pypy/config/makerestdoc.py

 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
             content.add(ListItem(Strong("default:"), str(self.default)))
 
         requirements = []
-        
+
         for val in self.values:
             if val not in self._requires:
                 continue
         content.join(
             ListItem(Strong("name:"), self._name),
             ListItem(Strong("description:"), self.doc))
-        stack = []
-        curr = content
-        config = Config(self)
         return content
 
 
     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:
         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. """

pypy/tool/rest/rst.py

             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}
     allow_nesting = False
     allowed_child = {}
     defaults = {}
-    
+
     _reg_whitespace = py.std.re.compile('\s+')
 
     def __init__(self, *args, **kwargs):
             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"
                                '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()
         self.char = char
         self.width = width
         super(Transition, self).__init__(*args, **kwargs)
-        
+
     def text(self):
         return (self.width - 1) * self.char
 
     sep = " "
     indent = ""
     width = 80
-    
+
     def __init__(self, *args, **kwargs):
         # make shortcut
         args = list(args)
             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]
                 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 = []
     end = ""
     def __init__(self, _text):
         self._text = _text
-    
+
     def text(self):
         text = self.escape(self._text)
         return self.start + text + self.end
         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)
 class ListItem(Paragraph):
     allow_nesting = True
     item_chars = '*+-'
-    
+
     def text(self):
         idepth = self.get_indent_depth()
         indent = self.indent + (idepth + 1) * '  '
         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 = []
         self._text = _text
         self.target = target
         self.rest = None
-    
+
     def text(self):
         if self.rest is None:
             self.rest = self.find_rest()
 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)
 
         self.content = args
         super(Directive, self).__init__()
         self.options = options
-        
+
     def text(self):
         # XXX not very pretty...
         txt = '.. %s::' % (self.name,)
             txt += '\n'
             for item in self.content:
                 txt += '\n    ' + item
-        
+
         return txt
 

rpython/config/config.py

         self._name = name
         self.doc = doc
         self.cmdline = cmdline
-        
+
     def validate(self, value):
         raise NotImplementedError('abstract base class')
 
 
 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
 
     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:
                     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 = ", "
                 defl = ""
             return option.help.replace("%default", defl)
         elif choices:
-            return option.help + ' [%s]' % choices 
+            return option.help + ' [%s]' % choices
 
         return option.help