Anonymous avatar Anonymous committed 722a6ae

Some pylint nits.

Comments (0)

Files changed (9)

 
 check:
 	@$(PYTHON) utils/check_sources.py -i sphinx/style/jquery.js sphinx
-	@$(PYTHON) utils/check_sources.py converter
 
 clean: clean-pyc clean-patchfiles
 

sphinx/__init__.py

             key, val = val.split('=')
             try:
                 val = int(val)
-            except: pass
+            except ValueError:
+                pass
             confoverrides[key] = val
         elif opt == '-N':
             nocolor()
                 print >>sys.stderr, ('Please also report this if it was a user '
                                      'error, so that a better error message '
                                      'can be provided next time.')
-                print >>sys.stderr, 'Send reports to sphinx-dev@googlegroups.com. Thanks!'
+                print >>sys.stderr, ('Send reports to sphinx-dev@googlegroups.com. '
+                                     'Thanks!')
             return 1
 
 
     :license: BSD.
 """
 
-import sys
 import codecs
 from os import path
 

sphinx/application.py

     that renders templates given a template name and a context.
     """
 
-    def __init__(self):
-        """
-        Initialize the class.
-        """
-
     def init(self, builder):
         """
         Called by the builder to initialize the template system.  *builder*

sphinx/builder.py

 from docutils.readers.doctree import Reader as DoctreeReader
 
 from sphinx import addnodes
-from sphinx.util import mtimes_of_files, ensuredir, relative_uri, SEP, os_path
+from sphinx.util import ensuredir, relative_uri, SEP, os_path
 from sphinx.htmlhelp import build_hhx
 from sphinx.htmlwriter import HTMLWriter, HTMLTranslator, SmartyPantsHTMLTranslator
 from sphinx.latexwriter import LaTeXWriter
                         subtree = process_tree(includefile,
                                                self.env.get_doctree(includefile))
                         self.docnames.add(includefile)
-                    except:
+                    except Exception:
                         self.warn('%s: toctree contains ref to nonexisting file %r' %
                                   (docname, includefile))
                     else:

sphinx/directives.py

     elif desctype == 'method':
         try:
             clsname, methname = name.rsplit('.', 1)
-        except:
+        except ValueError:
             if currmodule:
                 return '%s() (in module %s)' % (name, currmodule)
             else:
     elif desctype == 'attribute':
         try:
             clsname, attrname = name.rsplit('.', 1)
-        except:
+        except ValueError:
             if currmodule:
                 return '%s (in module %s)' % (name, currmodule)
             else:
     * it is added to the full name (return value) if not present
     """
     m = py_sig_re.match(sig)
-    if m is None: raise ValueError
+    if m is None:
+        raise ValueError
     classname, name, arglist = m.groups()
 
     add_module = True
             stack[-1] += opt
             stack.append(opt)
         elif token == ']':
-            try: stack.pop()
-            except IndexError: raise ValueError
+            try:
+                stack.pop()
+            except IndexError:
+                raise ValueError
         elif not token or token == ',' or token.isspace():
             pass
         else:
             token = token.strip()
             stack[-1] += addnodes.desc_parameter(token, token)
-    if len(stack) != 1: raise ValueError
+    if len(stack) != 1:
+        raise ValueError
     return fullname, classname
 
 
 def parse_opcode_signature(signode, sig):
     """Transform an opcode signature into RST nodes."""
     m = opcode_sig_re.match(sig)
-    if m is None: raise ValueError
+    if m is None:
+        raise ValueError
     opname, arglist = m.groups()
     signode += addnodes.desc_name(opname, opname)
     paramlist = addnodes.desc_parameterlist()
         m = caption_ref_re.match(docname)
         if m:
             docname = m.group(2)
-            includetitles[docname] = m.group(1)    
+            includetitles[docname] = m.group(1)
         # absolutize filenames, remove suffixes
         if docname.endswith(suffix):
             docname = docname[:-len(suffix)]

sphinx/environment.py

 try:
     import hashlib
     md5 = hashlib.md5
-except:
+except ImportError:
     # 2.4 compatibility
     import md5
     md5 = md5.new
                                     stream=RedirStream(self._warnfunc))
         return doctree
 
-    def get_and_resolve_doctree(self, docname, builder, doctree=None, prune_toctrees=True):
+    def get_and_resolve_doctree(self, docname, builder, doctree=None,
+                                prune_toctrees=True):
         """Read the doctree from the pickle, resolve cross-references and
            toctrees and return it."""
         if doctree is None:
                 if type == 'single':
                     try:
                         entry, subentry = string.split(';', 1)
-                    except:
+                    except ValueError:
                         entry, subentry = string, ''
                     add_entry(entry.strip(), subentry.strip())
                 elif type == 'pair':

sphinx/ext/autodoc.py

                     args = '()'
         else:
             args = ''
-    except:
+    except Exception:
         args = ''
     if len(objpath) == 2:
         qualname = '%s.%s' % (cls, obj)

sphinx/latexwriter.py

             try:
                 type, container = d.type.rsplit(' ', 1)
                 container = container.rstrip('.')
-            except:
+            except ValueError:
                 container = ''
                 type = d.type
             t2 = "{%s}{%s}{%s}" % (container, type, d.name)
 
     def visit_entry(self, node):
         if node.has_key('morerows') or node.has_key('morecols'):
-            raise NotImplementedError('Column or row spanning cells are not implemented.')
+            raise NotImplementedError('Column or row spanning cells are '
+                                      'not implemented.')
         if self.table.col > 0:
             self.body.append(' & ')
         self.table.col += 1
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.