From 7b019ce1491635fa7a3646af3f88ed489b329a81 Mon Sep 17 00:00:00 2001 From: Yohann D'ANELLO Date: Mon, 11 Jan 2021 01:21:52 +0100 Subject: [PATCH] Linting --- squirrelbattle/mapgeneration/broguelike.py | 22 +++++++++++----------- squirrelbattle/tests/game_test.py | 2 -- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/squirrelbattle/mapgeneration/broguelike.py b/squirrelbattle/mapgeneration/broguelike.py index 62c8b03..973485b 100644 --- a/squirrelbattle/mapgeneration/broguelike.py +++ b/squirrelbattle/mapgeneration/broguelike.py @@ -24,10 +24,10 @@ DEFAULT_PARAMS = { "loop_max": 5, "loop_threshold": 15, "spawn_per_region": [1, 2], - "room_chances" : { - "circular" : 5, - "chunks" : 1, - }, + "room_chances": { + "circular": 5, + "chunks": 1, + }, } @@ -269,19 +269,19 @@ class Generator: nb_chunks, r = 6, 3 h_sup, w_sup, h_off, w_off = self.corr_meta_info() - room = [[Tile.EMPTY] * (width + w_sup) \ + room = [[Tile.EMPTY] * (width + w_sup) for _dummy in range(height + h_sup)] - def draw_chunk(room, y, x): + def draw_chunk(room: List[List[Tile]], y: int, x: int) -> None: for i in range(y - r, y + r + 1): d = (y - i)**2 for j in range(x - r, x + r + 1): - if d + (x - j)**2 < r**2: + if d + (x - j) ** 2 < r ** 2: room[i][j] = Tile.FLOOR - draw_chunk(room, h_off + height//2 + 1, w_off + width//2 + 1) + draw_chunk(room, h_off + height // 2 + 1, w_off + width // 2 + 1) - min_w, max_w = w_off + r + 1, width + w_off - r -1 + min_w, max_w = w_off + r + 1, width + w_off - r - 1 min_h, max_h = h_off + r + 1, height + h_off - r - 1 for i in range(nb_chunks): y, x = randint(min_h, max_h), randint(min_w, max_w) @@ -359,9 +359,9 @@ class Generator: break if key == "circular": - return self.create_circular_room(spawnable = spawnable) + return self.create_circular_room(spawnable=spawnable) elif key == "chunks": - return self.create_chunk_room(spawnable = spawnable) + return self.create_chunk_room(spawnable=spawnable) def register_spawn_area(self, area: List[List[Tile]]) -> None: """ diff --git a/squirrelbattle/tests/game_test.py b/squirrelbattle/tests/game_test.py index 4f80977..e5573ec 100644 --- a/squirrelbattle/tests/game_test.py +++ b/squirrelbattle/tests/game_test.py @@ -2,7 +2,6 @@ # SPDX-License-Identifier: GPL-3.0-or-later import curses -import os import unittest from ..bootstrap import Bootstrap @@ -101,7 +100,6 @@ class TestGame(unittest.TestCase): Yeah, that's only for coverage. """ self.assertRaises(Exception, Bootstrap.run_game) - self.assertEqual(os.getenv("TERM", "unknown"), "unknown") def test_key_translation(self) -> None: """