Skip to content

Commit 91c06c9

Browse files
horghclaude
andcommitted
Annotate node_bytes type for mypy 2.0.0
mypy 2.0.0 narrows node_bytes to bytes from the 24-bit branch's assignment and rejects the bytearray reassignment and mutation in the 28-bit branch. Widen the declared type to cover both. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 1c32402 commit 91c06c9

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

maxminddb/reader.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,7 @@ def _read_node(self, node_number: int, index: int) -> int:
220220
base_offset = node_number * self._metadata.node_byte_size
221221

222222
record_size = self._metadata.record_size
223+
node_bytes: bytes | bytearray
223224
if record_size == 24:
224225
offset = base_offset + index * 3
225226
node_bytes = b"\x00" + self._buffer[offset : offset + 3]

0 commit comments

Comments
 (0)