diff options
author | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2020-03-07 20:43:25 +0900 |
---|---|---|
committer | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2020-04-29 15:12:39 +0900 |
commit | a86346aca6bf99a8920da366caaad7c47809ecce (patch) | |
tree | 7aa786e7817f9f3e6a338d06df2f02534d91a4c5 /sphinx/util/jsonimpl.py | |
parent | aa773cbc88e692df731c78353a1043201bcb9f91 (diff) | |
download | sphinx-git-a86346aca6bf99a8920da366caaad7c47809ecce.tar.gz |
Remove deprecated features marked as RemovedInSphinx40Warning
Diffstat (limited to 'sphinx/util/jsonimpl.py')
-rw-r--r-- | sphinx/util/jsonimpl.py | 46 |
1 files changed, 0 insertions, 46 deletions
diff --git a/sphinx/util/jsonimpl.py b/sphinx/util/jsonimpl.py deleted file mode 100644 index 35501f03a..000000000 --- a/sphinx/util/jsonimpl.py +++ /dev/null @@ -1,46 +0,0 @@ -""" - sphinx.util.jsonimpl - ~~~~~~~~~~~~~~~~~~~~ - - JSON serializer implementation wrapper. - - :copyright: Copyright 2007-2020 by the Sphinx team, see AUTHORS. - :license: BSD, see LICENSE for details. -""" - -import json -import warnings -from collections import UserString -from typing import Any, IO - -from sphinx.deprecation import RemovedInSphinx40Warning - - -warnings.warn('sphinx.util.jsonimpl is deprecated', - RemovedInSphinx40Warning, stacklevel=2) - - -class SphinxJSONEncoder(json.JSONEncoder): - """JSONEncoder subclass that forces translation proxies.""" - def default(self, obj: Any) -> str: - if isinstance(obj, UserString): - return str(obj) - return super().default(obj) - - -def dump(obj: Any, fp: IO, *args: Any, **kwargs: Any) -> None: - kwargs['cls'] = SphinxJSONEncoder - json.dump(obj, fp, *args, **kwargs) - - -def dumps(obj: Any, *args: Any, **kwargs: Any) -> str: - kwargs['cls'] = SphinxJSONEncoder - return json.dumps(obj, *args, **kwargs) - - -def load(*args: Any, **kwargs: Any) -> Any: - return json.load(*args, **kwargs) - - -def loads(*args: Any, **kwargs: Any) -> Any: - return json.loads(*args, **kwargs) |