Skip to content
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

Fix type hints for optional arguments #74

Merged
merged 1 commit into from
Dec 6, 2023
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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

**1.6.5 (2023-12-04)**

* Fix type hints for optional arguments

**1.6.4 (2023-07-31)**

* Update to Cython 3
Expand Down
2 changes: 1 addition & 1 deletion requirements-readthedocs.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# keep synchronous to setup.cfg
# keep synchronous to src/VERSION.inc
pyjson5 == 1.6.4
pyjson5 == 1.6.5

# keep synchronous to requirements-dev.txt
docutils == 0.19.*
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[metadata]
# keep synchronous to requirements-readthedocs.txt
# keep synchronous to src/VERSION.inc
version = 1.6.4
version = 1.6.5

name = pyjson5
description = JSON5 serializer and parser for Python 3 written in Cython.
Expand Down
2 changes: 1 addition & 1 deletion src/VERSION.inc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
"1.6.4"
"1.6.5"
40 changes: 20 additions & 20 deletions src/pyjson5/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,15 @@ class Options:
self,
*,
quotationmark: Optional[str] = ...,
tojson: Optional[str],
mappingtypes: Optional[Tuple[type, ...]],
tojson: Optional[str] = ...,
mappingtypes: Optional[Tuple[type, ...]] = ...,
) -> None: ...
def update(
self,
*,
quotationmark: Optional[str] = ...,
tojson: Optional[str],
mappingtypes: Optional[Tuple[type, ...]],
tojson: Optional[str] = ...,
mappingtypes: Optional[Tuple[type, ...]] = ...,
) -> Options:
"""Creates a new Options instance by modifying some members."""

Expand Down Expand Up @@ -86,7 +86,7 @@ def decode_callback(
cb: Callable[..., Union[str, bytes, bytearray, int, None]],
maxdepth: Optional[int] = ...,
some: bool = ...,
args: Optional[Iterable[Any]] = [],
args: Optional[Iterable[Any]] = ...,
) -> Any:
"""Decodes JSON5 serialized data by invoking a callback."""

Expand All @@ -102,8 +102,8 @@ def encode(
*,
options: Optional[Options] = ...,
quotationmark: Optional[str] = ...,
tojson: Optional[str],
mappingtypes: Optional[Tuple[type, ...]],
tojson: Optional[str] = ...,
mappingtypes: Optional[Tuple[type, ...]] = ...,
) -> str:
"""Serializes a Python object to a JSON5 compatible string."""
...
Expand All @@ -113,9 +113,9 @@ def encode_bytes(
*,
options: Optional[Options] = ...,
quotationmark: Optional[str] = ...,
tojson: Optional[str],
mappingtypes: Optional[Tuple[type, ...]],
) -> str:
tojson: Optional[str] = ...,
mappingtypes: Optional[Tuple[type, ...]] = ...,
) -> bytes:
"""Serializes a Python object to a JSON5 compatible bytes string."""

@overload
Expand All @@ -126,8 +126,8 @@ def encode_callback(
*,
options: Optional[Options] = ...,
quotationmark: Optional[str] = ...,
tojson: Optional[str],
mappingtypes: Optional[Tuple[type, ...]],
tojson: Optional[str] = ...,
mappingtypes: Optional[Tuple[type, ...]] = ...,
) -> _CallbackStr:
"""Serializes a Python object into a callback function."""

Expand All @@ -139,8 +139,8 @@ def encode_callback(
*,
options: Optional[Options] = ...,
quotationmark: Optional[str] = ...,
tojson: Optional[str],
mappingtypes: Optional[Tuple[type, ...]],
tojson: Optional[str] = ...,
mappingtypes: Optional[Tuple[type, ...]] = ...,
) -> _CallbackBytes: ...
@overload
def encode_io(
Expand All @@ -150,8 +150,8 @@ def encode_io(
*,
options: Optional[Options] = ...,
quotationmark: Optional[str] = ...,
tojson: Optional[str],
mappingtypes: Optional[Tuple[type, ...]],
tojson: Optional[str] = ...,
mappingtypes: Optional[Tuple[type, ...]] = ...,
) -> _SupportsWriteBytes:
"""Serializes a Python object into a file-object."""

Expand All @@ -163,16 +163,16 @@ def encode_io(
*,
options: Optional[Options] = ...,
quotationmark: Optional[str] = ...,
tojson: Optional[str],
mappingtypes: Optional[Tuple[type, ...]],
tojson: Optional[str] = ...,
mappingtypes: Optional[Tuple[type, ...]] = ...,
) -> _SupportsWriteStr: ...
def encode_noop(
data: Any,
*,
options: Optional[Options] = ...,
quotationmark: Optional[str] = ...,
tojson: Optional[str],
mappingtypes: Optional[Tuple[type, ...]],
tojson: Optional[str] = ...,
mappingtypes: Optional[Tuple[type, ...]] = ...,
) -> bool:
"""Test if the input is serializable."""

Expand Down