summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2015-03-08 16:59:27 +0100
committerGeorg Brandl <georg@python.org>2015-03-08 16:59:27 +0100
commitba9dcaac5120f58c3cc0bc455b4beceab3a4abd9 (patch)
tree1f04a07d99ba7cf41d726a3d561eae90165553ce
parentd0efb42a4179f331dd67d4d301c81b2c01d8e386 (diff)
downloadsphinx-git-ba9dcaac5120f58c3cc0bc455b4beceab3a4abd9.tar.gz
more pep8 fixes
-rw-r--r--sphinx/directives/other.py12
-rw-r--r--sphinx/domains/__init__.py2
-rw-r--r--sphinx/domains/c.py10
-rw-r--r--sphinx/domains/javascript.py4
-rw-r--r--sphinx/domains/python.py18
-rw-r--r--sphinx/domains/std.py8
-rw-r--r--sphinx/locale/__init__.py8
7 files changed, 33 insertions, 29 deletions
diff --git a/sphinx/directives/other.py b/sphinx/directives/other.py
index d83c0ca90..2b941c31f 100644
--- a/sphinx/directives/other.py
+++ b/sphinx/directives/other.py
@@ -7,7 +7,6 @@
:license: BSD, see LICENSE for details.
"""
-from six import string_types
from six.moves import range
from docutils import nodes
from docutils.parsers.rst import Directive, directives
@@ -224,7 +223,8 @@ class VersionChange(Directive):
classes=['versionmodified']))
else:
para = nodes.paragraph('', '',
- nodes.inline('', '%s.' % text, classes=['versionmodified']))
+ nodes.inline('', '%s.' % text,
+ classes=['versionmodified']))
node.append(para)
env = self.state.document.settings.env
# XXX should record node.source as well
@@ -359,10 +359,10 @@ class Only(Directive):
self.state.nested_parse(self.content, self.content_offset,
node, match_titles=1)
title_styles = self.state.memo.title_styles
- if (not surrounding_title_styles
- or not title_styles
- or title_styles[0] not in surrounding_title_styles
- or not self.state.parent):
+ if (not surrounding_title_styles or
+ not title_styles or
+ title_styles[0] not in surrounding_title_styles or
+ not self.state.parent):
# No nested sections so no special handling needed.
return [node]
# Calculate the depths of the current and nested sections.
diff --git a/sphinx/domains/__init__.py b/sphinx/domains/__init__.py
index b32007cd3..fda81d4f5 100644
--- a/sphinx/domains/__init__.py
+++ b/sphinx/domains/__init__.py
@@ -172,6 +172,7 @@ class Domain(object):
if name not in self.roles:
return None
fullname = '%s:%s' % (self.name, name)
+
def role_adapter(typ, rawtext, text, lineno, inliner,
options={}, content=[]):
return self.roles[name](fullname, rawtext, text, lineno,
@@ -189,6 +190,7 @@ class Domain(object):
return None
fullname = '%s:%s' % (self.name, name)
BaseDirective = self.directives[name]
+
class DirectiveAdapter(BaseDirective):
def run(self):
self.name = fullname
diff --git a/sphinx/domains/c.py b/sphinx/domains/c.py
index ab101686d..6b71f882d 100644
--- a/sphinx/domains/c.py
+++ b/sphinx/domains/c.py
@@ -78,7 +78,7 @@ class CObject(ObjectDescription):
for part in [_f for _f in wsplit_re.split(ctype) if _f]:
tnode = nodes.Text(part, part)
if part[0] in string.ascii_letters+'_' and \
- part not in self.stopwords:
+ part not in self.stopwords:
pnode = addnodes.pending_xref(
'', refdomain='c', reftype='type', reftarget=part,
modname=None, classname=None)
@@ -145,7 +145,7 @@ class CObject(ObjectDescription):
return fullname
paramlist = addnodes.desc_parameterlist()
- arglist = arglist.replace('`', '').replace('\\ ', '') # remove markup
+ arglist = arglist.replace('`', '').replace('\\ ', '') # remove markup
# this messes up function pointer types, but not too badly ;)
for arg in self._parse_arglist(arglist):
arg = arg.strip()
@@ -223,7 +223,7 @@ class CObject(ObjectDescription):
class CXRefRole(XRefRole):
def process_link(self, env, refnode, has_explicit_title, title, target):
if not has_explicit_title:
- target = target.lstrip('~') # only has a meaning for the title
+ target = target.lstrip('~') # only has a meaning for the title
# if the first character is a tilde, don't display the module/class
# parts of the contents
if title[0:1] == '~':
@@ -254,7 +254,7 @@ class CDomain(Domain):
'var': CObject,
}
roles = {
- 'func' : CXRefRole(fix_parens=True),
+ 'func': CXRefRole(fix_parens=True),
'member': CXRefRole(),
'macro': CXRefRole(),
'data': CXRefRole(),
@@ -265,7 +265,7 @@ class CDomain(Domain):
}
def clear_doc(self, docname):
- for fullname, (fn, _) in list(self.data['objects'].items()):
+ for fullname, (fn, _l) in list(self.data['objects'].items()):
if fn == docname:
del self.data['objects'][fullname]
diff --git a/sphinx/domains/javascript.py b/sphinx/domains/javascript.py
index 2045873b9..843629b3b 100644
--- a/sphinx/domains/javascript.py
+++ b/sphinx/domains/javascript.py
@@ -183,7 +183,7 @@ class JavaScriptDomain(Domain):
}
def clear_doc(self, docname):
- for fullname, (fn, _) in list(self.data['objects'].items()):
+ for fullname, (fn, _l) in list(self.data['objects'].items()):
if fn == docname:
del self.data['objects'][fullname]
@@ -233,4 +233,4 @@ class JavaScriptDomain(Domain):
def get_objects(self):
for refname, (docname, type) in list(self.data['objects'].items()):
yield refname, refname, type, docname, \
- refname.replace('$', '_S_'), 1
+ refname.replace('$', '_S_'), 1
diff --git a/sphinx/domains/python.py b/sphinx/domains/python.py
index 9a6a6c5c2..c9a03de2b 100644
--- a/sphinx/domains/python.py
+++ b/sphinx/domains/python.py
@@ -492,8 +492,8 @@ class PyXRefRole(XRefRole):
refnode['py:module'] = env.ref_context.get('py:module')
refnode['py:class'] = env.ref_context.get('py:class')
if not has_explicit_title:
- title = title.lstrip('.') # only has a meaning for the target
- target = target.lstrip('~') # only has a meaning for the title
+ title = title.lstrip('.') # only has a meaning for the target
+ target = target.lstrip('~') # only has a meaning for the title
# if the first character is a tilde, don't display the module/class
# parts of the contents
if title[0:1] == '~':
@@ -629,10 +629,10 @@ class PythonDomain(Domain):
]
def clear_doc(self, docname):
- for fullname, (fn, _) in list(self.data['objects'].items()):
+ for fullname, (fn, _l) in list(self.data['objects'].items()):
if fn == docname:
del self.data['objects'][fullname]
- for modname, (fn, _, _, _) in list(self.data['modules'].items()):
+ for modname, (fn, _x, _x, _x) in list(self.data['modules'].items()):
if fn == docname:
del self.data['modules'][modname]
@@ -680,8 +680,8 @@ class PythonDomain(Domain):
# "fuzzy" searching mode
searchname = '.' + name
matches = [(oname, objects[oname]) for oname in objects
- if oname.endswith(searchname)
- and objects[oname][1] in objtypes]
+ if oname.endswith(searchname) and
+ objects[oname][1] in objtypes]
else:
# NOTE: searching for exact match, object type is not considered
if name in objects:
@@ -694,15 +694,15 @@ class PythonDomain(Domain):
elif modname and modname + '.' + name in objects:
newname = modname + '.' + name
elif modname and classname and \
- modname + '.' + classname + '.' + name in objects:
+ modname + '.' + classname + '.' + name in objects:
newname = modname + '.' + classname + '.' + name
# special case: builtin exceptions have module "exceptions" set
elif type == 'exc' and '.' not in name and \
- 'exceptions.' + name in objects:
+ 'exceptions.' + name in objects:
newname = 'exceptions.' + name
# special case: object methods
elif type in ('func', 'meth') and '.' not in name and \
- 'object.' + name in objects:
+ 'object.' + name in objects:
newname = 'object.' + name
if newname is not None:
matches.append((newname, objects[newname]))
diff --git a/sphinx/domains/std.py b/sphinx/domains/std.py
index 1184672b2..c437005a8 100644
--- a/sphinx/domains/std.py
+++ b/sphinx/domains/std.py
@@ -498,16 +498,16 @@ class StandardDomain(Domain):
}
def clear_doc(self, docname):
- for key, (fn, _) in list(self.data['progoptions'].items()):
+ for key, (fn, _l) in list(self.data['progoptions'].items()):
if fn == docname:
del self.data['progoptions'][key]
- for key, (fn, _) in list(self.data['objects'].items()):
+ for key, (fn, _l) in list(self.data['objects'].items()):
if fn == docname:
del self.data['objects'][key]
- for key, (fn, _, _) in list(self.data['labels'].items()):
+ for key, (fn, _l, _l) in list(self.data['labels'].items()):
if fn == docname:
del self.data['labels'][key]
- for key, (fn, _) in list(self.data['anonlabels'].items()):
+ for key, (fn, _l) in list(self.data['anonlabels'].items()):
if fn == docname:
del self.data['anonlabels'][key]
diff --git a/sphinx/locale/__init__.py b/sphinx/locale/__init__.py
index 4f7ebcfb9..acb71bf28 100644
--- a/sphinx/locale/__init__.py
+++ b/sphinx/locale/__init__.py
@@ -138,16 +138,18 @@ class _TranslationProxy(UserString, object):
except:
return '<%s broken>' % self.__class__.__name__
+
def mygettext(string):
"""Used instead of _ when creating TranslationProxies, because _ is
not bound yet at that time.
"""
return _(string)
+
def lazy_gettext(string):
"""A lazy version of `gettext`."""
- #if isinstance(string, _TranslationProxy):
- # return string
+ # if isinstance(string, _TranslationProxy):
+ # return string
return _TranslationProxy(mygettext, string)
l_ = lazy_gettext
@@ -209,7 +211,7 @@ def init(locale_dirs, language, catalog='sphinx'):
for dir_ in locale_dirs:
try:
trans = gettext.translation(catalog, localedir=dir_,
- languages=[language])
+ languages=[language])
if translator is None:
translator = trans
else: