diff --git a/azul/bag.py b/azul/bag.py index 8529c30..7708c5a 100644 --- a/azul/bag.py +++ b/azul/bag.py @@ -11,8 +11,10 @@ class Bag(TakeTilesFromBagInterface, StateInterface): _tiles: List[Tile] class RandomTakeInterface: + # pylint: disable=no-self-use + # 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..6c0bc53 100644 --- a/azul/interfaces.py +++ b/azul/interfaces.py @@ -1,3 +1,5 @@ +# pylint: disable=no-self-use +# pylint: disable=unused-argument from __future__ import annotations from typing import List, Optional from azul.simple_types import Tile, FinishRoundResult, Points @@ -5,115 +7,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))