Skip to content

Commit

Permalink
pre-commit update
Browse files Browse the repository at this point in the history
  • Loading branch information
HexDecimal committed Aug 16, 2024
1 parent a8f66fc commit b033bf2
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ repos:
- id: fix-byte-order-marker
- id: detect-private-key
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.5.6
rev: v0.6.0
hooks:
- id: ruff
args: [--fix-only, --exit-non-zero-on-fix]
Expand Down
3 changes: 1 addition & 2 deletions examples/samples_tcod.py
Original file line number Diff line number Diff line change
Expand Up @@ -726,8 +726,7 @@ def on_draw(self) -> None:
for y in range(SAMPLE_SCREEN_HEIGHT):
for x in range(SAMPLE_SCREEN_WIDTH):
d = libtcodpy.dijkstra_get_distance(self.dijkstra, x, y)
if d > self.dijkstra_dist:
self.dijkstra_dist = d
self.dijkstra_dist = max(d, self.dijkstra_dist)
# compute path from px,py to dx,dy
libtcodpy.dijkstra_path_set(self.dijkstra, self.dx, self.dy)
self.recalculate = False
Expand Down
10 changes: 5 additions & 5 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def pytest_addoption(parser: pytest.Parser) -> None:
parser.addoption("--no-window", action="store_true", help="Skip tests which need a rendering context.")


@pytest.fixture()
@pytest.fixture
def uses_window(request: pytest.FixtureRequest) -> Iterator[None]:
"""Marks tests which require a rendering context."""
if request.config.getoption("--no-window"):
Expand All @@ -40,7 +40,7 @@ def session_console(request: pytest.FixtureRequest) -> Iterator[tcod.console.Con
yield con


@pytest.fixture()
@pytest.fixture
def console(session_console: tcod.console.Console) -> tcod.console.Console:
console = session_console
tcod.console_flush()
Expand All @@ -54,18 +54,18 @@ def console(session_console: tcod.console.Console) -> tcod.console.Console:
return console


@pytest.fixture()
@pytest.fixture
def offscreen(console: tcod.console.Console) -> tcod.console.Console:
"""Return an off-screen console with the same size as the root console."""
return tcod.console.Console(console.width, console.height)


@pytest.fixture()
@pytest.fixture
def fg() -> tcod.Color:
return tcod.Color(random.randint(0, 255), random.randint(0, 255), random.randint(0, 255))


@pytest.fixture()
@pytest.fixture
def bg() -> tcod.Color:
return tcod.Color(random.randint(0, 255), random.randint(0, 255), random.randint(0, 255))

Expand Down
4 changes: 2 additions & 2 deletions tests/test_libtcodpy.py
Original file line number Diff line number Diff line change
Expand Up @@ -660,15 +660,15 @@ def test_heightmap() -> None:
POINTS_AC = POINT_A + POINT_C # invalid path


@pytest.fixture()
@pytest.fixture
def map_() -> Iterator[tcod.map.Map]:
map_ = tcod.map.Map(MAP_WIDTH, MAP_HEIGHT)
map_.walkable[...] = map_.transparent[...] = MAP[...] == " "
yield map_
libtcodpy.map_delete(map_)


@pytest.fixture()
@pytest.fixture
def path_callback(map_: tcod.map.Map) -> Callable[[int, int, int, int, None], bool]:
def callback(ox: int, oy: int, dx: int, dy: int, user_data: None) -> bool:
return bool(map_.walkable[dy, dx])
Expand Down

0 comments on commit b033bf2

Please sign in to comment.