Skip to content

Remove Python 2 support from simplejson #7704

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 27, 2022
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
1 change: 0 additions & 1 deletion stubs/simplejson/METADATA.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
version = "3.17.*"
python2 = true
4 changes: 2 additions & 2 deletions stubs/simplejson/simplejson/__init__.pyi
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
from typing import IO, Any, Text
from typing import IO, Any
from typing_extensions import TypeAlias

from simplejson.decoder import JSONDecoder as JSONDecoder
from simplejson.encoder import JSONEncoder as JSONEncoder, JSONEncoderForHTML as JSONEncoderForHTML
from simplejson.raw_json import RawJSON as RawJSON
from simplejson.scanner import JSONDecodeError as JSONDecodeError

_LoadsString: TypeAlias = Text | bytes | bytearray
_LoadsString: TypeAlias = str | bytes | bytearray
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I understand correctly, the explicit | bytearray isn't necessary.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PEP 688 would make it necessary again.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or rather, we could possibly switch to types.Buffer (needs investigating).


def dumps(obj: Any, *args: Any, **kwds: Any) -> str: ...
def dump(obj: Any, fp: IO[str], *args: Any, **kwds: Any) -> None: ...
Expand Down
2 changes: 1 addition & 1 deletion stubs/simplejson/simplejson/decoder.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from typing import Any, Match

class JSONDecoder(object):
class JSONDecoder:
def __init__(self, **kwargs: Any) -> None: ...
def decode(self, s: str, _w: Match[str], _PY3: bool): ...
def raw_decode(self, s: str, idx: int, _w: Match[str], _PY3: bool): ...
2 changes: 1 addition & 1 deletion stubs/simplejson/simplejson/encoder.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from typing import Any

class JSONEncoder(object):
class JSONEncoder:
def __init__(self, *args: Any, **kwargs: Any) -> None: ...
def encode(self, o: Any): ...
def default(self, o: Any): ...
Expand Down
2 changes: 1 addition & 1 deletion stubs/simplejson/simplejson/raw_json.pyi
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
class RawJSON(object):
class RawJSON:
encoded_json: str
def __init__(self, encoded_json: str) -> None: ...