Skip to content

Commit

Permalink
Merge pull request #115 from JuniorJPDJ/fix-syntaxwarning-is
Browse files Browse the repository at this point in the history
fix: SyntaxWarning: "is" with a literal. Did you mean "=="?
  • Loading branch information
jh0ker committed Jun 7, 2023
2 parents e25879c + 1e532ca commit 79c16e3
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ def send_first():
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(
Expand Down
4 changes: 2 additions & 2 deletions game.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def players(self):
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
Expand Down Expand Up @@ -121,7 +121,7 @@ def play_card(self, card):
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()
Expand Down
2 changes: 1 addition & 1 deletion game_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ def leave_game(self, user, chat):
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()
Expand Down
2 changes: 1 addition & 1 deletion internationalization.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def __call__(self, singular, plural=None, n=1, locale=None):
locale = self.locale_stack[-1]

if locale not in self.translators.keys():
if n is 1:
if n == 1:
return singular
else:
return plural
Expand Down
2 changes: 1 addition & 1 deletion player.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def draw_first_hand(self):

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
Expand Down

0 comments on commit 79c16e3

Please sign in to comment.