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:
authorTakeshi KOMIYA <i.tkomiya@gmail.com>2019-12-30 11:33:52 +0300
committerGitHub <noreply@github.com>2019-12-30 11:33:52 +0300
commit0355d57fc1159312a131b2e44acb4a0240b2de4e (patch)
tree225b6c5f9904d8699332add3cb0939fb8be68ef2 /sphinx/util
parent7a4bbf372a470700a1dfd96dd57054bb96b92fd3 (diff)
parentab184ac20d82d0546c21f33d2fdfbfb324078d56 (diff)
Merge pull request #6972 from tk0miya/refactor_type_annotation2
mypy: Enable disallow_incomplete_defs flag for type checking
Diffstat (limited to 'sphinx/util')
-rw-r--r--sphinx/util/__init__.py2
-rw-r--r--sphinx/util/compat.py2
-rw-r--r--sphinx/util/docutils.py6
-rw-r--r--sphinx/util/inspect.py2
-rw-r--r--sphinx/util/jsonimpl.py8
-rw-r--r--sphinx/util/logging.py4
-rw-r--r--sphinx/util/nodes.py2
-rw-r--r--sphinx/util/osutil.py2
-rw-r--r--sphinx/util/requests.py8
9 files changed, 19 insertions, 17 deletions
diff --git a/sphinx/util/__init__.py b/sphinx/util/__init__.py
index 5829d47df..2ee286703 100644
--- a/sphinx/util/__init__.py
+++ b/sphinx/util/__init__.py
@@ -482,7 +482,7 @@ def force_decode(string: str, encoding: str) -> str:
class attrdict(dict):
- def __init__(self, *args, **kwargs) -> None:
+ def __init__(self, *args: Any, **kwargs: Any) -> None:
super().__init__(*args, **kwargs)
warnings.warn('The attrdict class is deprecated.',
RemovedInSphinx40Warning, stacklevel=2)
diff --git a/sphinx/util/compat.py b/sphinx/util/compat.py
index 75ef90350..1030d5533 100644
--- a/sphinx/util/compat.py
+++ b/sphinx/util/compat.py
@@ -53,7 +53,7 @@ class IndexEntriesMigrator(SphinxTransform):
"""Migrating indexentries from old style (4columns) to new style (5columns)."""
default_priority = 700
- def apply(self, **kwargs) -> None:
+ def apply(self, **kwargs: Any) -> None:
for node in self.document.traverse(addnodes.index):
for i, entries in enumerate(node['entries']):
if len(entries) == 4:
diff --git a/sphinx/util/docutils.py b/sphinx/util/docutils.py
index 233c1a2aa..564313505 100644
--- a/sphinx/util/docutils.py
+++ b/sphinx/util/docutils.py
@@ -279,7 +279,9 @@ def is_html5_writer_available() -> bool:
return __version_info__ > (0, 13, 0)
-def directive_helper(obj: Any, has_content: bool = None, argument_spec: Tuple[int, int, bool] = None, **option_spec) -> Any: # NOQA
+def directive_helper(obj: Any, has_content: bool = None,
+ argument_spec: Tuple[int, int, bool] = None, **option_spec: Any
+ ) -> Any:
warnings.warn('function based directive support is now deprecated. '
'Use class based directive instead.',
RemovedInSphinx30Warning)
@@ -317,7 +319,7 @@ def switch_source_input(state: State, content: StringList) -> Generator[None, No
class SphinxFileOutput(FileOutput):
"""Better FileOutput class for Sphinx."""
- def __init__(self, **kwargs) -> None:
+ def __init__(self, **kwargs: Any) -> None:
self.overwrite_if_changed = kwargs.pop('overwrite_if_changed', False)
super().__init__(**kwargs)
diff --git a/sphinx/util/inspect.py b/sphinx/util/inspect.py
index 20af75628..4092dd360 100644
--- a/sphinx/util/inspect.py
+++ b/sphinx/util/inspect.py
@@ -224,7 +224,7 @@ def isproperty(obj: Any) -> bool:
return isinstance(obj, property)
-def safe_getattr(obj: Any, name: str, *defargs) -> Any:
+def safe_getattr(obj: Any, name: str, *defargs: Any) -> Any:
"""A getattr() that turns all exceptions into AttributeErrors."""
try:
return getattr(obj, name, *defargs)
diff --git a/sphinx/util/jsonimpl.py b/sphinx/util/jsonimpl.py
index c5336a195..404ea4b02 100644
--- a/sphinx/util/jsonimpl.py
+++ b/sphinx/util/jsonimpl.py
@@ -28,19 +28,19 @@ class SphinxJSONEncoder(json.JSONEncoder):
return super().default(obj)
-def dump(obj: Any, fp: IO, *args, **kwds) -> None:
+def dump(obj: Any, fp: IO, *args: Any, **kwds: Any) -> None:
kwds['cls'] = SphinxJSONEncoder
json.dump(obj, fp, *args, **kwds)
-def dumps(obj: Any, *args, **kwds) -> str:
+def dumps(obj: Any, *args: Any, **kwds: Any) -> str:
kwds['cls'] = SphinxJSONEncoder
return json.dumps(obj, *args, **kwds)
-def load(*args, **kwds) -> Any:
+def load(*args: Any, **kwds: Any) -> Any:
return json.load(*args, **kwds)
-def loads(*args, **kwds) -> Any:
+def loads(*args: Any, **kwds: Any) -> Any:
return json.loads(*args, **kwds)
diff --git a/sphinx/util/logging.py b/sphinx/util/logging.py
index 60a409093..73d89021c 100644
--- a/sphinx/util/logging.py
+++ b/sphinx/util/logging.py
@@ -119,14 +119,14 @@ class SphinxWarningLogRecord(SphinxLogRecord):
class SphinxLoggerAdapter(logging.LoggerAdapter):
"""LoggerAdapter allowing ``type`` and ``subtype`` keywords."""
- def log(self, level: Union[int, str], msg: str, *args, **kwargs) -> None:
+ def log(self, level: Union[int, str], msg: str, *args: Any, **kwargs: Any) -> None:
if isinstance(level, int):
super().log(level, msg, *args, **kwargs)
else:
levelno = LEVEL_NAMES[level]
super().log(levelno, msg, *args, **kwargs)
- def verbose(self, msg: str, *args, **kwargs) -> None:
+ def verbose(self, msg: str, *args: Any, **kwargs: Any) -> None:
self.log(VERBOSE, msg, *args, **kwargs)
def process(self, msg: str, kwargs: Dict) -> Tuple[str, Dict]: # type: ignore
diff --git a/sphinx/util/nodes.py b/sphinx/util/nodes.py
index 53b4d056e..2bfe16597 100644
--- a/sphinx/util/nodes.py
+++ b/sphinx/util/nodes.py
@@ -60,7 +60,7 @@ class NodeMatcher:
# => [<reference ...>, <reference ...>, ...]
"""
- def __init__(self, *classes: "Type[Node]", **attrs) -> None:
+ def __init__(self, *classes: "Type[Node]", **attrs: Any) -> None:
self.classes = classes
self.attrs = attrs
diff --git a/sphinx/util/osutil.py b/sphinx/util/osutil.py
index d74ea20fb..d35d8a129 100644
--- a/sphinx/util/osutil.py
+++ b/sphinx/util/osutil.py
@@ -144,7 +144,7 @@ def make_filename_from_project(project: str) -> str:
return make_filename(project_suffix_re.sub('', project)).lower()
-def ustrftime(format: str, *args) -> str:
+def ustrftime(format: str, *args: Any) -> str:
"""[DEPRECATED] strftime for unicode strings."""
warnings.warn('sphinx.util.osutil.ustrtime is deprecated for removal',
RemovedInSphinx30Warning, stacklevel=2)
diff --git a/sphinx/util/requests.py b/sphinx/util/requests.py
index 4cc73a85f..e5ef40bac 100644
--- a/sphinx/util/requests.py
+++ b/sphinx/util/requests.py
@@ -11,7 +11,7 @@
import sys
import warnings
from contextlib import contextmanager
-from typing import Generator, Union
+from typing import Any, Generator, Union
from urllib.parse import urlsplit
import pkg_resources
@@ -77,7 +77,7 @@ def is_ssl_error(exc: Exception) -> bool:
@contextmanager
-def ignore_insecure_warning(**kwargs) -> Generator[None, None, None]:
+def ignore_insecure_warning(**kwargs: Any) -> Generator[None, None, None]:
with warnings.catch_warnings():
if not kwargs.get('verify') and InsecureRequestWarning:
# ignore InsecureRequestWarning if verify=False
@@ -118,7 +118,7 @@ def _get_user_agent(config: Config) -> str:
])
-def get(url: str, **kwargs) -> requests.Response:
+def get(url: str, **kwargs: Any) -> requests.Response:
"""Sends a GET request like requests.get().
This sets up User-Agent header and TLS verification automatically."""
@@ -134,7 +134,7 @@ def get(url: str, **kwargs) -> requests.Response:
return requests.get(url, **kwargs)
-def head(url: str, **kwargs) -> requests.Response:
+def head(url: str, **kwargs: Any) -> requests.Response:
"""Sends a HEAD request like requests.head().
This sets up User-Agent header and TLS verification automatically."""