From 0f5302b3b50702aba73effcffc7a07ae7742bab1 Mon Sep 17 00:00:00 2001 From: Shahar Evron Date: Tue, 2 Apr 2019 17:40:59 +0300 Subject: [PATCH] Accept bytes as 1st argument of `simplejson.loads` (#2896) --- third_party/2and3/simplejson/__init__.pyi | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/third_party/2and3/simplejson/__init__.pyi b/third_party/2and3/simplejson/__init__.pyi index 452a4ffc7..6221b4efa 100644 --- a/third_party/2and3/simplejson/__init__.pyi +++ b/third_party/2and3/simplejson/__init__.pyi @@ -1,10 +1,13 @@ -from typing import Any, IO, Text +from typing import Any, IO, Text, Union from simplejson.scanner import JSONDecodeError as JSONDecodeError from simplejson.decoder import JSONDecoder as JSONDecoder from simplejson.encoder import JSONEncoder as JSONEncoder, JSONEncoderForHTML as JSONEncoderForHTML +_LoadsString = Union[Text, bytes, bytearray] + + def dumps(obj: Any, *args: Any, **kwds: Any) -> str: ... def dump(obj: Any, fp: IO[str], *args: Any, **kwds: Any) -> None: ... -def loads(s: Text, **kwds: Any) -> Any: ... +def loads(s: _LoadsString, **kwds: Any) -> Any: ... def load(fp: IO[str], **kwds: Any) -> Any: ...