fix: SyntaxWarning: "is" with a literal. Did you mean "=="?
This commit is contained in:
parent
e25879cead
commit
1e532ca6fc
6 changed files with 7 additions and 7 deletions
|
@ -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
|
||||
|
|
2
bot.py
2
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(
|
||||
|
|
4
game.py
4
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()
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue