summaryrefslogtreecommitdiff
path: root/sphinx/pycode
diff options
context:
space:
mode:
Diffstat (limited to 'sphinx/pycode')
-rw-r--r--sphinx/pycode/__init__.py14
-rw-r--r--sphinx/pycode/nodes.py6
2 files changed, 13 insertions, 7 deletions
diff --git a/sphinx/pycode/__init__.py b/sphinx/pycode/__init__.py
index c2086da58..d195d6c3a 100644
--- a/sphinx/pycode/__init__.py
+++ b/sphinx/pycode/__init__.py
@@ -91,7 +91,8 @@ class AttrDocVisitor(nodes.NodeVisitor):
return
if prev.type == sym.simple_stmt and \
prev[0].type == sym.expr_stmt and _eq in prev[0].children:
- # need to "eval" the string because it's returned in its original form
+ # need to "eval" the string because it's returned in its
+ # original form
docstring = literals.evalString(node[0].value, self.encoding)
docstring = prepare_docstring(docstring)
self.add_docstring(prev[0], docstring)
@@ -159,7 +160,8 @@ class ModuleAnalyzer(object):
try:
source = mod.__loader__.get_source(modname)
except Exception, err:
- raise PycodeError('error getting source for %r' % modname, err)
+ raise PycodeError('error getting source for %r' % modname,
+ err)
obj = cls.for_string(source, modname)
cls.cache['module', modname] = obj
return obj
@@ -279,8 +281,9 @@ class ModuleAnalyzer(object):
namespace.pop()
result[fullname] = (dtype, startline, endline)
elif type == token.NEWLINE:
- # if this line contained a definition, expect an INDENT to start the
- # suite; if there is no such INDENT it's a one-line definition
+ # if this line contained a definition, expect an INDENT
+ # to start the suite; if there is no such INDENT
+ # it's a one-line definition
if defline:
defline = False
expect_indent = True
@@ -292,7 +295,8 @@ if __name__ == '__main__':
import time, pprint
x0 = time.time()
#ma = ModuleAnalyzer.for_file(__file__.rstrip('c'), 'sphinx.builders.html')
- ma = ModuleAnalyzer.for_file('sphinx/builders/html.py', 'sphinx.builders.html')
+ ma = ModuleAnalyzer.for_file('sphinx/builders/html.py',
+ 'sphinx.builders.html')
ma.tokenize()
x1 = time.time()
ma.parse()
diff --git a/sphinx/pycode/nodes.py b/sphinx/pycode/nodes.py
index 4d27fc660..efdf8f061 100644
--- a/sphinx/pycode/nodes.py
+++ b/sphinx/pycode/nodes.py
@@ -102,7 +102,8 @@ class Node(BaseNode):
ch.parent = self
def __repr__(self):
- return '%s(%s, %r)' % (self.__class__.__name__, self.type, self.children)
+ return '%s(%s, %r)' % (self.__class__.__name__,
+ self.type, self.children)
def __str__(self):
"""This reproduces the input source exactly."""
@@ -174,7 +175,8 @@ def nice_repr(node, number2name, prefix=False):
', '.join(map(_repr, node.children)))
def _prepr(node):
if isinstance(node, Leaf):
- return "%s(%r, %r)" % (number2name[node.type], node.prefix, node.value)
+ return "%s(%r, %r)" % (number2name[node.type],
+ node.prefix, node.value)
else:
return "%s(%s)" % (number2name[node.type],
', '.join(map(_prepr, node.children)))