Skip to content

plistlib: improve bytes handling #9048

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 2 commits into from
Nov 1, 2022
Merged
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
14 changes: 8 additions & 6 deletions stdlib/plistlib.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import sys
from _typeshed import Self
from _typeshed import ReadableBuffer, Self
from collections.abc import Mapping, MutableMapping
from datetime import datetime
from enum import Enum
Expand Down Expand Up @@ -48,7 +48,9 @@ FMT_BINARY = PlistFormat.FMT_BINARY

if sys.version_info >= (3, 9):
def load(fp: IO[bytes], *, fmt: PlistFormat | None = ..., dict_type: type[MutableMapping[str, Any]] = ...) -> Any: ...
def loads(value: bytes, *, fmt: PlistFormat | None = ..., dict_type: type[MutableMapping[str, Any]] = ...) -> Any: ...
def loads(
value: ReadableBuffer, *, fmt: PlistFormat | None = ..., dict_type: type[MutableMapping[str, Any]] = ...
) -> Any: ...

else:
def load(
Expand All @@ -59,23 +61,23 @@ else:
dict_type: type[MutableMapping[str, Any]] = ...,
) -> Any: ...
def loads(
value: bytes,
value: ReadableBuffer,
*,
fmt: PlistFormat | None = ...,
use_builtin_types: bool = ...,
dict_type: type[MutableMapping[str, Any]] = ...,
) -> Any: ...

def dump(
value: Mapping[str, Any] | list[Any] | tuple[Any, ...] | str | bool | float | bytes | datetime,
value: Mapping[str, Any] | list[Any] | tuple[Any, ...] | str | bool | float | bytes | bytearray | datetime,
fp: IO[bytes],
*,
fmt: PlistFormat = ...,
sort_keys: bool = ...,
skipkeys: bool = ...,
) -> None: ...
def dumps(
value: Mapping[str, Any] | list[Any] | tuple[Any, ...] | str | bool | float | bytes | datetime,
value: Mapping[str, Any] | list[Any] | tuple[Any, ...] | str | bool | float | bytes | bytearray | datetime,
*,
fmt: PlistFormat = ...,
skipkeys: bool = ...,
Expand All @@ -85,7 +87,7 @@ def dumps(
if sys.version_info < (3, 9):
def readPlist(pathOrFile: str | IO[bytes]) -> Any: ...
def writePlist(value: Mapping[str, Any], pathOrFile: str | IO[bytes]) -> None: ...
def readPlistFromBytes(data: bytes) -> Any: ...
def readPlistFromBytes(data: ReadableBuffer) -> Any: ...
def writePlistToBytes(value: Mapping[str, Any]) -> bytes: ...

if sys.version_info < (3, 9):
Expand Down