From: Christian Heller Date: Thu, 26 Nov 2020 20:28:45 +0000 (+0100) Subject: Fix various minor, mostly "unused" flake8 complaints. X-Git-Url: https://plomlompom.com/repos/%22https:/validator.w3.org/%7B%7Bprefix%7D%7D/%7B%7Btodo.comment%7D%7D?a=commitdiff_plain;h=3efcac66212325fecbbf28e3c19762821fb65d76;p=plomrogue2 Fix various minor, mostly "unused" flake8 complaints. --- diff --git a/plomrogue/commands.py b/plomrogue/commands.py index a4507b1..0c3da0a 100644 --- a/plomrogue/commands.py +++ b/plomrogue/commands.py @@ -1,13 +1,11 @@ from plomrogue.misc import quote from plomrogue.errors import GameError -from plomrogue.mapping import YX, MapGeometrySquare, MapGeometryHex, DijkstraMap # TODO: instead of sending tasks, thing types etc. on request, send them on connection def cmd_TASKS(game, connection_id): - tasks = [] game.io.send('TASKS ' + ','.join(game.tasks.keys()), connection_id) cmd_TASKS.argtypes = '' @@ -24,6 +22,7 @@ def cmd_TERRAINS(game, connection_id): cmd_TERRAINS.argtypes = '' def cmd_ALL(game, msg, connection_id): + from plomrogue.mapping import DijkstraMap def lower_msg_by_volume(msg, volume, largest_audible_distance): import random @@ -198,7 +197,7 @@ def cmd_PORTAL(game, yx, msg, pw, connection_id): if msg == ' ': if big_yx in game.portals: if little_yx in game.portals[big_yx]: - del game.portals[big_yx][little_xy] + del game.portals[big_yx][little_yx] else: if not big_yx in game.portals: game.portals[big_yx] = {} @@ -254,7 +253,7 @@ cmd_MAP_CONTROL_PW.argtypes = 'char string' def cmd_THING(game, big_yx, little_yx, thing_type, thing_id): if not thing_type in game.thing_types: raise GameError('illegal thing type %s' % thing_type) - map_ = game.get_map(big_yx) + _ = game.get_map(big_yx) t_old = None if thing_id > 0: t_old = game.get_thing(thing_id) diff --git a/plomrogue/game.py b/plomrogue/game.py index 64ae689..7936842 100755 --- a/plomrogue/game.py +++ b/plomrogue/game.py @@ -1,5 +1,3 @@ -from plomrogue.tasks import (Task_WAIT, Task_MOVE, Task_WRITE, - Task_FLATTEN_SURROUNDINGS) from plomrogue.errors import GameError, PlayError from plomrogue.io import GameIO from plomrogue.misc import quote @@ -219,7 +217,6 @@ class Game(GameBase): for little_yx in [little_yx for little_yx in self.annotations[big_yx] if player.fov_test(big_yx, little_yx)]: target_yx = player.fov_stencil.target_yx(big_yx, little_yx) - annotation = self.annotations[big_yx][little_yx] self.io.send('ANNOTATION_HINT %s' % (target_yx,), c_id) self.io.send('GAME_STATE_COMPLETE') diff --git a/plomrogue/mapping.py b/plomrogue/mapping.py index 09845fa..97f788b 100644 --- a/plomrogue/mapping.py +++ b/plomrogue/mapping.py @@ -360,7 +360,6 @@ class FovMap(SourcedMap): # and skip evaluation of already shaded tile. (This only works if tiles # shading implies they completely lie in existing shades; otherwise we # would lose shade growth through tiles at shade borders.) - circle_in_map = True distance = 1 yx = YX(yx.y, yx.x) while distance <= self.radius: diff --git a/plomrogue/parser.py b/plomrogue/parser.py index d1307a9..2a87e7d 100644 --- a/plomrogue/parser.py +++ b/plomrogue/parser.py @@ -1,4 +1,3 @@ -import unittest from plomrogue.errors import ArgError from plomrogue.mapping import YX diff --git a/plomrogue/tasks.py b/plomrogue/tasks.py index 9335aed..2e12e5a 100644 --- a/plomrogue/tasks.py +++ b/plomrogue/tasks.py @@ -1,5 +1,4 @@ from plomrogue.errors import PlayError, GameError -from plomrogue.mapping import YX diff --git a/plomrogue/things.py b/plomrogue/things.py index cedee68..a994609 100644 --- a/plomrogue/things.py +++ b/plomrogue/things.py @@ -81,8 +81,7 @@ class ThingAnimate(Thing): self.task.check() except GameError as e: self.task = None - raise GameError - return + raise e self.task.todo -= 1 if self.task.todo <= 0: self._last_task_result = self.task.do()