Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
fix lint
  • Loading branch information
peasoft committed Jan 2, 2026
commit b9d495db407fad56939d8a04dbf590f54c7fe642
4 changes: 2 additions & 2 deletions msgpack/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def pack(o: t.Any, stream: t.BinaryIO, **kwargs: dict[str, t.Any]):

See :class:`Packer` for options.
"""
packer = Packer(autoreset=True, **kwargs) # type: ignore
packer = Packer(autoreset=True, **kwargs) # type: ignore
stream.write(t.cast(bytes, packer.pack(o)))


Expand All @@ -35,7 +35,7 @@ def packb(o: t.Any, **kwargs: dict[str, t.Any]):

See :class:`Packer` for options.
"""
return Packer(autoreset=True, **kwargs).pack(o) # type: ignore
return Packer(autoreset=True, **kwargs).pack(o) # type: ignore


def unpack(stream: t.BinaryIO, **kwargs: dict[str, t.Any]):
Expand Down
3 changes: 2 additions & 1 deletion msgpack/ext.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

class ExtType(namedtuple("ExtType", "code data")):
"""ExtType represents ext type in msgpack."""

code: int
data: bytes

Expand All @@ -16,7 +17,7 @@ def __new__(cls, code: int, data: bytes):
raise TypeError("data must be bytes")
if not 0 <= code <= 127:
raise ValueError("code must be 0~127")
return super().__new__(cls, code, data) # type: ignore
return super().__new__(cls, code, data) # type: ignore


class Timestamp:
Expand Down
11 changes: 6 additions & 5 deletions msgpack/fallback.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from collections.abc import Sequence
from datetime import datetime as _DateTime

_ClassInfo: t.TypeAlias = type | types.UnionType | tuple['_ClassInfo', ...]
_ClassInfo: t.TypeAlias = type | types.UnionType | tuple["_ClassInfo", ...]
_Pair = tuple[t.Any, t.Any]
_Pairs = t.Iterable[_Pair]
_SizeFmt = tuple[int, str]
Expand Down Expand Up @@ -90,7 +90,7 @@ def unpackb(packed: bytes, **kwargs: dict[str, t.Any]):

See :class:`Unpacker` for options.
"""
unpacker = Unpacker(None, max_buffer_size=len(packed), **kwargs) # type: ignore
unpacker = Unpacker(None, max_buffer_size=len(packed), **kwargs) # type: ignore
unpacker.feed(packed)
try:
ret = unpacker._unpack()
Expand Down Expand Up @@ -528,19 +528,20 @@ def _unpack(self, execute=EX_CONSTRUCT):
return
if self._object_pairs_hook is not None:
ret = self._object_pairs_hook(
(self._unpack(EX_CONSTRUCT), self._unpack(EX_CONSTRUCT)) for _ in range(n) # type: ignore
(self._unpack(EX_CONSTRUCT), self._unpack(EX_CONSTRUCT))
for _ in range(n) # type: ignore
)
else:
ret = {}
for _ in range(n):
key = self._unpack(EX_CONSTRUCT)
if self._strict_map_key and type(key) not in (str, bytes):
raise ValueError("%s is not allowed for map key" % str(type(key))) # type: ignore
raise ValueError("%s is not allowed for map key" % str(type(key))) # type: ignore
if isinstance(key, str):
key = sys.intern(key)
ret[key] = self._unpack(EX_CONSTRUCT)
if self._object_hook is not None:
ret = self._object_hook(ret) # type: ignore
ret = self._object_hook(ret) # type: ignore
return ret
if execute == EX_SKIP:
return
Expand Down