Commit 7be419e5 authored by Wolfgang Rohdewald's avatar Wolfgang Rohdewald
Browse files

pylint: remove warnings about differing arguments

parent 0a2a3555
......@@ -353,9 +353,9 @@ class Board(QGraphicsRectItem, StrMixin):
so default is to return a Meld with only uiTile"""
return UIMeld(uiTile)
def meldVariants(self, uiTile, lowerHalf): # pylint: disable=no-self-use,unused-argument
def meldVariants(self, tile, lowerHalf): # pylint: disable=no-self-use,unused-argument
"""all possible melds that could be meant by dragging/dropping uiTile"""
return [Meld(uiTile)]
return [Meld(tile)]
def chooseVariant(self, uiTile, lowerHalf=False):
"""make the user choose from a list of possible melds for the target.
......@@ -721,11 +721,11 @@ class SelectorBoard(CourtBoard):
uiTile.dark = False
uiTile.setBoard(self, column, row)
def meldVariants(self, uiTile, lowerHalf):
def meldVariants(self, tile, lowerHalf):
"""returns a list of possible variants based on meld. Those are logical melds."""
# pylint: disable=too-many-locals
assert isinstance(uiTile, UITile)
wantedTile = uiTile.tile
assert isinstance(tile, UITile)
wantedTile = tile.tile
for selectorTile in self.uiTiles:
selectorTile.tile = selectorTile.tile.exposed
lowerName = wantedTile.exposed
......
......@@ -217,7 +217,7 @@ class Client(pb.Referenceable):
self.tables.append(newTable)
return oldTable, newTable
def remote_tableRemoved(self, tableid, unusedMsg, *unusedMsgArgs): # pylint: disable=unused-argument
def remote_tableRemoved(self, tableid, message, *args): # pylint: disable=unused-argument
"""update table list"""
table = self._tableById(tableid)
if table:
......
......@@ -61,7 +61,7 @@ class TileAttr(StrMixin):
"""should the tile appear darker?"""
return self.tile.isConcealed if self.yoffset == 0 else not self.tile.isKnown
def setFocusable(self, hand, meld, unusedIdx):
def setFocusable(self, hand, meld, idx): # pylint: disable=unused-argument
"""is it focusable?"""
player = hand.player
return (
......@@ -127,7 +127,7 @@ class HandBoard(Board):
"""for debugging messages"""
return self.player.name
def showShadowsChanged(self, unusedOldValue, unusedNewValue):
def showShadowsChanged(self, unusedOldValue, newValue):
"""Add or remove the shadows."""
self.setPosition()
......
......@@ -754,9 +754,9 @@ class KConfig(ConfigParser):
with codecs.open(self.path, 'r', encoding='utf-8') as cfgFile:
self.read_file(cfgFile)
def optionxform(self, value):
def optionxform(self, optionstr):
"""KDE needs upper/lowercase distinction"""
return value
return optionstr
def setValue(self, section, option, value):
"""like set but add missing section"""
......
......@@ -114,7 +114,7 @@ class ServerMessage(Message):
sendScore = False
needsGame = True # message only applies to an existing game
def clientAction(self, unusedClient, move):
def clientAction(self, client, move): # pylint: disable=unused-argument
"""default client action: none - this is a virtual class"""
logException(
'clientAction is not defined for %s. msg:%s' %
......@@ -136,13 +136,13 @@ class ClientMessage(Message):
self.shortcut)
return self.i18nName.replace(i18nShortcut, '&' + i18nShortcut, 1)
def toolTip(self, unusedButton, unusedTile):
def toolTip(self, button, tile): # pylint: disable=unused-argument
"""returns text and warning flag for button and text for tile for button and text for tile"""
txt = 'toolTip is not defined for %s' % self.name
logWarning(txt)
return txt, True, ''
def serverAction(self, unusedTable, msg):
def serverAction(self, table, msg): # pylint: disable=unused-argument
"""default server action: none - this is a virtual class"""
logException(
'serverAction is not defined for %s. msg:%s' %
......@@ -179,7 +179,7 @@ class NotifyAtOnceMessage(ClientMessage):
def __init__(self, name=None, shortcut=None):
ClientMessage.__init__(self, name, shortcut)
def notifyAction(self, unusedClient, move):
def notifyAction(self, client, move): # pylint: disable=unused-argument
"""the default action for immediate notifications"""
move.player.popupMsg(self)
......@@ -201,7 +201,7 @@ class PungChowMessage(NotifyAtOnceMessage):
def __init__(self, name=None, shortcut=None):
NotifyAtOnceMessage.__init__(self, name=name, shortcut=shortcut)
def toolTip(self, button, unusedTile):
def toolTip(self, button, tile): # pylint: disable=unused-argument
"""for the action button which will send this message"""
myself = button.client.game.myself
maySay = myself.sayable[self]
......@@ -269,7 +269,7 @@ class MessageKong(NotifyAtOnceMessage, ServerMessage):
else:
table.declareKong(msg.player, Meld(msg.args[0]))
def toolTip(self, button, unusedTile):
def toolTip(self, button, tile):
"""for the action button which will send this message"""
myself = button.client.game.myself
maySay = myself.sayable[self]
......@@ -338,11 +338,11 @@ class MessageMahJongg(NotifyAtOnceMessage, ServerMessage):
"""the server mirrors that and tells all others"""
table.claimMahJongg(msg)
def toolTip(self, unusedButton, unusedTile):
def toolTip(self, button, tile): # pylint: disable=unused-argument
"""returns text and warning flag for button and text for tile"""
return i18n('Press here and you win'), False, ''
def clientAction(self, unusedClient, move):
def clientAction(self, client, move):
"""mirror the mahjongg action locally. Check if the balances are correct."""
return move.player.declaredMahJongg(move.melds, move.withDiscardTile,
move.lastTile, move.lastMeld)
......@@ -545,7 +545,7 @@ class MessageShowConcealedTiles(ServerMessage):
"""the game server assigns tiles to player"""
def clientAction(self, unusedClient, move):
def clientAction(self, client, move):
"""set tiles for player"""
return move.player.showConcealedTiles(move.tiles, move.show)
......@@ -617,7 +617,7 @@ class MessageVoiceId(ServerMessage):
"""we got a voice id from the server. If we have no sounds for
this voice, ask the server"""
def clientAction(self, unusedClient, move):
def clientAction(self, client, move):
"""the server gave us a voice id about another player"""
if Internal.Preferences.useSounds and Options.gui:
move.player.voice = Voice.locate(move.source)
......@@ -629,7 +629,7 @@ class MessageVoiceData(ServerMessage):
"""we got voice sounds from the server, assign them to the player voice"""
def clientAction(self, unusedClient, move):
def clientAction(self, client, move):
"""server sent us voice sounds about somebody else"""
move.player.voice = Voice(move.md5sum, move.source)
if Debug.sound:
......@@ -656,7 +656,7 @@ class MessageServerWantsVoiceData(ServerMessage):
"""The server wants voice sounds from a client"""
def clientAction(self, unusedClient, move):
def clientAction(self, client, move):
"""send voice sounds as requested to server"""
if Debug.sound:
logDebug('%s: send wanted voice data %s to server' % (
......@@ -668,7 +668,7 @@ class MessageServerGetsVoiceData(ClientMessage):
"""The server gets voice sounds from a client"""
def serverAction(self, unusedTable, msg):
def serverAction(self, table, msg): # pylint: disable=unused-argument
"""save voice sounds on the server"""
voice = msg.player.voice
voice.archiveContent = msg.args[0]
......@@ -787,7 +787,7 @@ class MessageError(ServerMessage):
"""a client errors"""
needsGame = False
def clientAction(self, unusedClient, move):
def clientAction(self, client, move):
"""show the error message from server"""
return logWarning(move.source)
......@@ -807,7 +807,7 @@ class MessageOK(ClientMessage):
name=i18ncE('kajongg', 'OK'),
shortcut=i18ncE('kajongg game dialog:Key for OK', 'O'))
def toolTip(self, unusedButton, unusedTile):
def toolTip(self, button, tile): # pylint: disable=unused-argument
"""returns text and warning flag for button and text for tile for button and text for tile"""
return i18n('Confirm that you saw the message'), False, ''
......@@ -821,7 +821,7 @@ class MessageNoClaim(NotifyAtOnceMessage, ServerMessage):
name=i18ncE('kajongg', 'No Claim'),
shortcut=i18ncE('kajongg game dialog:Key for No claim', 'N'))
def toolTip(self, unusedButton, unusedTile):
def toolTip(self, button, tile): # pylint: disable=unused-argument
"""returns text and warning flag for button and text for tile for button and text for tile"""
return i18n('You cannot or do not want to claim this tile'), False, ''
......
......@@ -386,10 +386,10 @@ class Player(StrMixin):
announcements = 'a' if self.originalCall else ''
return ''.join(['m', self.lastSource.char, ''.join(announcements)])
def makeTileKnown(self, tileName):
def makeTileKnown(self, tile):
"""used when somebody else discards a tile"""
assert not self._concealedTiles[0].isKnown
self._concealedTiles[0] = tileName
self._concealedTiles[0] = tile
self._hand = None
def __computeHand(self):
......
......@@ -67,31 +67,30 @@ class CountingRandom(Random):
CountingRandom.count += 1
return Random.random(self)
def seed(self, newSeed=None, version=2):
def seed(self, a=None, version=2):
CountingRandom.count = 0
Random.seed(self, newSeed, version)
Random.seed(self, a, version)
if Debug.random:
self.game.debug('Random gets seed %s' % newSeed)
self.game.debug('Random gets seed %s' % a)
def randrange(self, start, stop=None, step=1, _int=int):
with CountRandomCalls(self, 'randrange({},{},step={})'.format(
start, stop, step)):
return Random.randrange(self, start, stop, step)
def choice(self, fromList):
def choice(self, seq):
"""Choose a random element from a non-empty sequence."""
if len(fromList) == 1:
return fromList[0]
with CountRandomCalls(self, 'choice({})'.format(
fromList)):
return Random.choice(self, fromList)
def sample(self, population, wantedLength):
"""add debug output to sample"""
with CountRandomCalls(self, 'sample({}, {})'.format(population, wantedLength)):
return Random.sample(self, population, wantedLength)
def shuffle(self, listValue, func=None):
"""add debug output to shuffle"""
with CountRandomCalls(self, 'shuffle({})'.format(listValue)):
Random.shuffle(self, listValue, func)
if len(seq) == 1:
return seq[0]
with CountRandomCalls(self, 'choice({})'.format(seq)):
return Random.choice(self, seq)
def sample(self, population, k):
"""add debug output to sample. Chooses k unique random elements"""
with CountRandomCalls(self, 'sample({}, {})'.format(population, k)):
return Random.sample(self, population, k)
def shuffle(self, x, random=None):
"""add debug output to shuffle. Shuffles list x in place."""
with CountRandomCalls(self, 'shuffle({})'.format(x)):
Random.shuffle(self, x, random)
......@@ -144,7 +144,7 @@ class ScoringTileAttr(TileAttr):
"""should the tile appear darker?"""
return self.yoffset or self.tile.isConcealed
def setFocusable(self, unusedHand, unusedMeld, idx):
def setFocusable(self, hand, meld, idx):
"""in a scoring handboard, only the first tile of a meld is focusable"""
return idx == 0
......
......@@ -149,10 +149,10 @@ class VisiblePlayingPlayer(VisiblePlayer, PlayingPlayer):
self.front.message.msg = ''
self.front.message.setVisible(False)
def speak(self, text):
def speak(self, txt):
"""speak if we have a voice"""
if self.voice:
self.voice.speak(text, self.front.rotation())
self.voice.speak(txt, self.front.rotation())
def robTileFrom(self, tile):
"""used for robbing the kong from this player"""
......@@ -168,13 +168,13 @@ class VisiblePlayingPlayer(VisiblePlayer, PlayingPlayer):
assert lastDiscard.tile.isConcealed
self.syncHandBoard()
def addConcealedTiles(self, uiTiles, animated=True):
def addConcealedTiles(self, tiles, animated=True):
"""add to my tiles and sync the hand board"""
with AnimationSpeed(speed=Internal.Preferences.animationSpeed if animated else 99):
PlayingPlayer.addConcealedTiles(
self,
list(x.tile for x in uiTiles))
self.syncHandBoard(uiTiles)
list(x.tile for x in tiles))
self.syncHandBoard(tiles)
def declaredMahJongg(self, concealed, withDiscard, lastTile, lastMeld):
"""player declared mah jongg. Determine last meld, show
......
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