Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions stubs/simplejson/@tests/stubtest_allowlist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
simplejson.scanner.make_scanner
simplejson.scanner.JSONDecodeError.__init__
simplejson.encoder.c_make_encoder
simplejson.encoder.c_encode_basestring
simplejson.encoder.py_encode_basestring
simplejson.encoder.c_encode_basestring_ascii
simplejson.encoder.py_encode_basestring_ascii

Expand Down
2 changes: 1 addition & 1 deletion stubs/simplejson/METADATA.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
version = "3.20.*"
version = "4.1.*"
upstream-repository = "https://github.com/simplejson/simplejson"
4 changes: 4 additions & 0 deletions stubs/simplejson/simplejson/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ def loads(
object_pairs_hook: Callable[[list[tuple[Any, Any]]], Any] | None = None,
use_decimal: bool = False,
allow_nan: bool = False,
array_hook: Callable[[list[Any]], Any] | None = None, # transforms a JSON value to an arbitrary value
**kw: Any,
) -> Any: ...
@overload
Expand All @@ -138,6 +139,7 @@ def loads(
object_pairs_hook: Callable[[list[tuple[Any, Any]]], Any] | None = None,
use_decimal: bool = False,
allow_nan: bool = False,
array_hook: Callable[[list[Any]], Any] | None = None, # transforms a JSON value to an arbitrary value
) -> Any: ...

@overload
Expand All @@ -153,6 +155,7 @@ def load(
object_pairs_hook: Callable[[list[tuple[Any, Any]]], Any] | None = None,
use_decimal: bool = False,
allow_nan: bool = False,
array_hook: Callable[[list[Any]], Any] | None = None, # transforms a JSON value to an arbitrary value
**kw: Any,
) -> Any: ...
@overload
Expand All @@ -167,6 +170,7 @@ def load(
object_pairs_hook: Callable[[list[tuple[Any, Any]]], Any] | None = None,
use_decimal: bool = False,
allow_nan: bool = False,
array_hook: Callable[[list[Any]], Any] | None = None, # transforms a JSON value to an arbitrary value
) -> Any: ...

def simple_first(kv: tuple[_T, object]) -> tuple[bool, _T]: ...
Expand Down
10 changes: 9 additions & 1 deletion stubs/simplejson/simplejson/decoder.pyi
Original file line number Diff line number Diff line change
@@ -1,15 +1,22 @@
from _typeshed import Incomplete
from collections.abc import Callable
from re import Match
from typing import Any, Literal

class JSONDecoder:
encoding: str
object_hook: Callable[[dict[Any, Any]], Any] | None
# transforms a list of (key, json_value) pairs to an arbitrary value
object_pairs_hook: Callable[[list[tuple[str, Any]]], Any] | None
parse_float: Callable[[str], Any] | None
parse_int: Callable[[str], Any] | None
parse_constant: Callable[[str], Any] | None
strict: bool
object_pairs_hook: Callable[[list[tuple[Any, Any]]], Any] | None
array_hook: Callable[[list[Any]], Any] | None # transforms a JSON value to an arbitrary value
# They have many parameters, it might be better to use Protocol:
parse_object: Callable[..., tuple[Incomplete, int]]
parse_array: Callable[..., tuple[Incomplete, int]]
parse_string: Callable[..., tuple[Incomplete, int]]
memo: dict[Any, Any]
scan_once: Callable[[str, int], tuple[bool, int]]

Expand All @@ -23,6 +30,7 @@ class JSONDecoder:
strict: bool = True,
object_pairs_hook: Callable[[list[tuple[Any, Any]]], Any] | None = None,
allow_nan: bool = False,
array_hook: Callable[[list[Any]], Any] | None = None, # transforms a JSON value to an arbitrary value
) -> None: ...
def decode(self, s: str, _w: Callable[[str, int], Match[str]] = ..., _PY3: Literal[True] = True) -> Any: ...
def raw_decode(
Expand Down
4 changes: 2 additions & 2 deletions stubs/simplejson/simplejson/encoder.pyi
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import re
from _typeshed import SupportsRichComparison
from collections.abc import Callable, Iterator
from typing import Any, Literal, NoReturn
from typing import Any, NoReturn

ESCAPE: re.Pattern[str]
ESCAPE_ASCII: re.Pattern[str]
Expand Down Expand Up @@ -56,5 +56,5 @@ class JSONEncoder:

class JSONEncoderForHTML(JSONEncoder): ...

def encode_basestring(s: str | bytes, _PY3: Literal[True] = True, _q: str = '"') -> str: ...
def encode_basestring(s: str | bytes, /) -> str: ...
def encode_basestring_ascii(s: str | bytes, /) -> str: ...