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
19 changes: 11 additions & 8 deletions msgspec/json.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ class Encoder:
uuid_format: Literal["canonical", "hex"] = "canonical",
order: Literal[None, "deterministic", "sorted"] = None,
): ...
def encode(self, obj: Any) -> bytes: ...
def encode_lines(self, items: Iterable) -> bytes: ...
def encode(self, obj: Any, /) -> bytes: ...
def encode_lines(self, items: Iterable, /) -> bytes: ...
def encode_into(
self, obj: Any, buffer: bytearray, offset: Optional[int] = 0
self, obj: Any, buffer: bytearray, offset: Optional[int] = 0, /
) -> None: ...

class Decoder(Generic[T]):
Expand Down Expand Up @@ -75,19 +75,21 @@ class Decoder(Generic[T]):
dec_hook: dec_hook_sig = None,
float_hook: float_hook_sig = None,
) -> None: ...
def decode(self, data: Union[Buffer, str]) -> T: ...
def decode_lines(self, data: Union[Buffer, str]) -> list[T]: ...
def decode(self, buf: Union[Buffer, str], /) -> T: ...
def decode_lines(self, buf: Union[Buffer, str], /) -> list[T]: ...

@overload
def decode(
buf: Union[Buffer, str],
/,
*,
strict: bool = True,
dec_hook: dec_hook_sig = None,
) -> Any: ...
@overload
def decode(
buf: Union[Buffer, str],
/,
*,
type: Type[T] = ...,
strict: bool = True,
Expand All @@ -96,12 +98,13 @@ def decode(
@overload
def decode(
buf: Union[Buffer, str],
/,
*,
type: Any = ...,
strict: bool = True,
dec_hook: dec_hook_sig = None,
) -> Any: ...
def encode(obj: Any, *, enc_hook: enc_hook_sig = None, order: Literal[None, "deterministic", "sorted"] = None) -> bytes: ...
def encode(obj: Any, /, *, enc_hook: enc_hook_sig = None, order: Literal[None, "deterministic", "sorted"] = None) -> bytes: ...
def schema(type: Any, *, schema_hook: schema_hook_sig = None) -> Dict[str, Any]: ...
def schema_components(
types: Iterable[Any],
Expand All @@ -110,6 +113,6 @@ def schema_components(
ref_template: str = "#/$defs/{name}"
) -> Tuple[Tuple[Dict[str, Any], ...], Dict[str, Any]]: ...
@overload
def format(buf: str, *, indent: int = 2) -> str: ...
def format(buf: str, /, *, indent: int = 2) -> str: ...
@overload
def format(buf: Buffer, *, indent: int = 2) -> bytes: ...
def format(buf: Buffer, /, *, indent: int = 2) -> bytes: ...
11 changes: 7 additions & 4 deletions msgspec/msgpack.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class Decoder(Generic[T]):
dec_hook: dec_hook_sig = None,
ext_hook: ext_hook_sig = None,
) -> None: ...
def decode(self, data: Buffer) -> T: ...
def decode(self, buf: Buffer, /) -> T: ...

class Encoder:
enc_hook: enc_hook_sig
Expand All @@ -72,14 +72,15 @@ class Encoder:
uuid_format: Literal["canonical", "hex", "bytes"] = "canonical",
order: Literal[None, "deterministic", "sorted"] = None,
): ...
def encode(self, obj: Any) -> bytes: ...
def encode(self, obj: Any, /) -> bytes: ...
def encode_into(
self, obj: Any, buffer: bytearray, offset: Optional[int] = 0
self, obj: Any, buffer: bytearray, offset: Optional[int] = 0, /
) -> None: ...

@overload
def decode(
buf: Buffer,
/,
*,
strict: bool = True,
dec_hook: dec_hook_sig = None,
Expand All @@ -88,6 +89,7 @@ def decode(
@overload
def decode(
buf: Buffer,
/,
*,
type: Type[T] = ...,
strict: bool = True,
Expand All @@ -97,10 +99,11 @@ def decode(
@overload
def decode(
buf: Buffer,
/,
*,
type: Any = ...,
strict: bool = True,
dec_hook: dec_hook_sig = None,
ext_hook: ext_hook_sig = None,
) -> Any: ...
def encode(obj: Any, *, enc_hook: enc_hook_sig = None, order: Literal[None, "deterministic", "sorted"] = None) -> bytes: ...
def encode(obj: Any, /, *, enc_hook: enc_hook_sig = None, order: Literal[None, "deterministic", "sorted"] = None) -> bytes: ...
Loading