diff options
| author | shimizukawa <shimizukawa@gmail.com> | 2014-04-29 21:20:56 +0900 |
|---|---|---|
| committer | shimizukawa <shimizukawa@gmail.com> | 2014-04-29 21:20:56 +0900 |
| commit | 3cc9b03a3623011250b3cf31a7981dd1180f47e6 (patch) | |
| tree | 025c7e7b7248a22c3ee04d413635c385fc5e8c49 /sphinx/domains/python.py | |
| parent | ec98611f2e058a419a28bf7f780f35e761e384ef (diff) | |
| download | sphinx-3cc9b03a3623011250b3cf31a7981dd1180f47e6.tar.gz | |
use six privided iteritems(),itervalues() to support py2/py3 in one source. refs #1350.
Diffstat (limited to 'sphinx/domains/python.py')
| -rw-r--r-- | sphinx/domains/python.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/sphinx/domains/python.py b/sphinx/domains/python.py index 9e083a12..30ed4b8a 100644 --- a/sphinx/domains/python.py +++ b/sphinx/domains/python.py @@ -11,6 +11,7 @@ import re +from six import iteritems from docutils import nodes from docutils.parsers.rst import directives @@ -514,7 +515,7 @@ class PythonModuleIndex(Index): ignores = self.domain.env.config['modindex_common_prefix'] ignores = sorted(ignores, key=len, reverse=True) # list of all modules, sorted by module name - modules = sorted(self.domain.data['modules'].iteritems(), + modules = sorted(iteritems(self.domain.data['modules']), key=lambda x: x[0].lower()) # sort out collapsable modules prev_modname = '' @@ -564,7 +565,7 @@ class PythonModuleIndex(Index): collapse = len(modules) - num_toplevels < num_toplevels # sort by first letter - content = sorted(content.iteritems()) + content = sorted(iteritems(content)) return content, collapse @@ -720,8 +721,8 @@ class PythonDomain(Domain): contnode, name) def get_objects(self): - for modname, info in self.data['modules'].iteritems(): + for modname, info in iteritems(self.data['modules']): yield (modname, modname, 'module', info[0], 'module-' + modname, 0) - for refname, (docname, type) in self.data['objects'].iteritems(): + for refname, (docname, type) in iteritems(self.data['objects']): if type != 'module': # modules are already handled yield (refname, refname, type, docname, refname, 1) |
