json: mark keyword-only args, remove deprecated arg (#3756)

* json: mark keyword-only args

Technically only true for Python 3.6+, but I didn't feel like copying
over the whole file just for Python 3.5. Let me know and I can.

* json: remove encoding from loads

This has been ignored and deprecated since 3.1 and will be removed in 3.9
It no longer even shows up in inspect.signature (in 3.8 it emits the
deprecation warning based on kwargs)

* json: update whitelists
This commit is contained in:
Shantanu
2020-02-21 21:21:32 -08:00
committed by GitHub
parent d104386b40
commit 003fc6fa31
5 changed files with 8 additions and 13 deletions

View File

@@ -6,6 +6,7 @@ from .encoder import JSONEncoder as JSONEncoder
from .decoder import JSONDecodeError as JSONDecodeError
def dumps(obj: Any,
*,
skipkeys: bool = ...,
ensure_ascii: bool = ...,
check_circular: bool = ...,
@@ -19,6 +20,7 @@ def dumps(obj: Any,
def dump(obj: Any,
fp: IO[str],
*,
skipkeys: bool = ...,
ensure_ascii: bool = ...,
check_circular: bool = ...,
@@ -35,7 +37,7 @@ if sys.version_info >= (3, 6):
else:
_LoadsString = str
def loads(s: _LoadsString,
encoding: Any = ..., # ignored and deprecated
*,
cls: Optional[Type[JSONDecoder]] = ...,
object_hook: Optional[Callable[[Dict[Any, Any]], Any]] = ...,
parse_float: Optional[Callable[[str], Any]] = ...,
@@ -48,6 +50,7 @@ class _Reader(Protocol):
def read(self) -> _LoadsString: ...
def load(fp: _Reader,
*,
cls: Optional[Type[JSONDecoder]] = ...,
object_hook: Optional[Callable[[Dict[Any, Any]], Any]] = ...,
parse_float: Optional[Callable[[str], Any]] = ...,