Merge pull request #115 from JuniorJPDJ/fix-syntaxwarning-is

fix: SyntaxWarning: "is" with a literal. Did you mean "=="?
This commit is contained in:
Jannes Höke 2023-06-07 14:01:39 +02:00 committed by GitHub
commit 79c16e3920
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 7 additions and 7 deletions

View file

@ -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
View file

@ -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(

View file

@ -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()

View file

@ -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()

View file

@ -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

View file

@ -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