Skip to content

Commit

Permalink
Merge pull request #74 from Kijewski/pr-typing
Browse files Browse the repository at this point in the history
Fix type hints for optional arguments
  • Loading branch information
Kijewski authored Dec 6, 2023
2 parents 8441390 + c0cc1cd commit 8deb843
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 23 deletions.
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

0 comments on commit 8deb843

Please sign in to comment.