From 86b243ad53f5ea48dc7205b251819e8297b04a9b Mon Sep 17 00:00:00 2001 From: Shlomi Fish Date: Mon, 18 Sep 2017 15:37:05 +0300 Subject: [PATCH] flake8 --- pysollib/app.py | 8 ++++---- pysollib/game.py | 28 ++++++++++++++-------------- pysollib/tk/solverdialog.py | 3 +-- pysollib/tk/tkstats.py | 4 ++-- tests/style/py-flake8.t | 2 +- 5 files changed, 22 insertions(+), 23 deletions(-) diff --git a/pysollib/app.py b/pysollib/app.py index a630476d..8df87298 100644 --- a/pysollib/app.py +++ b/pysollib/app.py @@ -1460,10 +1460,10 @@ Please select a %s type %s. print_err('fail _readCardsetConfig: %s %s' % (d, f1)) pass - except Exception as err: + except Exception: # traceback.print_exc() pass - except EnvironmentError as ex: + except EnvironmentError: pass # register cardsets for obj in found: @@ -1514,7 +1514,7 @@ Please select a %s type %s. if key not in t: t[key] = 1 found.append((n, tile)) - except EnvironmentError as ex: + except EnvironmentError: pass # register tiles found.sort() @@ -1559,7 +1559,7 @@ Please select a %s type %s. if key not in t: t[key] = 1 found.append((n, obj)) - except EnvironmentError as ex: + except EnvironmentError: pass # register songs found.sort() diff --git a/pysollib/game.py b/pysollib/game.py index 63b36a4f..0fafa5a9 100644 --- a/pysollib/game.py +++ b/pysollib/game.py @@ -2239,9 +2239,9 @@ Congratulations, you did it ! def _shallHighlightMatch_ACW(self, stack1, card1, stack2, card2): # by alternate color with wrapping (only for french games) - return (card1.color != card2.color - and ((card1.rank + 1) % 13 == card2.rank - or (card2.rank + 1) % 13 == card1.rank)) + return (card1.color != card2.color and + ((card1.rank + 1) % 13 == card2.rank or + (card2.rank + 1) % 13 == card1.rank)) def _shallHighlightMatch_SS(self, stack1, card1, stack2, card2): # by same suit @@ -2249,9 +2249,9 @@ Congratulations, you did it ! def _shallHighlightMatch_SSW(self, stack1, card1, stack2, card2): # by same suit with wrapping (only for french games) - return (card1.suit == card2.suit - and ((card1.rank + 1) % 13 == card2.rank - or (card2.rank + 1) % 13 == card1.rank)) + return (card1.suit == card2.suit and + ((card1.rank + 1) % 13 == card2.rank or + (card2.rank + 1) % 13 == card1.rank)) def _shallHighlightMatch_RK(self, stack1, card1, stack2, card2): # by rank @@ -2259,8 +2259,8 @@ Congratulations, you did it ! def _shallHighlightMatch_RKW(self, stack1, card1, stack2, card2): # by rank with wrapping (only for french games) - return ((card1.rank + 1) % 13 == card2.rank - or (card2.rank + 1) % 13 == card1.rank) + return ((card1.rank + 1) % 13 == card2.rank or + (card2.rank + 1) % 13 == card1.rank) def _shallHighlightMatch_BO(self, stack1, card1, stack2, card2): # by any suit but own @@ -2268,9 +2268,9 @@ Congratulations, you did it ! def _shallHighlightMatch_BOW(self, stack1, card1, stack2, card2): # by any suit but own with wrapping (only for french games) - return (card1.suit != card2.suit - and ((card1.rank + 1) % 13 == card2.rank - or (card2.rank + 1) % 13 == card1.rank)) + return (card1.suit != card2.suit and + ((card1.rank + 1) % 13 == card2.rank or + (card2.rank + 1) % 13 == card1.rank)) def _shallHighlightMatch_SC(self, stack1, card1, stack2, card2): # by same color @@ -2278,9 +2278,9 @@ Congratulations, you did it ! def _shallHighlightMatch_SCW(self, stack1, card1, stack2, card2): # by same color with wrapping (only for french games) - return (card1.color == card2.color - and ((card1.rank + 1) % 13 == card2.rank - or (card2.rank + 1) % 13 == card1.rank)) + return (card1.color == card2.color and + ((card1.rank + 1) % 13 == card2.rank or + (card2.rank + 1) % 13 == card1.rank)) # # quick-play diff --git a/pysollib/tk/solverdialog.py b/pysollib/tk/solverdialog.py index f79fe885..e8df475a 100644 --- a/pysollib/tk/solverdialog.py +++ b/pysollib/tk/solverdialog.py @@ -31,8 +31,7 @@ from pysollib.mfxutil import KwStruct # Toolkit imports from pysollib.tk.basetkmfxdialog import BaseTkMfxDialog -from pysollib.ui.tktile.solverdialog import BaseSolverDialog, solver_dialog, \ - connect_game_solver_dialog, destroy_solver_dialog, reset_solver_dialog +from pysollib.ui.tktile.solverdialog import BaseSolverDialog, solver_dialog if sys.version_info > (3,): diff --git a/pysollib/tk/tkstats.py b/pysollib/tk/tkstats.py index 8d629fe6..f1f5bfab 100644 --- a/pysollib/tk/tkstats.py +++ b/pysollib/tk/tkstats.py @@ -620,8 +620,8 @@ class Status_StatsDialog(MfxMessageDialog): n = n + len(s.cards) w1 = (_("Highlight piles: ") + str(stats.highlight_piles) + "\n" + _("Highlight cards: ") + str(stats.highlight_cards) + "\n" + - _("Highlight same rank: ") + str(stats.highlight_samerank) - + "\n") + _("Highlight same rank: ") + str(stats.highlight_samerank) + + "\n") if game.s.talon: if game.gameinfo.redeals != 0: w2 = w2 + _("\nRedeals: ") + str(game.s.talon.round - 1) diff --git a/tests/style/py-flake8.t b/tests/style/py-flake8.t index 58867003..080f5277 100644 --- a/tests/style/py-flake8.t +++ b/tests/style/py-flake8.t @@ -44,7 +44,7 @@ while ( my $r = $tree->next_obj ) my $cmd = shell_quote( 'flake8', @filenames ); -# diag("<$cmd>"); +diag("<$cmd>"); # TEST eq_or_diff( scalar(`$cmd`), '', "flake8 is happy with the code." );