Commit fbae2067 authored by Wolfgang Rohdewald's avatar Wolfgang Rohdewald
Browse files

pylint: generators

parent 40863ed9
......@@ -437,7 +437,7 @@ class DeferredBlock(StrMixin):
self.tell(
player,
list(
[x for x in self.table.game.players if x.name != player.name]),
x for x in self.table.game.players if x.name != player.name),
command,
**kwargs)
......
......@@ -362,7 +362,7 @@ class Game:
def losers(self):
"""the 3 or 4 losers: All players without the winner"""
return list([x for x in self.players if x is not self.__winner])
return list(x for x in self.players if x is not self.__winner)
def belongsToRobotPlayer(self):
"""does this game instance belong to a robot player?"""
......@@ -654,9 +654,9 @@ class Game:
(gameid, qLastHandRecord[0])).records
if not qScoreRecords:
# this should normally not happen
qScoreRecords = list([
qScoreRecords = list(
tuple([qGameRecord[wind], wind.char, 0, False, East.char])
for wind in Wind.all4])
for wind in Wind.all4)
if len(qScoreRecords) != 4:
logError('game %d inconsistent: There should be exactly '
'4 score records for the last hand' % gameid)
......
......@@ -85,7 +85,7 @@ class ListComboBox(QComboBox):
def names(self):
"""a list with all item names"""
return list([x.name for x in self.items])
return list(x.name for x in self.items)
@property
def current(self):
......
......@@ -668,7 +668,7 @@ def allJobs():
for pyVersion in OPTIONS.pyVersions:
OPTIONS.jobCount += 1
if OPTIONS.jobCount > OPTIONS.count:
raise StopIteration
return
yield Job(pyVersion, ruleset, aiVariant, commitId, game)
def main():
......
......@@ -88,7 +88,8 @@ class Permutations:
else:
result.append(appendValue)
else:
result = list([list([tuple([x]) for x in values])])
result = list([list([tuple([x]) for x in values])]) # pylint: disable=consider-using-generator
# the solution proposed by pylint creates something unusable
tupleResult = tuple(sorted(set(tuple(tuple(sorted(x)) for x in result))))
cls.permuteCache[valuesTuple] = tupleResult
return tupleResult
......
......@@ -635,7 +635,7 @@ class TripleKnitting(MJRule):
if len(rest) not in (1, 4):
return set()
result = list(
[Tile(x, y.value).concealed for x in Tile.colors for y in rest])
Tile(x, y.value).concealed for x in Tile.colors for y in rest)
for restTile in rest:
result.remove(restTile)
return set(result)
......
......@@ -665,7 +665,7 @@ class PenaltyDialog(QDialog):
grid = QGridLayout(self)
lblOffense = QLabel(i18n('Offense:'))
crimes = list(
[x for x in game.ruleset.penaltyRules if not ('absolute' in x.options and game.winner)])
x for x in game.ruleset.penaltyRules if not ('absolute' in x.options and game.winner))
self.cbCrime = ListComboBox(crimes)
lblOffense.setBuddy(self.cbCrime)
grid.addWidget(lblOffense, 0, 0)
......
......@@ -58,7 +58,7 @@ def callers(count=5, exclude=None):
excluding.extend(['_dataReceived', 'dataReceived', 'gotItem'])
excluding.extend(['callWithContext', '_doReadOrWrite', 'doRead'])
excluding.extend(['callers', 'debug', 'logMessage', 'logDebug'])
_ = list(([x[2] for x in stck if x[2] not in excluding]))
_ = list(x[2] for x in stck if x[2] not in excluding)
names = reversed(_[-count:])
result = '.'.join(names)
return '[{}]'.format(result)
......
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