diff options
author | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2019-06-15 16:45:17 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-06-15 16:45:17 +0900 |
commit | f6dfab33d29cd389c791acf5821adf556df5ca17 (patch) | |
tree | 07ecbae0a006a51567648553cfaa1f03fe6cbdc4 /sphinx/util/jsonimpl.py | |
parent | 8fd817d174aed3c6655190f904b89f6f7f2ec099 (diff) | |
parent | 5cf84a5505a6063b48e7fcc4d489259ade526912 (diff) | |
download | sphinx-git-f6dfab33d29cd389c791acf5821adf556df5ca17.tar.gz |
Merge branch '2.0' into refactor_todo2
Diffstat (limited to 'sphinx/util/jsonimpl.py')
-rw-r--r-- | sphinx/util/jsonimpl.py | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/sphinx/util/jsonimpl.py b/sphinx/util/jsonimpl.py index 4fb8e1f5d..c5336a195 100644 --- a/sphinx/util/jsonimpl.py +++ b/sphinx/util/jsonimpl.py @@ -11,13 +11,10 @@ import json import warnings from collections import UserString +from typing import Any, IO from sphinx.deprecation import RemovedInSphinx40Warning -if False: - # For type annotation - from typing import Any, IO # NOQA - warnings.warn('sphinx.util.jsonimpl is deprecated', RemovedInSphinx40Warning, stacklevel=2) @@ -25,30 +22,25 @@ warnings.warn('sphinx.util.jsonimpl is deprecated', class SphinxJSONEncoder(json.JSONEncoder): """JSONEncoder subclass that forces translation proxies.""" - def default(self, obj): - # type: (Any) -> str + def default(self, obj: Any) -> str: if isinstance(obj, UserString): return str(obj) return super().default(obj) -def dump(obj, fp, *args, **kwds): - # type: (Any, IO, Any, Any) -> None +def dump(obj: Any, fp: IO, *args, **kwds) -> None: kwds['cls'] = SphinxJSONEncoder json.dump(obj, fp, *args, **kwds) -def dumps(obj, *args, **kwds): - # type: (Any, Any, Any) -> str +def dumps(obj: Any, *args, **kwds) -> str: kwds['cls'] = SphinxJSONEncoder return json.dumps(obj, *args, **kwds) -def load(*args, **kwds): - # type: (Any, Any) -> Any +def load(*args, **kwds) -> Any: return json.load(*args, **kwds) -def loads(*args, **kwds): - # type: (Any, Any) -> Any +def loads(*args, **kwds) -> Any: return json.loads(*args, **kwds) |