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
40863ed9
Commit
40863ed9
authored
Apr 07, 2021
by
Wolfgang Rohdewald
Browse files
pylint: comprehensions
parent
5cc10f44
Changes
5
Hide whitespace changes
Inline
Side-by-side
src/game.py
View file @
40863ed9
...
...
@@ -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
):
...
...
src/player.py
View file @
40863ed9
...
...
@@ -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
...
...
src/server.py
View file @
40863ed9
...
...
@@ -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
,
...
...
src/sound.py
View file @
40863ed9
...
...
@@ -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
:
...
...
src/tile.py
View file @
40863ed9
...
...
@@ -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
)
...
...
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