Skip to content

Commit 1e532ca

Browse files
authored
fix: SyntaxWarning: "is" with a literal. Did you mean "=="?
1 parent e25879c commit 1e532ca

6 files changed

+7
-7
lines changed

actions.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ def do_play_card(bot, player, result_id):
113113
if us.stats:
114114
us.games_played += 1
115115

116-
if game.players_won is 0:
116+
if game.players_won == 0:
117117
us.first_places += 1
118118

119119
game.players_won += 1

bot.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ def send_first():
405405
for player in players:
406406
title = player.game.chat.title
407407

408-
if player is gm.userid_current[update.message.from_user.id]:
408+
if player == gm.userid_current[update.message.from_user.id]:
409409
title = '- %s -' % player.game.chat.title
410410

411411
groups.append(

game.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def players(self):
5858
current_player = self.current_player
5959
itplayer = current_player.next
6060
players.append(current_player)
61-
while itplayer and itplayer is not current_player:
61+
while itplayer and itplayer != current_player:
6262
players.append(itplayer)
6363
itplayer = itplayer.next
6464
return players
@@ -121,7 +121,7 @@ def play_card(self, card):
121121
self.logger.debug("Draw counter increased by 2")
122122
elif card.value == c.REVERSE:
123123
# Special rule for two players
124-
if self.current_player is self.current_player.next.next:
124+
if self.current_player == self.current_player.next.next:
125125
self.turn()
126126
else:
127127
self.reverse()

game_manager.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ def leave_game(self, user, chat):
110110
for g in games:
111111
for p in g.players:
112112
if p.user.id == user.id:
113-
if p is g.current_player:
113+
if p == g.current_player:
114114
g.turn()
115115

116116
p.leave()

internationalization.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ def __call__(self, singular, plural=None, n=1, locale=None):
6666
locale = self.locale_stack[-1]
6767

6868
if locale not in self.translators.keys():
69-
if n is 1:
69+
if n == 1:
7070
return singular
7171
else:
7272
return plural

player.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def draw_first_hand(self):
6969

7070
def leave(self):
7171
"""Removes player from the game and closes the gap in the list"""
72-
if self.next is self:
72+
if self.next == self:
7373
return
7474

7575
self.next.prev = self.prev

0 commit comments

Comments
 (0)