From 1e532ca6fc371885f9111b3cd1f9ded02c5eecc8 Mon Sep 17 00:00:00 2001 From: JuniorJPDJ Date: Wed, 7 Jun 2023 13:24:22 +0200 Subject: [PATCH] fix: SyntaxWarning: "is" with a literal. Did you mean "=="? --- actions.py | 2 +- bot.py | 2 +- game.py | 4 ++-- game_manager.py | 2 +- internationalization.py | 2 +- player.py | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/actions.py b/actions.py index 58a45a6..5a78582 100644 --- a/actions.py +++ b/actions.py @@ -113,7 +113,7 @@ def do_play_card(bot, player, result_id): if us.stats: us.games_played += 1 - if game.players_won is 0: + if game.players_won == 0: us.first_places += 1 game.players_won += 1 diff --git a/bot.py b/bot.py index b2825d5..72c2d65 100644 --- a/bot.py +++ b/bot.py @@ -405,7 +405,7 @@ def start_game(update: Update, context: CallbackContext): for player in players: title = player.game.chat.title - if player is gm.userid_current[update.message.from_user.id]: + if player == gm.userid_current[update.message.from_user.id]: title = '- %s -' % player.game.chat.title groups.append( diff --git a/game.py b/game.py index 3234f9b..39a1c83 100644 --- a/game.py +++ b/game.py @@ -58,7 +58,7 @@ class Game(object): current_player = self.current_player itplayer = current_player.next players.append(current_player) - while itplayer and itplayer is not current_player: + while itplayer and itplayer != current_player: players.append(itplayer) itplayer = itplayer.next return players @@ -121,7 +121,7 @@ class Game(object): self.logger.debug("Draw counter increased by 2") elif card.value == c.REVERSE: # Special rule for two players - if self.current_player is self.current_player.next.next: + if self.current_player == self.current_player.next.next: self.turn() else: self.reverse() diff --git a/game_manager.py b/game_manager.py index ec49bc4..4be3bc7 100644 --- a/game_manager.py +++ b/game_manager.py @@ -110,7 +110,7 @@ class GameManager(object): for g in games: for p in g.players: if p.user.id == user.id: - if p is g.current_player: + if p == g.current_player: g.turn() p.leave() diff --git a/internationalization.py b/internationalization.py index f56a20c..2533cf2 100644 --- a/internationalization.py +++ b/internationalization.py @@ -66,7 +66,7 @@ class _Underscore(object): locale = self.locale_stack[-1] if locale not in self.translators.keys(): - if n is 1: + if n == 1: return singular else: return plural diff --git a/player.py b/player.py index e207239..cc1858e 100644 --- a/player.py +++ b/player.py @@ -69,7 +69,7 @@ class Player(object): def leave(self): """Removes player from the game and closes the gap in the list""" - if self.next is self: + if self.next == self: return self.next.prev = self.prev