Commit 40863ed9 authored by Wolfgang Rohdewald's avatar Wolfgang Rohdewald
Browse files

pylint: comprehensions

parent 5cc10f44
......@@ -416,7 +416,7 @@ class Game:
def __exchangeSeats(self):
"""execute seat exchanges according to the rules"""
winds = [x for x in self.shiftRules.split(',')[(self.roundsFinished - 1) % 4]]
winds = list(x for x in self.shiftRules.split(',')[(self.roundsFinished - 1) % 4])
players = [self.players[Wind(x)] for x in winds]
pairs = [players[x:x + 2] for x in range(0, len(winds), 2)]
for playerA, playerB in self._mustExchangeSeats(pairs):
......
......@@ -599,7 +599,7 @@ class PlayingPlayer(Player):
(self, move.player, move.exposedMeld))
if Debug.mahJongg:
game.debug('%s may say MJ:%s, active=%s' % (
self, [x for x in game.players], game.activePlayer))
self, list(x for x in game.players), game.activePlayer))
game.debug(' with hand {}'.format(hand))
return MeldList(x for x in hand.melds if not x.isDeclared), withDiscard, hand.lastMeld
return None
......
......@@ -223,7 +223,7 @@ class MJServer:
def generateTableId(self):
"""generates a new table id: the first free one"""
usedIds = set(self.tables or [0])
availableIds = {x for x in range(1, 2 + max(usedIds))}
availableIds = set(x for x in range(1, 2 + max(usedIds)))
return min(availableIds - usedIds)
def newTable(self, user, ruleset, playOpen,
......
......@@ -233,7 +233,7 @@ class Voice(StrMixin):
group = Internal.kajonggrc.group('Locale')
prefLanguages = uniqueList(
':'.join(['local', str(group.readEntry('Language')), 'en_US']).split(':'))
prefLanguages = {x: y for x, y in enumerate(prefLanguages)}
prefLanguages = dict(enumerate(prefLanguages))
result = sorted(
result, key=lambda x: prefLanguages.get(x.language(), 9999))
if Debug.sound:
......
......@@ -120,7 +120,7 @@ class Tile(str, StrMixin):
(result[0], result[1])):
cls.cache[key] = result
existing = list([x for x in cls.cache.values() if x.key == result.key])
existing = list([x for x in cls.cache.values() if x.key == result.key]) # pylint: disable=consider-using-generator
existingIds = {id(x) for x in existing}
assert len(existingIds) == 1, 'new is:{} existing are: {} with ids {}'.format(result, existing, existingIds)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment