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
path: root/sphinx
diff options
context:
space:
mode:
authorTakeshi KOMIYA <i.tkomiya@gmail.com>2020-06-03 17:46:13 +0300
committerTakeshi KOMIYA <i.tkomiya@gmail.com>2020-06-03 17:46:13 +0300
commit6a55947e9f8f51c42a4719663f10b85c921a5918 (patch)
tree4315f8b35a232794ba4069cfe0301308101239b6 /sphinx
parentcee921fe416068021996ec24ad19afb54cd6bbec (diff)
parented75950017e63b3ccfe2beef3d22ae6ec44410b0 (diff)
Merge branch '3.0.x' into 3.x
Diffstat (limited to 'sphinx')
-rw-r--r--sphinx/config.py2
-rw-r--r--sphinx/jinja2glue.py2
-rw-r--r--sphinx/search/__init__.py10
-rw-r--r--sphinx/util/console.py3
-rw-r--r--sphinx/util/images.py2
-rw-r--r--sphinx/util/nodes.py3
-rw-r--r--sphinx/util/pycompat.py2
-rw-r--r--sphinx/util/template.py2
-rw-r--r--sphinx/util/typing.py8
9 files changed, 17 insertions, 17 deletions
diff --git a/sphinx/config.py b/sphinx/config.py
index 6e6c256c5..92c203dfd 100644
--- a/sphinx/config.py
+++ b/sphinx/config.py
@@ -131,7 +131,7 @@ class Config:
'rst_epilog': (None, 'env', [str]),
'rst_prolog': (None, 'env', [str]),
'trim_doctest_flags': (True, 'env', []),
- 'primary_domain': ('py', 'env', [NoneType]), # type: ignore
+ 'primary_domain': ('py', 'env', [NoneType]),
'needs_sphinx': (None, None, [str]),
'needs_extensions': ({}, None, []),
'manpages_url': (None, 'env', []),
diff --git a/sphinx/jinja2glue.py b/sphinx/jinja2glue.py
index e943cfb1e..52d0257e5 100644
--- a/sphinx/jinja2glue.py
+++ b/sphinx/jinja2glue.py
@@ -186,7 +186,7 @@ class BuiltinTemplateLoader(TemplateBridge, BaseLoader):
self.environment.globals['accesskey'] = contextfunction(accesskey)
self.environment.globals['idgen'] = idgen
if use_i18n:
- self.environment.install_gettext_translations(builder.app.translator) # type: ignore # NOQA
+ self.environment.install_gettext_translations(builder.app.translator)
def render(self, template: str, context: Dict) -> str: # type: ignore
return self.environment.get_template(template).render(context)
diff --git a/sphinx/search/__init__.py b/sphinx/search/__init__.py
index 74fbaade9..b531145f4 100644
--- a/sphinx/search/__init__.py
+++ b/sphinx/search/__init__.py
@@ -297,8 +297,8 @@ class IndexBuilder:
frozen.get('envversion') != self.env.version:
raise ValueError('old format')
index2fn = frozen['docnames']
- self._filenames = dict(zip(index2fn, frozen['filenames']))
- self._titles = dict(zip(index2fn, frozen['titles']))
+ self._filenames = dict(zip(index2fn, frozen['filenames'])) # type: ignore
+ self._titles = dict(zip(index2fn, frozen['titles'])) # type: ignore
def load_terms(mapping: Dict[str, Any]) -> Dict[str, Set[str]]:
rv = {}
@@ -359,13 +359,13 @@ class IndexBuilder:
def get_terms(self, fn2index: Dict) -> Tuple[Dict[str, List[str]], Dict[str, List[str]]]:
rvs = {}, {} # type: Tuple[Dict[str, List[str]], Dict[str, List[str]]]
for rv, mapping in zip(rvs, (self._mapping, self._title_mapping)):
- for k, v in mapping.items():
+ for k, v in mapping.items(): # type: ignore
if len(v) == 1:
fn, = v
if fn in fn2index:
- rv[k] = fn2index[fn]
+ rv[k] = fn2index[fn] # type: ignore
else:
- rv[k] = sorted([fn2index[fn] for fn in v if fn in fn2index])
+ rv[k] = sorted([fn2index[fn] for fn in v if fn in fn2index]) # type: ignore # NOQA
return rvs
def freeze(self) -> Dict[str, Any]:
diff --git a/sphinx/util/console.py b/sphinx/util/console.py
index 98563f58e..d429be602 100644
--- a/sphinx/util/console.py
+++ b/sphinx/util/console.py
@@ -35,8 +35,7 @@ def get_terminal_width() -> int:
import termios
import fcntl
import struct
- call = fcntl.ioctl(0, termios.TIOCGWINSZ, # type: ignore
- struct.pack('hhhh', 0, 0, 0, 0))
+ call = fcntl.ioctl(0, termios.TIOCGWINSZ, struct.pack('hhhh', 0, 0, 0, 0))
height, width = struct.unpack('hhhh', call)[:2]
terminal_width = width
except Exception:
diff --git a/sphinx/util/images.py b/sphinx/util/images.py
index 115007d31..0ddf64908 100644
--- a/sphinx/util/images.py
+++ b/sphinx/util/images.py
@@ -54,7 +54,7 @@ def get_image_size(filename: str) -> Optional[Tuple[int, int]]:
def guess_mimetype_for_stream(stream: IO, default: Optional[str] = None) -> Optional[str]:
- imgtype = imghdr.what(stream) # type: ignore
+ imgtype = imghdr.what(stream)
if imgtype:
return 'image/' + imgtype
else:
diff --git a/sphinx/util/nodes.py b/sphinx/util/nodes.py
index a18eac580..1ec3a19d0 100644
--- a/sphinx/util/nodes.py
+++ b/sphinx/util/nodes.py
@@ -29,6 +29,7 @@ if False:
# For type annotation
from typing import Type # for python3.5.1
from sphinx.builders import Builder
+ from sphinx.domain import IndexEntry
from sphinx.environment import BuildEnvironment
from sphinx.utils.tags import Tags
@@ -313,7 +314,7 @@ def get_prev_node(node: Node) -> Node:
return None
-def traverse_translatable_index(doctree: Element) -> Iterable[Tuple[Element, List[str]]]:
+def traverse_translatable_index(doctree: Element) -> Iterable[Tuple[Element, List["IndexEntry"]]]: # NOQA
"""Traverse translatable index node from a document tree."""
for node in doctree.traverse(NodeMatcher(addnodes.index, inline=False)): # type: addnodes.index # NOQA
if 'raw_entries' in node:
diff --git a/sphinx/util/pycompat.py b/sphinx/util/pycompat.py
index 6decc1cef..664387cac 100644
--- a/sphinx/util/pycompat.py
+++ b/sphinx/util/pycompat.py
@@ -90,7 +90,7 @@ def execfile_(filepath: str, _globals: Any, open: Callable = open) -> None:
deprecated_alias('sphinx.util.pycompat',
{
- 'NoneType': NoneType, # type: ignore
+ 'NoneType': NoneType,
'TextIOWrapper': io.TextIOWrapper,
'htmlescape': html.escape,
'indent': textwrap.indent,
diff --git a/sphinx/util/template.py b/sphinx/util/template.py
index 2449a60a1..18047d687 100644
--- a/sphinx/util/template.py
+++ b/sphinx/util/template.py
@@ -28,7 +28,7 @@ class BaseRenderer:
def __init__(self, loader: BaseLoader = None) -> None:
self.env = SandboxedEnvironment(loader=loader, extensions=['jinja2.ext.i18n'])
self.env.filters['repr'] = repr
- self.env.install_gettext_translations(get_translator()) # type: ignore
+ self.env.install_gettext_translations(get_translator())
def render(self, template_name: str, context: Dict) -> str:
return self.env.get_template(template_name).render(context)
diff --git a/sphinx/util/typing.py b/sphinx/util/typing.py
index de92e7593..18b363eca 100644
--- a/sphinx/util/typing.py
+++ b/sphinx/util/typing.py
@@ -53,7 +53,7 @@ def stringify(annotation: Any) -> str:
return annotation.__name__
elif not annotation:
return repr(annotation)
- elif annotation is NoneType: # type: ignore
+ elif annotation is NoneType:
return 'None'
elif (getattr(annotation, '__module__', None) == 'builtins' and
hasattr(annotation, '__qualname__')):
@@ -91,7 +91,7 @@ def _stringify_py37(annotation: Any) -> str:
if getattr(annotation, '__args__', None):
if qualname == 'Union':
- if len(annotation.__args__) > 1 and annotation.__args__[-1] is NoneType: # type: ignore # NOQA
+ if len(annotation.__args__) > 1 and annotation.__args__[-1] is NoneType:
if len(annotation.__args__) > 2:
args = ', '.join(stringify(a) for a in annotation.__args__[:-1])
return 'Optional[Union[%s]]' % args
@@ -165,7 +165,7 @@ def _stringify_py36(annotation: Any) -> str:
hasattr(annotation, '__union_params__')): # for Python 3.5
params = annotation.__union_params__
if params is not None:
- if len(params) == 2 and params[1] is NoneType: # type: ignore
+ if len(params) == 2 and params[1] is NoneType:
return 'Optional[%s]' % stringify(params[0])
else:
param_str = ', '.join(stringify(p) for p in params)
@@ -174,7 +174,7 @@ def _stringify_py36(annotation: Any) -> str:
annotation.__origin__ is typing.Union): # for Python 3.5.2+
params = annotation.__args__
if params is not None:
- if len(params) > 1 and params[-1] is NoneType: # type: ignore
+ if len(params) > 1 and params[-1] is NoneType:
if len(params) > 2:
param_str = ", ".join(stringify(p) for p in params[:-1])
return 'Optional[Union[%s]]' % param_str