From 49c69bfbd4bc1c5b12378f08e2527dc8e42648df Mon Sep 17 00:00:00 2001 From: Robert Lukotka Date: Fri, 16 Feb 2024 21:08:40 +0100 Subject: [PATCH] Fix CI issues --- azul/bag.py | 3 +- azul/final_points_calculation.py | 8 ++-- azul/interfaces.py | 55 ++++++++++++++------------- azul/pattern_line.py | 2 +- test/test_final_points_calculation.py | 3 -- 5 files changed, 35 insertions(+), 36 deletions(-) diff --git a/azul/bag.py b/azul/bag.py index 8529c30..f9dc2be 100644 --- a/azul/bag.py +++ b/azul/bag.py @@ -11,8 +11,9 @@ class Bag(TakeTilesFromBagInterface, StateInterface): _tiles: List[Tile] class RandomTakeInterface: + # pylint: disable=unused-argument def take(self, count: int, tiles: List[Tile]) -> Tuple[List[Tile], List[Tile]]: - pass + assert False class RandomTake(RandomTakeInterface): _random: Random diff --git a/azul/final_points_calculation.py b/azul/final_points_calculation.py index 6e46085..4dd48b3 100644 --- a/azul/final_points_calculation.py +++ b/azul/final_points_calculation.py @@ -7,11 +7,11 @@ class FinalPointsCalculation(FinalPointsCalculationInterface): def get_points(self, wall: List[List[Optional[Tile]]]) -> Points: assert len(wall) == 5 - assert all([len(line) == 5 for line in wall]) - row_points: int = sum([(2 if all(line) else 0) for line in wall]) + assert all(len(line) == 5 for line in wall) + row_points: int = sum((2 if all(line) else 0) for line in wall) transposed_wall = list(zip(*wall)) - column_points: int = sum([(7 if all(line) else 0) - for line in transposed_wall]) + column_points: int = sum((7 if all(line) else 0) + for line in transposed_wall) color_points: int = 10 * \ len(set.intersection( *[{tile for tile in line if tile} for line in wall])) diff --git a/azul/interfaces.py b/azul/interfaces.py index bf04a10..cdf70d3 100644 --- a/azul/interfaces.py +++ b/azul/interfaces.py @@ -1,3 +1,4 @@ +# pylint: disable=unused-argument from __future__ import annotations from typing import List, Optional from azul.simple_types import Tile, FinishRoundResult, Points @@ -5,115 +6,115 @@ class GiveTilesInterface: def give(self, tiles: List[Tile]) -> None: - pass + assert False class TakeTilesFromBagInterface: def take(self, count: int) -> List[Tile]: - pass + assert False class StateInterface: def state(self) -> str: - pass + assert False class BagUsedTilesInterface(StateInterface): def take_all(self) -> List[Tile]: - pass + assert False class TileSourceInterface: def take(self, idx: int) -> List[Tile]: - pass + assert False def is_empty(self) -> bool: - pass + assert False def start_new_round(self) -> None: - pass + assert False def state(self) -> str: - pass + assert False class GameInterface: def start_game(self) -> None: - pass + assert False def take(self, player_id: int, source_idx: int, idx: int, destination_idx: int) -> bool: - pass + assert False class TableAreaInterface(StateInterface): def take(self, source_idx: int, idx: int) -> List[Tile]: - pass + assert False def is_round_end(self) -> bool: - pass + assert False def start_new_round(self) -> None: - pass + assert False class BoardInterface(StateInterface): def put(self, destination_idx: int, tiles: List[Tile]) -> None: - pass + assert False def finish_round(self) -> FinishRoundResult: - pass + assert False def end_game(self) -> None: - pass + assert False class NotifyEverybodyInterface: def notify_everybody(self, state: str) -> None: - pass + assert False class FloorInterface(StateInterface, GiveTilesInterface): def finish_round(self) -> Points: - pass + assert False class PatternLineWallLineInterface: def can_put_tile(self, tile: Tile) -> bool: - pass + assert False def put_tile(self, tile: Tile) -> Points: - pass + assert False class ObserverInterface: def notify(self, new_state: str) -> None: - pass + assert False class ObservableInterface: def register_observer(self, observer: ObserverInterface) -> None: - pass + assert False def cancel_observer(self, observer: ObserverInterface) -> None: - pass + assert False class FinalPointsCalculationInterface: def get_points(self, wall: List[List[Optional[Tile]]]) -> Points: - pass + assert False class GameFinishedInterface: def game_finished(self, wall: List[List[Optional[Tile]]]) -> FinishRoundResult: - pass + assert False class WallLineInterface(StateInterface): @property def tiles(self) -> List[Optional[Tile]]: - pass + assert False class PatternLineInterface(StateInterface, GiveTilesInterface): def finish_round(self) -> Points: - pass + assert False diff --git a/azul/pattern_line.py b/azul/pattern_line.py index 4bd42cd..ed49f3b 100644 --- a/azul/pattern_line.py +++ b/azul/pattern_line.py @@ -30,7 +30,7 @@ def give(self, tiles: List[Tile]) -> None: # Check if tiles are all of the same type if not tiles: return - assert all([tile == tiles[0] for tile in tiles]) + assert all(tile == tiles[0] for tile in tiles) assert self._capacity >= len(self._tiles) count_to_fit = min(self._capacity - len(self._tiles), len(tiles)) diff --git a/test/test_final_points_calculation.py b/test/test_final_points_calculation.py index 0c78b6d..17afda2 100644 --- a/test/test_final_points_calculation.py +++ b/test/test_final_points_calculation.py @@ -12,7 +12,6 @@ def setUp(self) -> None: def test_get_points(self) -> None: test_wall: List[List[Optional[Tile]]] = [ - # pylint: disable=bad-whitespace [None, YELLOW, RED, None, None], [None, BLUE, YELLOW, RED, None], [None, GREEN, BLUE, None, RED], @@ -25,7 +24,6 @@ def test_get_points(self) -> None: def test_get_points2(self) -> None: test_wall: List[List[Optional[Tile]]] = [ - # pylint: disable=bad-whitespace [BLUE, YELLOW, RED, BLACK, GREEN], [GREEN, BLUE, YELLOW, RED, BLACK], [BLACK, GREEN, BLUE, YELLOW, RED], @@ -38,7 +36,6 @@ def test_get_points2(self) -> None: def test_get_points3(self) -> None: test_wall: List[List[Optional[Tile]]] = [ - # pylint: disable=bad-whitespace [BLUE, None, RED, BLACK, GREEN], [GREEN, BLUE, YELLOW, None, BLACK], [BLACK, GREEN, None, YELLOW, RED],