Skip to content

Commit

Permalink
use typing.Buffer
Browse files Browse the repository at this point in the history
  • Loading branch information
trim21 committed Sep 21, 2024
1 parent cd347aa commit fb3f976
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions msgspec/msgpack.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ from typing import (
overload,
)

from typing_extensions import Buffer


T = TypeVar("T")

enc_hook_sig = Optional[Callable[[Any], Any]]
Expand Down Expand Up @@ -54,7 +57,7 @@ class Decoder(Generic[T]):
dec_hook: dec_hook_sig = None,
ext_hook: ext_hook_sig = None,
) -> None: ...
def decode(self, data: bytes | memoryview) -> T: ...
def decode(self, data: Buffer) -> T: ...

class Encoder:
enc_hook: enc_hook_sig
Expand All @@ -76,15 +79,15 @@ class Encoder:

@overload
def decode(
buf: bytes | memoryview,
buf: Buffer,
*,
strict: bool = True,
dec_hook: dec_hook_sig = None,
ext_hook: ext_hook_sig = None,
) -> Any: ...
@overload
def decode(
buf: bytes | memoryview,
buf: Buffer,
*,
type: Type[T] = ...,
strict: bool = True,
Expand All @@ -93,7 +96,7 @@ def decode(
) -> T: ...
@overload
def decode(
buf: bytes | memoryview,
buf: Buffer,
*,
type: Any = ...,
strict: bool = True,
Expand Down

0 comments on commit fb3f976

Please sign in to comment.