From: Axy Date: Sat, 21 Mar 2026 01:48:33 +0000 (+0100) Subject: lint X-Git-Url: https://git.uwuaxy.net/?a=commitdiff_plain;ds=sidebyside;p=axy%2Fft%2Fa-maze-ing.git lint --- diff --git a/__main__.py b/__main__.py index 81d3e84..85934b6 100644 --- a/__main__.py +++ b/__main__.py @@ -11,12 +11,11 @@ import random from amazeing.config.config_parser import Config from amazeing.maze_class.maze_network_tracker import MazeNetworkTracker -from amazeing.maze_class.maze_coords import Cardinal, CellCoord +from amazeing.maze_class.maze_coords import CellCoord from amazeing.maze_class.maze_dirty_tracker import MazeDirtyTracker from amazeing.maze_class.maze_pacman_tracker import MazePacmanTracker from amazeing.maze_display.TTYdisplay import TileCycle, TileMaps, extract_pairs from amazeing.maze_display.backend import CloseRequested, IVec2 -from amazeing.utils import QuadTree config = Config.parse(open("./example.conf").read()) diff --git a/amazeing/maze_display/TTYdisplay.py b/amazeing/maze_display/TTYdisplay.py index df580e5..5dead97 100644 --- a/amazeing/maze_display/TTYdisplay.py +++ b/amazeing/maze_display/TTYdisplay.py @@ -1,6 +1,6 @@ from abc import ABC, abstractmethod from collections.abc import Callable, Generator, Iterable -from amazeing.utils import BiMap, AVLTree +from amazeing.utils import BiMap from amazeing.config.config_parser import Color, Config, ColoredLine, ColorPair from amazeing.maze_display.layout import ( BInt, diff --git a/amazeing/utils/avl.py b/amazeing/utils/avl.py index 08b82ba..4c1970f 100644 --- a/amazeing/utils/avl.py +++ b/amazeing/utils/avl.py @@ -17,7 +17,7 @@ class Tree[T]: def __iter__(self) -> Iterator[T]: if self.root is None: - return () + return iter(()) return iter(self.root) def append(self, value: T) -> "Leaf[T]": diff --git a/amazeing/utils/bi_map.py b/amazeing/utils/bi_map.py index ea331b2..0a42250 100644 --- a/amazeing/utils/bi_map.py +++ b/amazeing/utils/bi_map.py @@ -11,7 +11,7 @@ class BiMap[K, R]: if self.revcontains(revkey): self.revremove(revkey) if not self.contains(key): - tree = AVLTree() + tree = AVLTree[R]() self.__map[key] = tree self.__revmap[tree] = key self.__leafmap[revkey] = self.__map[key].append(revkey) @@ -40,7 +40,7 @@ class BiMap[K, R]: if src not in self.__map: return if dst not in self.__map: - tree = AVLTree() + tree = AVLTree[R]() self.__map[dst] = tree self.__revmap[tree] = dst self.__map[dst].rjoin(self.__map.pop(src)) diff --git a/amazeing/utils/quadtree.py b/amazeing/utils/quadtree.py index a3a7152..9a2de7a 100644 --- a/amazeing/utils/quadtree.py +++ b/amazeing/utils/quadtree.py @@ -1,5 +1,4 @@ -from collections.abc import Callable, Generator, Iterable -from typing import cast +from collections.abc import Callable, Generator from amazeing.maze_display.backend import IVec2 from functools import partial from itertools import chain @@ -116,9 +115,9 @@ class Tree: def node_tiles( node: MaybeNode, pos: IVec2, height: int ) -> Generator[IVec2]: - if height == 0 and node == True: + if height == 0 and node is True: yield pos - if height == 0 or node == False: + if height == 0 or node is False: return for pos, node in zip4( Tree.node_starts(pos, height), Tree.node_split(node) diff --git a/example.conf b/example.conf index e023c67..a0f7394 100644 --- a/example.conf +++ b/example.conf @@ -1,5 +1,5 @@ -WIDTH=1000 -HEIGHT=1000 +WIDTH=100 +HEIGHT=100 ENTRY=0,0 EXIT=24,24 OUTPUT_FILE=test