Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Games
Kajongg
Commits
fbae2067
Commit
fbae2067
authored
Apr 07, 2021
by
Wolfgang Rohdewald
Browse files
pylint: generators
parent
40863ed9
Changes
8
Hide whitespace changes
Inline
Side-by-side
src/deferredutil.py
View file @
fbae2067
...
...
@@ -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
)
...
...
src/game.py
View file @
fbae2067
...
...
@@ -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
)
...
...
src/guiutil.py
View file @
fbae2067
...
...
@@ -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
):
...
...
src/kajonggtest.py
View file @
fbae2067
...
...
@@ -668,7 +668,7 @@ def allJobs():
for
pyVersion
in
OPTIONS
.
pyVersions
:
OPTIONS
.
jobCount
+=
1
if
OPTIONS
.
jobCount
>
OPTIONS
.
count
:
r
aise
StopIteratio
n
r
etur
n
yield
Job
(
pyVersion
,
ruleset
,
aiVariant
,
commitId
,
game
)
def
main
():
...
...
src/permutations.py
View file @
fbae2067
...
...
@@ -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
...
...
src/rulecode.py
View file @
fbae2067
...
...
@@ -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
)
...
...
src/scoringdialog.py
View file @
fbae2067
...
...
@@ -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
)
...
...
src/util.py
View file @
fbae2067
...
...
@@ -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
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment