Skip to content
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
10 changes: 5 additions & 5 deletions megstore/indexed/msgpack.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def __init__(self, *args, **kwargs):

def _read_array_header(
self,
unpacker: "compat_msgpack.Unpacker", # pytype: disable=attribute-error
unpacker: "compat_msgpack.Unpacker", # type: ignore
) -> int:
try:
return unpacker.read_array_header()
Expand All @@ -79,7 +79,7 @@ def _read_array_header(
@classmethod
def _build_index(
cls,
fp_data: BinaryIO,
file_object: BinaryIO,
offsets: Union[IndexHandlerReader, array],
index_build_callback: Optional[Callable[[Any], None]] = None,
) -> int:
Expand All @@ -88,8 +88,8 @@ def _build_index(
:raises ValueError: Cannot read valid msgpack array header from msgpack stream
:returns: the latest offset
"""
unpacker = cls._get_msgpack_unpacker(fp_data)
cls._read_array_header(fp_data, unpacker) # pytype: disable=wrong-arg-count
unpacker = cls._get_msgpack_unpacker(file_object)
cls._read_array_header(file_object, unpacker) # type: ignore

# After reading array header, unpacker is at the start byte of the first value
current_offset = unpacker.tell()
Expand Down Expand Up @@ -171,7 +171,7 @@ def _batch_get(self, index_slice: slice) -> Iterator[T]:
@classmethod
def _get_msgpack_unpacker(
cls, file_object: BinaryIO, max_buffer_size: Optional[int] = None
) -> "compat_msgpack.Unpacker": # pytype: disable=attribute-error
) -> "compat_msgpack.Unpacker": # type: ignore
"""Get an Unpacker object created with the current instance's msgpack stream

:param max_buffer_size: Maximum buffer size of Unpacker object (bytes),
Expand Down
Loading