flake8 all the things.
authorJeremy Thurgood <firxen@gmail.com>
Fri, 16 May 2014 14:03:46 +0000 (16:03 +0200)
committerJeremy Thurgood <firxen@gmail.com>
Fri, 16 May 2014 14:03:46 +0000 (16:03 +0200)
naja/player.py
naja/scenes/menu.py
naja/tests/test_actions.py
naja/tests/test_gameboard.py
naja/tests/test_player.py
naja/widgets/tile.py

index 2f6fdcfa45e3c618a3005641d6eb29dfc16f566c..2aad55b029a4c323cd4582f42727496a0215d4d2 100644 (file)
@@ -1,4 +1,4 @@
-from naja.constants import BITS, MOVES, CHESS_PIECES
+from naja.constants import BITS, MOVES
 
 
 class PlayerBits(object):
@@ -62,7 +62,10 @@ class Player(object):
 
     @classmethod
     def import_player(cls, definition):
-        return cls(definition['bits'], tuple(definition['position']), definition['movement_mode'])
+        return cls(
+            definition['bits'],
+            tuple(definition['position']),
+            definition['movement_mode'])
 
     def export(self):
         return {
index 91f858b0d6304ef62e55e6142c40e9737b66d5f0..3a7896908347cb037ecb26ef95717b269e32662e 100644 (file)
@@ -23,7 +23,8 @@ class MenuScene(Scene):
         run_game.add_callback('click',
                               lambda event: SceneChangeEvent.post(GameScene))
         selector.add(run_game)
-        credits = TextWidget((100, 200), 'Credits', fontsize=32, colour='white')
+        credits = TextWidget(
+            (100, 200), 'Credits', fontsize=32, colour='white')
         credits.add_callback('click',
                              lambda event: SceneChangeEvent.post(CreditsScene))
         selector.add(credits)
index 14d5f0e6e2f8efd56b3f926c510ce94ea2003dfe..891936799d4ab0827bf9aeeb5c6a781e321a3a2b 100644 (file)
@@ -190,17 +190,21 @@ class TestActions(TestCase):
 
     def test_AllowKnightMove(self):
         board = self.make_board(player_bits=[BITS.RED, BITS.BLUE])
-        actions.AllowChessMove(set([BITS.RED, BITS.BLUE]), chesspiece="KNIGHT").perform_action(board, None)
+        actions.AllowChessMove(
+            set([BITS.RED, BITS.BLUE]), chesspiece="KNIGHT"
+        ).perform_action(board, None)
         self.assertEqual(board.player.movement_mode, MOVES.KNIGHT)
 
-
     def test_AllowBishopMove(self):
         board = self.make_board(player_bits=[BITS.RED, BITS.BLUE])
-        actions.AllowChessMove(set([BITS.RED, BITS.BLUE]), chesspiece="BISHOP").perform_action(board, None)
+        actions.AllowChessMove(
+            set([BITS.RED, BITS.BLUE]), chesspiece="BISHOP"
+        ).perform_action(board, None)
         self.assertEqual(board.player.movement_mode, MOVES.BISHOP)
 
-
     def test_AllowCastleMove(self):
         board = self.make_board(player_bits=[BITS.RED, BITS.BLUE])
-        actions.AllowChessMove(set([BITS.RED, BITS.BLUE]), chesspiece="CASTLE").perform_action(board, None)
+        actions.AllowChessMove(
+            set([BITS.RED, BITS.BLUE]), chesspiece="CASTLE"
+        ).perform_action(board, None)
         self.assertEqual(board.player.movement_mode, MOVES.CASTLE)
index 3bbf59bcf6e21d8cc916e37079c5a19eb04ebdbe..6231ac7750f96941d1bd40529890465ceb740772 100644 (file)
@@ -22,8 +22,8 @@ class TestGameBoard(TestCase):
 
     def test_export_new_board(self):
         board = GameBoard.new_game([{'actions': [{
-                'action_class': 'LoseHealthOrMSB',
-                'required_bits': [],
+            'action_class': 'LoseHealthOrMSB',
+            'required_bits': [],
         }]}])
         exported_state = board.export()
         board_locations = exported_state.pop('board_locations')
@@ -143,7 +143,6 @@ class TestGameBoard(TestCase):
         self.assertEqual(board.player.movement_mode, MOVES.CASTLE)
 
 
-
 class TestLocationCard(TestCase):
     def test_generate_bitwise_operand(self):
         # This is testing a random process, so it may fail occasionally.
index a7173cbc794ce6b7571dfb3962532c4b2e4e6212..2e17379213db3d9e4a8f5f6d0603c199ddf88eb8 100644 (file)
@@ -130,17 +130,19 @@ class TestPlayer(TestCase):
 
     def test_legal_moves_castle(self):
         player = Player(0x0f, (1, 3), MOVES.CASTLE)
-        self.assertEqual(player.legal_moves(), [(0, 3), (1, 0), (1, 1), (1, 2),
-        (1, 3), (1, 4), (2, 3), (3, 3), (4, 3)])
+        self.assertEqual(player.legal_moves(), [
+            (0, 3), (1, 0), (1, 1), (1, 2), (1, 3), (1, 4), (2, 3), (3, 3),
+            (4, 3)])
 
     def test_legal_moves_bishop(self):
         player = Player(0x0f, (1, 3), MOVES.BISHOP)
-        self.assertEqual(player.legal_moves(), [(0, 2), (0, 4), (1, 3), (2, 2),
-        (2, 4), (3, 1), (4, 0)])
+        self.assertEqual(player.legal_moves(), [
+            (0, 2), (0, 4), (1, 3), (2, 2), (2, 4), (3, 1), (4, 0)])
 
     def test_legal_moves_knight(self):
         player = Player(0x0f, (1, 3), MOVES.KNIGHT)
-        self.assertEqual(player.legal_moves(), [(0, 1), (1, 3), (2, 1), (3, 2), (3, 4)])
+        self.assertEqual(player.legal_moves(), [
+            (0, 1), (1, 3), (2, 1), (3, 2), (3, 4)])
 
     def test_set_position(self):
         player = Player(0x0f, (3, 3), MOVES.BISHOP)
index 808798fd2e9f88df1a04c1475f3b4d5920695962..b199418e7f12a33481fef3cd893e119a4d7311e2 100644 (file)
@@ -2,7 +2,8 @@
 import pygame
 
 from naja.constants import (
-    TILE_SIZE, BITS, LOCK_HEIGHT, SMALL_LOCK_HEIGHT, EXAMINE, ACTION_GLYPHS, PALETTE)
+    TILE_SIZE, BITS, LOCK_HEIGHT, SMALL_LOCK_HEIGHT, EXAMINE, ACTION_GLYPHS,
+    PALETTE)
 from naja.resources import resources
 from naja.resources.mutators import EIGHT_BIT, blender
 from naja.widgets.base import Widget
@@ -58,10 +59,10 @@ class TileWidget(Widget):
 
         if self.state.gameboard.player_mode == EXAMINE and legal_move:
             overlays.append(resources.get_image('board/tile_available.png',
-                                     transforms=(EIGHT_BIT,)))
+                                                transforms=(EIGHT_BIT,)))
         if self.highlighted:
             overlays.append(resources.get_image('board/tile_selected.png',
-                                          transforms=(EIGHT_BIT,)))
+                                                transforms=(EIGHT_BIT,)))
 
         self.surface = pygame.surface.Surface(TILE_SIZE)
         self.surface.blit(bg, (0, 0))
@@ -87,7 +88,8 @@ class TileWidget(Widget):
             if y_offset == LOCK_HEIGHT:
                 y_offset = 0  # middle -> top
             elif y_offset == 2 * LOCK_HEIGHT:
-                y_offset += LOCK_HEIGHT - SMALL_LOCK_HEIGHT - 2 # bottom -> further down
+                # bottom -> further down
+                y_offset += LOCK_HEIGHT - SMALL_LOCK_HEIGHT - 2
 
         img = resources.get_image(img_name, transforms=(EIGHT_BIT,))
         self.surface.blit(img, (x_offset, y_offset))