diff --git a/msgspec/json.pyi b/msgspec/json.pyi index 450f31e6..75365d60 100644 --- a/msgspec/json.pyi +++ b/msgspec/json.pyi @@ -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]): @@ -75,12 +75,13 @@ 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, @@ -88,6 +89,7 @@ def decode( @overload def decode( buf: Union[Buffer, str], + /, *, type: Type[T] = ..., strict: bool = True, @@ -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], @@ -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: ... diff --git a/msgspec/msgpack.pyi b/msgspec/msgpack.pyi index 7e77f747..1321571d 100644 --- a/msgspec/msgpack.pyi +++ b/msgspec/msgpack.pyi @@ -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 @@ -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, @@ -88,6 +89,7 @@ def decode( @overload def decode( buf: Buffer, + /, *, type: Type[T] = ..., strict: bool = True, @@ -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: ...