Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/sphinx-doc/sphinx.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--setup.py10
-rw-r--r--sphinx/builders/gettext.py12
-rw-r--r--sphinx/builders/html.py134
-rw-r--r--sphinx/config.py110
-rw-r--r--sphinx/ext/apidoc.py44
-rw-r--r--sphinx/ext/linkcode.py12
-rw-r--r--sphinx/highlighting.py18
-rw-r--r--sphinx/search/__init__.py12
8 files changed, 176 insertions, 176 deletions
diff --git a/setup.py b/setup.py
index ec5d3e860..a9c8f463d 100644
--- a/setup.py
+++ b/setup.py
@@ -153,11 +153,11 @@ else:
with open(js_file, 'wt') as outfile:
outfile.write('Documentation.addTranslations(')
- dump(dict(
- messages=jscatalog,
- plural_expr=catalog.plural_expr,
- locale=str(catalog.locale)
- ), outfile, sort_keys=True)
+ dump({
+ 'messages': jscatalog,
+ 'plural_expr': catalog.plural_expr,
+ 'locale': str(catalog.locale)
+ }, outfile, sort_keys=True)
outfile.write(');')
cmdclass['compile_catalog'] = compile_catalog_plusjs
diff --git a/sphinx/builders/gettext.py b/sphinx/builders/gettext.py
index fbec9aae2..55da817af 100644
--- a/sphinx/builders/gettext.py
+++ b/sphinx/builders/gettext.py
@@ -265,13 +265,13 @@ class MessageCatalogBuilder(I18nBuilder):
def finish(self):
# type: () -> None
I18nBuilder.finish(self)
- data = dict(
- version = self.config.version,
- copyright = self.config.copyright,
- project = self.config.project,
- ctime = datetime.fromtimestamp(
+ data = {
+ 'version': self.config.version,
+ 'copyright': self.config.copyright,
+ 'project': self.config.project,
+ 'ctime': datetime.fromtimestamp(
timestamp, ltz).strftime('%Y-%m-%d %H:%M%z'),
- )
+ }
for textdomain, catalog in status_iterator(self.catalogs.items(), # type: ignore
__("writing message catalogs... "),
"darkgreen", len(self.catalogs),
diff --git a/sphinx/builders/html.py b/sphinx/builders/html.py
index 761dece92..e29518832 100644
--- a/sphinx/builders/html.py
+++ b/sphinx/builders/html.py
@@ -552,35 +552,35 @@ class StandaloneHTMLBuilder(Builder):
else:
stylename = 'default.css'
- self.globalcontext = dict(
- embedded = self.embedded,
- project = self.config.project,
- release = return_codes_re.sub('', self.config.release),
- version = self.config.version,
- last_updated = self.last_updated,
- copyright = self.config.copyright,
- master_doc = self.config.master_doc,
- use_opensearch = self.config.html_use_opensearch,
- docstitle = self.config.html_title,
- shorttitle = self.config.html_short_title,
- show_copyright = self.config.html_show_copyright,
- show_sphinx = self.config.html_show_sphinx,
- has_source = self.config.html_copy_source,
- show_source = self.config.html_show_sourcelink,
- sourcelink_suffix = self.config.html_sourcelink_suffix,
- file_suffix = self.out_suffix,
- script_files = self.script_files,
- language = self.config.language,
- css_files = self.css_files,
- sphinx_version = __display_version__,
- style = stylename,
- rellinks = rellinks,
- builder = self.name,
- parents = [],
- logo = logo,
- favicon = favicon,
- html5_doctype = self.config.html_experimental_html5_writer and html5_ready,
- ) # type: Dict[unicode, Any]
+ self.globalcontext = {
+ 'embedded': self.embedded,
+ 'project': self.config.project,
+ 'release': return_codes_re.sub('', self.config.release),
+ 'version': self.config.version,
+ 'last_updated': self.last_updated,
+ 'copyright': self.config.copyright,
+ 'master_doc': self.config.master_doc,
+ 'use_opensearch': self.config.html_use_opensearch,
+ 'docstitle': self.config.html_title,
+ 'shorttitle': self.config.html_short_title,
+ 'show_copyright': self.config.html_show_copyright,
+ 'show_sphinx': self.config.html_show_sphinx,
+ 'has_source': self.config.html_copy_source,
+ 'show_source': self.config.html_show_sourcelink,
+ 'sourcelink_suffix': self.config.html_sourcelink_suffix,
+ 'file_suffix': self.out_suffix,
+ 'script_files': self.script_files,
+ 'language': self.config.language,
+ 'css_files': self.css_files,
+ 'sphinx_version': __display_version__,
+ 'style': stylename,
+ 'rellinks': rellinks,
+ 'builder': self.name,
+ 'parents': [],
+ 'logo': logo,
+ 'favicon': favicon,
+ 'html5_doctype': self.config.html_experimental_html5_writer and html5_ready,
+ } # type: Dict[unicode, Any]
if self.theme:
self.globalcontext.update(
('theme_' + key, val) for (key, val) in
@@ -652,21 +652,21 @@ class StandaloneHTMLBuilder(Builder):
self_toc = TocTree(self.env).get_toc_for(docname, self)
toc = self.render_partial(self_toc)['fragment']
- return dict(
- parents = parents,
- prev = prev,
- next = next,
- title = title,
- meta = meta,
- body = body,
- metatags = metatags,
- rellinks = rellinks,
- sourcename = sourcename,
- toc = toc,
+ return {
+ 'parents': parents,
+ 'prev': prev,
+ 'next': next,
+ 'title': title,
+ 'meta': meta,
+ 'body': body,
+ 'metatags': metatags,
+ 'rellinks': rellinks,
+ 'sourcename': sourcename,
+ 'toc': toc,
# only display a TOC if there's more than one item to show
- display_toc = (self.env.toc_num_entries[docname] > 1),
- page_source_suffix = source_suffix,
- )
+ 'display_toc': (self.env.toc_num_entries[docname] > 1),
+ 'page_source_suffix': source_suffix,
+ }
def write_doc(self, docname, doctree):
# type: (unicode, nodes.Node) -> None
@@ -757,11 +757,11 @@ class StandaloneHTMLBuilder(Builder):
indexcounts.append(sum(1 + len(subitems)
for _, (_, subitems, _) in entries))
- genindexcontext = dict(
- genindexentries = genindex,
- genindexcounts = indexcounts,
- split_index = self.config.html_split_index,
- )
+ genindexcontext = {
+ 'genindexentries': genindex,
+ 'genindexcounts': indexcounts,
+ 'split_index': self.config.html_split_index,
+ }
logger.info(' genindex', nonl=1)
if self.config.html_split_index:
@@ -780,11 +780,11 @@ class StandaloneHTMLBuilder(Builder):
def write_domain_indices(self):
# type: () -> None
for indexname, indexcls, content, collapse in self.domain_indices:
- indexcontext = dict(
- indextitle = indexcls.localname,
- content = content,
- collapse_index = collapse,
- )
+ indexcontext = {
+ 'indextitle': indexcls.localname,
+ 'content': content,
+ 'collapse_index': collapse,
+ }
logger.info(' ' + indexname, nonl=1)
self.handle_page(indexname, indexcontext, 'domainindex.html')
@@ -1332,20 +1332,20 @@ class SingleFileHTMLBuilder(StandaloneHTMLBuilder):
else:
toc = ''
display_toc = False
- return dict(
- parents = [],
- prev = None,
- next = None,
- docstitle = None,
- title = self.config.html_title,
- meta = None,
- body = body,
- metatags = metatags,
- rellinks = [],
- sourcename = '',
- toc = toc,
- display_toc = display_toc,
- )
+ return {
+ 'parents': [],
+ 'prev': None,
+ 'next': None,
+ 'docstitle': None,
+ 'title': self.config.html_title,
+ 'meta': None,
+ 'body': body,
+ 'metatags': metatags,
+ 'rellinks': [],
+ 'sourcename': '',
+ 'toc': toc,
+ 'display_toc': display_toc,
+ }
def write(self, *ignored):
# type: (Any) -> None
diff --git a/sphinx/config.py b/sphinx/config.py
index f5a7106d7..d64c049ad 100644
--- a/sphinx/config.py
+++ b/sphinx/config.py
@@ -97,63 +97,63 @@ class Config:
# If you add a value here, don't forget to include it in the
# quickstart.py file template as well as in the docs!
- config_values = dict(
+ config_values = {
# general options
- project = ('Python', 'env', []),
- author = ('unknown', 'env', []),
- copyright = ('', 'html', []),
- version = ('', 'env', []),
- release = ('', 'env', []),
- today = ('', 'env', []),
+ 'project': ('Python', 'env', []),
+ 'author': ('unknown', 'env', []),
+ 'copyright': ('', 'html', []),
+ 'version': ('', 'env', []),
+ 'release': ('', 'env', []),
+ 'today': ('', 'env', []),
# the real default is locale-dependent
- today_fmt = (None, 'env', string_classes),
-
- language = (None, 'env', string_classes),
- locale_dirs = (['locales'], 'env', []),
- figure_language_filename = (u'{root}.{language}{ext}', 'env', [str]),
-
- master_doc = ('index', 'env', []),
- source_suffix = ({'.rst': 'restructuredtext'}, 'env', Any),
- source_encoding = ('utf-8-sig', 'env', []),
- source_parsers = ({}, 'env', []),
- exclude_patterns = ([], 'env', []),
- default_role = (None, 'env', string_classes),
- add_function_parentheses = (True, 'env', []),
- add_module_names = (True, 'env', []),
- trim_footnote_reference_space = (False, 'env', []),
- show_authors = (False, 'env', []),
- pygments_style = (None, 'html', string_classes),
- highlight_language = ('default', 'env', []),
- highlight_options = ({}, 'env', []),
- templates_path = ([], 'html', []),
- template_bridge = (None, 'html', string_classes),
- keep_warnings = (False, 'env', []),
- suppress_warnings = ([], 'env', []),
- modindex_common_prefix = ([], 'html', []),
- rst_epilog = (None, 'env', string_classes),
- rst_prolog = (None, 'env', string_classes),
- trim_doctest_flags = (True, 'env', []),
- primary_domain = ('py', 'env', [NoneType]), # type: ignore
- needs_sphinx = (None, None, string_classes),
- needs_extensions = ({}, None, []),
- manpages_url = (None, 'env', []),
- nitpicky = (False, None, []),
- nitpick_ignore = ([], None, []),
- numfig = (False, 'env', []),
- numfig_secnum_depth = (1, 'env', []),
- numfig_format = ({}, 'env', []), # will be initialized in init_numfig_format()
-
- math_number_all = (False, 'env', []),
- math_eqref_format = (None, 'env', string_classes),
- math_numfig = (True, 'env', []),
- tls_verify = (True, 'env', []),
- tls_cacerts = (None, 'env', []),
- smartquotes = (True, 'env', []),
- smartquotes_action = ('qDe', 'env', []),
- smartquotes_excludes = ({'languages': ['ja'],
- 'builders': ['man', 'text']},
- 'env', []),
- ) # type: Dict[unicode, Tuple]
+ 'today_fmt': (None, 'env', string_classes),
+
+ 'language': (None, 'env', string_classes),
+ 'locale_dirs': (['locales'], 'env', []),
+ 'figure_language_filename': (u'{root}.{language}{ext}', 'env', [str]),
+
+ 'master_doc': ('index', 'env', []),
+ 'source_suffix': ({'.rst': 'restructuredtext'}, 'env', Any),
+ 'source_encoding': ('utf-8-sig', 'env', []),
+ 'source_parsers': ({}, 'env', []),
+ 'exclude_patterns': ([], 'env', []),
+ 'default_role': (None, 'env', string_classes),
+ 'add_function_parentheses': (True, 'env', []),
+ 'add_module_names': (True, 'env', []),
+ 'trim_footnote_reference_space': (False, 'env', []),
+ 'show_authors': (False, 'env', []),
+ 'pygments_style': (None, 'html', string_classes),
+ 'highlight_language': ('default', 'env', []),
+ 'highlight_options': ({}, 'env', []),
+ 'templates_path': ([], 'html', []),
+ 'template_bridge': (None, 'html', string_classes),
+ 'keep_warnings': (False, 'env', []),
+ 'suppress_warnings': ([], 'env', []),
+ 'modindex_common_prefix': ([], 'html', []),
+ 'rst_epilog': (None, 'env', string_classes),
+ 'rst_prolog': (None, 'env', string_classes),
+ 'trim_doctest_flags': (True, 'env', []),
+ 'primary_domain': ('py', 'env', [NoneType]), # type: ignore
+ 'needs_sphinx': (None, None, string_classes),
+ 'needs_extensions': ({}, None, []),
+ 'manpages_url': (None, 'env', []),
+ 'nitpicky': (False, None, []),
+ 'nitpick_ignore': ([], None, []),
+ 'numfig': (False, 'env', []),
+ 'numfig_secnum_depth': (1, 'env', []),
+ 'numfig_format': ({}, 'env', []), # will be initialized in init_numfig_format()
+
+ 'math_number_all': (False, 'env', []),
+ 'math_eqref_format': (None, 'env', string_classes),
+ 'math_numfig': (True, 'env', []),
+ 'tls_verify': (True, 'env', []),
+ 'tls_cacerts': (None, 'env', []),
+ 'smartquotes': (True, 'env', []),
+ 'smartquotes_action': ('qDe', 'env', []),
+ 'smartquotes_excludes': ({'languages': ['ja'],
+ 'builders': ['man', 'text']},
+ 'env', []),
+ } # type: Dict[unicode, Tuple]
def __init__(self, *args):
# type: (Any) -> None
diff --git a/sphinx/ext/apidoc.py b/sphinx/ext/apidoc.py
index 36073298f..7c407e933 100644
--- a/sphinx/ext/apidoc.py
+++ b/sphinx/ext/apidoc.py
@@ -417,28 +417,28 @@ def main(argv=sys.argv[1:]):
continue
prev_module = module
text += ' %s\n' % module
- d = dict(
- path = args.destdir,
- sep = False,
- dot = '_',
- project = args.header,
- author = args.author or 'Author',
- version = args.version or '',
- release = args.release or args.version or '',
- suffix = '.' + args.suffix,
- master = 'index',
- epub = True,
- extensions = ['sphinx.ext.autodoc', 'sphinx.ext.viewcode',
- 'sphinx.ext.todo'],
- makefile = True,
- batchfile = True,
- make_mode = True,
- mastertocmaxdepth = args.maxdepth,
- mastertoctree = text,
- language = 'en',
- module_path = rootpath,
- append_syspath = args.append_syspath,
- )
+ d = {
+ 'path': args.destdir,
+ 'sep': False,
+ 'dot': '_',
+ 'project': args.header,
+ 'author': args.author or 'Author',
+ 'version': args.version or '',
+ 'release': args.release or args.version or '',
+ 'suffix': '.' + args.suffix,
+ 'master': 'index',
+ 'epub': True,
+ 'extensions': ['sphinx.ext.autodoc', 'sphinx.ext.viewcode',
+ 'sphinx.ext.todo'],
+ 'makefile': True,
+ 'batchfile': True,
+ 'make_mode': True,
+ 'mastertocmaxdepth': args.maxdepth,
+ 'mastertoctree': text,
+ 'language': 'en',
+ 'module_path': rootpath,
+ 'append_syspath': args.append_syspath,
+ }
if args.extensions:
d['extensions'].extend(args.extensions)
diff --git a/sphinx/ext/linkcode.py b/sphinx/ext/linkcode.py
index af45f32fa..6e16a1ac5 100644
--- a/sphinx/ext/linkcode.py
+++ b/sphinx/ext/linkcode.py
@@ -35,12 +35,12 @@ def doctree_read(app, doctree):
raise LinkcodeError(
"Function `linkcode_resolve` is not given in conf.py")
- domain_keys = dict(
- py=['module', 'fullname'],
- c=['names'],
- cpp=['names'],
- js=['object', 'fullname'],
- )
+ domain_keys = {
+ 'py': ['module', 'fullname'],
+ 'c': ['names'],
+ 'cpp': ['names'],
+ 'js': ['object', 'fullname'],
+ }
for objnode in doctree.traverse(addnodes.desc):
domain = objnode.get('domain')
diff --git a/sphinx/highlighting.py b/sphinx/highlighting.py
index b12fa6e2e..8bd12c991 100644
--- a/sphinx/highlighting.py
+++ b/sphinx/highlighting.py
@@ -38,15 +38,15 @@ if False:
logger = logging.getLogger(__name__)
-lexers = dict(
- none = TextLexer(stripnl=False),
- python = PythonLexer(stripnl=False),
- python3 = Python3Lexer(stripnl=False),
- pycon = PythonConsoleLexer(stripnl=False),
- pycon3 = PythonConsoleLexer(python3=True, stripnl=False),
- rest = RstLexer(stripnl=False),
- c = CLexer(stripnl=False),
-) # type: Dict[unicode, Lexer]
+lexers = {
+ 'none': TextLexer(stripnl=False),
+ 'python': PythonLexer(stripnl=False),
+ 'python3': Python3Lexer(stripnl=False),
+ 'pycon': PythonConsoleLexer(stripnl=False),
+ 'pycon3': PythonConsoleLexer(python3=True, stripnl=False),
+ 'rest': RstLexer(stripnl=False),
+ 'c': CLexer(stripnl=False),
+} # type: Dict[unicode, Lexer]
for _lexer in lexers.values():
_lexer.add_filter('raiseonerror')
diff --git a/sphinx/search/__init__.py b/sphinx/search/__init__.py
index 99cb869ec..3008ab6f3 100644
--- a/sphinx/search/__init__.py
+++ b/sphinx/search/__init__.py
@@ -446,12 +446,12 @@ class IndexBuilder:
def context_for_searchtool(self):
# type: () -> Dict[unicode, Any]
- return dict(
- search_language_stemming_code = self.lang.js_stemmer_code,
- search_language_stop_words = jsdump.dumps(sorted(self.lang.stopwords)),
- search_scorer_tool = self.js_scorer_code,
- search_word_splitter_code = self.js_splitter_code,
- )
+ return {
+ 'search_language_stemming_code': self.lang.js_stemmer_code,
+ 'search_language_stop_words': jsdump.dumps(sorted(self.lang.stopwords)),
+ 'search_scorer_tool': self.js_scorer_code,
+ 'search_word_splitter_code': self.js_splitter_code,
+ }
def get_js_stemmer_rawcode(self):
# type: () -> unicode