Skip to content

Commit 27efca8

Browse files
committed
Assume Python 3.12 for MyPy type checking
Needed to support modern Numpy
1 parent 00dcb1d commit 27efca8

4 files changed

Lines changed: 11 additions & 11 deletions

File tree

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ enable = ["pypy", "pyodide-prerelease"]
106106

107107
[tool.mypy]
108108
files = ["."]
109-
python_version = "3.10"
109+
python_version = "3.12"
110110
warn_unused_configs = true
111111
show_error_codes = true
112112
disallow_subclassing_any = true

tcod/event.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3127,7 +3127,7 @@ def __getattr__(name: str) -> int:
31273127
FutureWarning,
31283128
stacklevel=2,
31293129
)
3130-
return replacement
3130+
return replacement # type: ignore[return-value]
31313131

31323132
if name.startswith("K_") and len(name) == 3: # noqa: PLR2004
31333133
name = name.upper() # Silently fix single letter key symbols removed from SDL3, these are still deprecated

tcod/path.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -775,7 +775,7 @@ def add_edge(
775775
cost = cost.T
776776
if condition is not None:
777777
condition = condition.T
778-
key = (_as_hashable(cost), _as_hashable(condition)) # type: ignore[arg-type]
778+
key = (_as_hashable(cost), _as_hashable(condition))
779779
try:
780780
rule = self._graph[key]
781781
except KeyError:
@@ -897,16 +897,16 @@ def add_edges(
897897
# edge_map needs to be converted into C.
898898
# The other parameters are converted by the add_edge method.
899899
edge_map = edge_map.T
900-
edge_center = tuple(i // 2 for i in edge_map.shape) # type: ignore[union-attr]
901-
edge_map[edge_center] = 0 # type: ignore[index]
902-
edge_map[edge_map < 0] = 0 # type: ignore[index, operator]
903-
edge_nz = edge_map.nonzero() # type: ignore[union-attr]
904-
edge_costs = edge_map[edge_nz] # type: ignore[index]
900+
edge_center = tuple(i // 2 for i in edge_map.shape)
901+
edge_map[edge_center] = 0
902+
edge_map[edge_map < 0] = 0
903+
edge_nz = edge_map.nonzero()
904+
edge_costs = edge_map[edge_nz]
905905
edge_array = np.transpose(edge_nz)
906906
edge_array -= edge_center
907907
for edge, edge_cost in zip(
908908
edge_array,
909-
edge_costs, # type: ignore[arg-type]
909+
edge_costs,
910910
strict=True,
911911
):
912912
self.add_edge(
@@ -1177,7 +1177,7 @@ def traversal(self) -> NDArray[Any]:
11771177
"""
11781178
if self._order == "F":
11791179
axes = range(self._travel.ndim)
1180-
return self._travel.transpose((*axes[-2::-1], axes[-1]))[..., ::-1] # type: ignore[no-any-return]
1180+
return self._travel.transpose((*axes[-2::-1], axes[-1]))[..., ::-1]
11811181
return self._travel
11821182

11831183
def clear(self) -> None:

tcod/sdl/audio.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ def convert_audio(
189189
out_length,
190190
)
191191
)
192-
return ( # type: ignore[no-any-return]
192+
return (
193193
np.frombuffer(ffi.buffer(out_buffer[0], out_length[0]), dtype=out_format).reshape(-1, out_channels).copy()
194194
)
195195
except RuntimeError as exc:

0 commit comments

Comments
 (0)