Commit 827be4e1 authored by Wolfgang Rohdewald's avatar Wolfgang Rohdewald
Browse files

rename unused args from dummy* to unused* and silence pylint3 1.7.2 about unused arguments

parent c148b804
......@@ -213,7 +213,7 @@ class ParallelAnimationGroup(QParallelAnimationGroup, StrMixin):
self.removeAnimation(animation)
QParallelAnimationGroup.updateCurrentTime(self, value)
def start(self, dummyResults='DIREKT'):
def start(self, unusedResults='DIREKT'):
"""start the animation, returning its deferred"""
if not isAlive(self):
return fail()
......@@ -447,7 +447,7 @@ def afterQueuedAnimations(doAfter):
method = types.MethodType(doAfter, args[0])
args = args[1:]
varnames = doAfter.__code__.co_varnames
assert varnames[1] in ('deferredResult', 'dummyDeferredResult'), \
assert varnames[1] in ('deferredResult', 'unusedDeferredResult'), \
'{} passed {} instead of deferredResult'.format(
doAfter.__qualname__, varnames[1])
animateAndDo(method, *args, **kwargs)
......
......@@ -98,7 +98,7 @@ class PlayerWind(AnimatedMixin, QGraphicsObject, StrMixin):
newPrevailing = self.wind == Wind.all4[value % 4]
self.__brush = self.roundWindColor if newPrevailing else self.whiteColor
def paint(self, painter, dummyOption, dummyWidget=None):
def paint(self, painter, unusedOption, unusedWidget=None):
"""paint the marker"""
with Painter(painter):
painter.setBrush(self.__brush)
......@@ -380,11 +380,11 @@ class Board(QGraphicsRectItem, StrMixin):
idx = action.data()
return variants[idx]
def dragEnterEvent(self, dummyEvent):
def dragEnterEvent(self, unusedEvent):
"""drag enters the HandBoard: highlight it"""
self.setPen(QPen(QColor(self.penColor)))
def dragLeaveEvent(self, dummyEvent):
def dragLeaveEvent(self, unusedEvent):
"""drag leaves the HandBoard"""
self._noPen()
......@@ -481,7 +481,7 @@ class Board(QGraphicsRectItem, StrMixin):
newY = self.__yWidth * width + self.__yHeight * height + offsets[1]
QGraphicsRectItem.setPos(self, newX, newY)
def showShadowsChanged(self, dummyOldValue, newValue):
def showShadowsChanged(self, unusedOldValue, newValue):
"""set active lightSource"""
for uiTile in self.uiTiles:
uiTile.setClippingFlags()
......@@ -795,7 +795,7 @@ class FittingView(QGraphicsView):
return
Internal.mainWindow.changeAngle()
def resizeEvent(self, dummyEvent):
def resizeEvent(self, unusedEvent):
"""scale the scene and its background for new view size"""
Internal.Preferences.callTrigger(
'tilesetName') # this redraws and resizes
......@@ -918,7 +918,7 @@ class YellowText(QGraphicsRectItem):
else:
self.moveBy(xOffset, yOffset)
def paint(self, painter, dummyOption, dummyWidget):
def paint(self, painter, unusedOption, unusedWidget):
"""override predefined paint"""
painter.setFont(self.font)
painter.fillRect(self.rect(), QBrush(QColor('yellow')))
......
......@@ -61,7 +61,7 @@ class ChatModel(QAbstractTableModel):
return 0
return len(self.chatLines)
def columnCount(self, dummyParent=None): # pylint: disable=no-self-use
def columnCount(self, unusedParent=None): # pylint: disable=no-self-use
"""for now we only have time, who, message"""
return 3
......
......@@ -173,7 +173,7 @@ class Client(pb.Referenceable):
if table.tableid == tableid:
return table
def logout(self, dummyResult=None): # pylint: disable=no-self-use
def logout(self, unusedResult=None): # pylint: disable=no-self-use
"""virtual"""
return succeed(None)
......@@ -217,7 +217,7 @@ class Client(pb.Referenceable):
self.tables.append(newTable)
return oldTable, newTable
def remote_tableRemoved(self, tableid, dummyMsg, *dummyMsgArgs):
def remote_tableRemoved(self, tableid, unusedMsg, *unusedMsgArgs): # pylint: disable=unused-argument
"""update table list"""
table = self._tableById(tableid)
if table:
......@@ -356,7 +356,7 @@ class Client(pb.Referenceable):
else:
return Message.jelly(value, value)
def remote_move(self, playerName, command, *dummyArgs, **kwargs):
def remote_move(self, playerName, command, *unusedArgs, **kwargs): # pylint: disable=unused-argument
"""the server sends us info or a question and always wants us to answer"""
if Internal.scene and not isAlive(Internal.scene):
return fail()
......
......@@ -36,7 +36,7 @@ except ImportError:
try:
from sip import unwrapinstance
except ImportError:
def unwrapinstance(dummy):
def unwrapinstance(unused):
"""if there is no sip, we have no Qt objects anyway"""
pass
......
......@@ -215,6 +215,6 @@ class Sorry(DeferredDialog):
DeferredDialog.__init__(self, dialog, modal=modal, always=always)
def NoPrompt(dummyMsg):
def NoPrompt(unusedMsg):
"""we just want to be able to add callbacks even if non-interactive"""
return succeed(None)
......@@ -38,7 +38,7 @@ class DifferModel(QAbstractTableModel):
self.diffs = diffs
self.view = view
def columnCount(self, dummyIndex=QModelIndex()):
def columnCount(self, unusedIndex=QModelIndex()):
# pylint: disable=no-self-use
"""how many columns does this node have?"""
return 3 # rule name, left values, right values
......
......@@ -44,7 +44,7 @@ class GamesModel(QAbstractTableModel):
QAbstractTableModel.__init__(self)
self._resultRows = []
def columnCount(self, dummyParent=None): # pylint: disable=no-self-use
def columnCount(self, unusedParent=None): # pylint: disable=no-self-use
"""including the hidden col 0"""
return 3
......@@ -156,7 +156,7 @@ class Games(QDialog):
self.view.doubleClicked.connect(self.loadGame)
chkPending.stateChanged.connect(self.pendingOrNot)
def showEvent(self, dummyEvent):
def showEvent(self, unusedEvent):
"""only now get the data set. Not doing this in__init__ would eventually
make it easier to subclass from some generic TableEditor class"""
self.setQuery()
......
......@@ -64,7 +64,7 @@ class TileAttr(StrMixin):
else:
return not self.tile.isKnown
def setFocusable(self, hand, meld, dummyIdx):
def setFocusable(self, hand, meld, unusedIdx):
"""is it focusable?"""
player = hand.player
return (
......@@ -130,7 +130,7 @@ class HandBoard(Board):
"""for debugging messages"""
return self.player.name
def showShadowsChanged(self, dummyOldValue, dummyNewValue):
def showShadowsChanged(self, unusedOldValue, unusedNewValue):
"""Add or remove the shadows."""
self.setPosition()
......@@ -149,7 +149,7 @@ class HandBoard(Board):
self._reload(self.tileset, showShadows=show)
self.sync()
def rearrangeMeldsChanged(self, dummyOldValue, newValue):
def rearrangeMeldsChanged(self, unusedOldValue, newValue):
"""when True, concealed melds are grouped"""
self.concealedMeldDistance = (
self.exposedMeldDistance if newValue else 0.0)
......
......@@ -75,7 +75,7 @@ class SelectChow(KDialogIgnoringEscape):
if chow == propose:
self.buttons[idx].setFocus()
def toggled(self, dummyChecked):
def toggled(self, unusedChecked):
"""a radiobutton has been toggled"""
button = self.sender()
if button.isChecked():
......@@ -109,7 +109,7 @@ class SelectKong(KDialogIgnoringEscape):
widget.setLayout(layout)
self.setMainWidget(widget)
def toggled(self, dummyChecked):
def toggled(self, unusedChecked):
"""a radiobutton has been toggled"""
button = self.sender()
if button.isChecked():
......@@ -325,7 +325,7 @@ class ClientDialog(QDialog):
geometry.setHeight(int(height))
self.setGeometry(geometry)
def showEvent(self, dummyEvent):
def showEvent(self, unusedEvent):
"""try to place the dialog such that it does not cover interesting information"""
self.placeInField()
......@@ -365,7 +365,7 @@ class ClientDialog(QDialog):
Internal.scene.clientDialog = None
self.deferred.callback(answer)
def selectedAnswer(self, dummyChecked):
def selectedAnswer(self, unusedChecked):
"""the user clicked one of the buttons"""
game = self.client.game
if game and not game.autoPlay:
......@@ -398,7 +398,7 @@ class HumanClient(Client):
"""return True if clients is cleaned"""
return len(clients) == 0 or (exception and clients == [exception])
def disconnectedClient(dummyResult, client):
def disconnectedClient(unusedResult, client):
"""now the client is really disconnected from the server"""
if client in clients:
# HumanClient.serverDisconnects also removes it!
......@@ -442,7 +442,7 @@ class HumanClient(Client):
voiceId, maxGameId,
Internal.defaultPort).addCallbacks(self.__initTableList, self.__versionError)
def __initTableList(self, dummy):
def __initTableList(self, unused):
"""first load of the list. Process options like --demo, --table, --join"""
self.showTableList()
if SingleshotOptions.table:
......@@ -470,7 +470,7 @@ class HumanClient(Client):
self.__showTables()
@staticmethod
def __loginFailed(dummy):
def __loginFailed(unused):
"""as the name says"""
if Internal.scene:
Internal.scene.startingGame = False
......@@ -497,13 +497,13 @@ class HumanClient(Client):
if self.tableList:
self.tableList.loadTables(self.tables)
def __showTables(self, dummy=None):
def __showTables(self, unused=None):
"""load and show tables. We may be used as a callback. In that case,
clientTables is the id of a new table - which we do not need here"""
self.tableList.loadTables(self.tables)
self.tableList.show()
def showTableList(self, dummy=None):
def showTableList(self, unused=None):
"""allocate it if needed"""
if not self.tableList:
self.tableList = TableList(self)
......@@ -571,7 +571,7 @@ class HumanClient(Client):
# others will then automatically leave too
for name in oldTable.playerNames:
if name != self.name and not newTable.isOnline(name):
def sorried(dummy):
def sorried(unused):
"""user ack"""
game = self.game
if game:
......@@ -620,7 +620,7 @@ class HumanClient(Client):
else:
return Message.NoGameStart
def cancelled(dummy):
def cancelled(unused):
"""the user does not want to start now. Back to table list"""
if Debug.table:
logDebug('%s: Readyforgamestart returns Message.NoGameStart for table %s' % (
......@@ -651,7 +651,7 @@ class HumanClient(Client):
def readyForHandStart(self, playerNames, rotateWinds):
"""playerNames are in wind order ESWN. Never called for first hand."""
def answered(dummy=None):
def answered(unused=None):
"""called after the client player said yes, I am ready"""
if self.connection:
return Client.readyForHandStart(self, playerNames, rotateWinds)
......@@ -767,7 +767,7 @@ class HumanClient(Client):
def remote_gameOver(self, tableid, message, *args):
"""the game is over"""
def yes(dummy):
def yes(unused):
"""now that the user clicked the 'game over' prompt away, clean up"""
if self.game:
self.game.rotateWinds()
......@@ -799,7 +799,7 @@ class HumanClient(Client):
if scene and game and scene.game == game:
scene.game = None
def serverDisconnected(self, dummyReference):
def serverDisconnected(self, unusedReference):
"""perspective calls us back"""
if self.connection and (Debug.traffic or Debug.connections):
logDebug(
......@@ -869,7 +869,7 @@ class HumanClient(Client):
table = self.tableList.selectedTable()
self.callServer('joinTable', table.tableid).addErrback(self.tableError)
def logout(self, dummyResult=None):
def logout(self, unusedResult=None):
"""clean visual traces and logout from server"""
def loggedout(result, connection):
"""end the connection from client side"""
......
......@@ -49,7 +49,7 @@ class AIDefault:
return self.__class__.__name__[2:]
@staticmethod
def weighSameColors(dummyAiInstance, candidates):
def weighSameColors(unusedAiInstance, candidates):
"""weigh tiles of same group against each other"""
for candidate in candidates:
if candidate.group in Tile.colors:
......@@ -105,7 +105,7 @@ class AIDefault:
return candidates
@staticmethod
def alternativeFilter(dummyAiInstance, candidates):
def alternativeFilter(unusedAiInstance, candidates):
"""if the alternative AI only adds tests without changing
default filters, you can override this one to minimize
the source size of the alternative AI"""
......@@ -159,7 +159,7 @@ class AIDefault:
return candidates
@staticmethod
def weighSpecialGames(dummyAiInstance, candidates):
def weighSpecialGames(unusedAiInstance, candidates):
"""like color game, many dragons, many winds"""
for candidate in candidates:
tile = candidate.tile
......
......@@ -753,7 +753,7 @@ def main():
evaluate(readGames(OPTIONS.csv))
def cleanup(sig, dummyFrame):
def cleanup(sig, unusedFrame):
"""at program end"""
Server.stopAll()
sys.exit(sig)
......
......@@ -246,7 +246,7 @@ class Help:
"""returns the best match for the online user manual"""
from twisted.web import client
def processResult(dummyResult, fallbacks):
def processResult(unusedResult, fallbacks):
"""if status 404, try the next fallback language"""
return Help.__getDocUrl(fallbacks) if factory.status == '404' else url
host = 'docs.kde.org'
......@@ -295,7 +295,7 @@ class KMessageBox:
@staticmethod
def createKMessageBox(
dialog, icon, text, dummyStrlist, dummyAsk, dummyCheckboxReturn, options):
dialog, icon, text, unusedStrlist, unusedAsk, unusedCheckboxReturn, options):
"""translated as far as needed from kmessagegox.cpp"""
# pylint: disable=too-many-locals
mainLayout = QVBoxLayout()
......@@ -1292,7 +1292,7 @@ class KConfigDialog(KDialog):
cls.dialog.show()
return cls.dialog
def showEvent(self, dummyEvent):
def showEvent(self, unusedEvent):
"""if the settings dialog shows, remember current values
and show them in the widgets"""
self.orgPref = self.preferences.as_dict()
......
......@@ -281,7 +281,7 @@ class LoginDlg(QDialog):
self.serverChanged()
StateSaver(self)
def returns(self, dummyButton=None):
def returns(self, unusedButton=None):
"""login data returned by this dialog"""
return (Url(self.url), self.username, self.password, self.__defineRuleset())
......@@ -316,7 +316,7 @@ class LoginDlg(QDialog):
self.cbUser.setSizePolicy(pol)
self.__port = None
def serverChanged(self, dummyText=None):
def serverChanged(self, unusedText=None):
"""the user selected a different server"""
records = Query('select player.name from player, passwords '
'where passwords.url=? and passwords.player = player.id', (self.url,)).records
......@@ -434,7 +434,7 @@ class AddUserDialog(KDialog):
self.passwordChanged()
self.edPassword2.setFocus()
def passwordChanged(self, dummyText=None):
def passwordChanged(self, unusedText=None):
"""password changed"""
self.validate()
......@@ -526,7 +526,7 @@ class Connection:
"""if needed"""
return self.url.startServer(result)
def __loginToServer(self, dummy=None):
def __loginToServer(self, unused=None):
"""login to server"""
return self.loginCommand(self.username).addErrback(self._loginFailed)
......@@ -560,7 +560,7 @@ class Connection:
Query('insert into passwords(url,player,password) values(?,?,?)',
(self.url, playerId, self.password))
def __checkExistingConnections(self, dummy=None):
def __checkExistingConnections(self, unused=None):
"""do we already have a connection to the wanted URL?"""
for client in self.client.humanClients:
if client.connection and client.connection.url == self.url:
......@@ -646,7 +646,7 @@ class Connection:
logWarning(msg)
raise CancelledError
def pingLater(self, dummyResult=None):
def pingLater(self, unusedResult=None):
"""ping the server every 5 seconds"""
Internal.reactor.callLater(5, self.ping)
......
......@@ -105,7 +105,7 @@ if len(NOTFOUND):
sys.exit(3)
def cleanExit(*dummyArgs):
def cleanExit(*unusedArgs): # pylint: disable=unused-argument
"""close sqlite3 files before quitting"""
if isAlive(Internal.mainWindow):
if Debug.quit:
......@@ -362,7 +362,7 @@ class MainWindow(KXmlGuiWindow):
else:
self.setWindowState(self.windowState() & ~Qt.WindowFullScreen)
def close(self, dummyResult=None):
def close(self, unusedResult=None):
"""wrap close() because we call it with a QTimer"""
if isAlive(self):
ParallelAnimationGroup.cancelAll()
......@@ -613,7 +613,7 @@ class MainWindow(KXmlGuiWindow):
view.fitInView(scene.itemsBoundingRect(), Qt.KeepAspectRatio)
@afterQueuedAnimations
def backgroundChanged(self, dummyDeferredResult, dummyOldName, newName):
def backgroundChanged(self, unusedDeferredResult, unusedOldName, newName):
"""if the wanted background changed, apply the change now"""
centralWidget = self.centralWidget()
if centralWidget:
......@@ -623,7 +623,7 @@ class MainWindow(KXmlGuiWindow):
@afterQueuedAnimations
def tilesetNameChanged(
self, dummyDeferredResult, dummyOldValue=None, dummyNewValue=None, *dummyArgs):
self, unusedDeferredResult, unusedOldValue=None, unusedNewValue=None, *unusedArgs): # pylint: disable=unused-argument
"""if the wanted tileset changed, apply the change now"""
if self.centralView:
with AnimationSpeed():
......@@ -632,7 +632,7 @@ class MainWindow(KXmlGuiWindow):
self.adjustMainView()
@afterQueuedAnimations
def showSettings(self, dummyDeferredResult, dummyChecked=None):
def showSettings(self, unusedDeferredResult, unusedChecked=None):
"""show preferences dialog. If it already is visible, do nothing"""
# This is called by the triggered() signal. So why does KDE
# not return the bool checked?
......@@ -686,7 +686,7 @@ class MainWindow(KXmlGuiWindow):
scene.updateSceneGUI()
@afterQueuedAnimations
def changeAngle(self, deferredResult, dummyButtons=None, dummyModifiers=None): # pylint: disable=unused-argument
def changeAngle(self, deferredResult, unusedButtons=None, unusedModifiers=None): # pylint: disable=unused-argument
"""change the lightSource"""
if self.scene:
with AnimationSpeed():
......
......@@ -199,23 +199,23 @@ class Meld(TileList, StrMixin):
rulesetId] if x.appliesToMeld(hand, self))
return result
def append(self, dummy):
def append(self, unused):
"""we want to be immutable"""
raise TypeError
def extend(self, dummy):
def extend(self, unused):
"""we want to be immutable"""
raise TypeError
def insert(self, dummy):
def insert(self, unused):
"""we want to be immutable"""
raise TypeError
def pop(self, dummy):
def pop(self, unused):
"""we want to be immutable"""
raise TypeError
def remove(self, dummy):
def remove(self, unused):
"""we want to be immutable"""
raise TypeError
......
......@@ -114,7 +114,7 @@ class ServerMessage(Message):
sendScore = False
needsGame = True # message only applies to an existing game
def clientAction(self, dummyClient, move):
def clientAction(self, unusedClient, move):
"""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, dummyButton, dummyTile):
def toolTip(self, unusedButton, unusedTile):
"""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, dummyTable, msg):
def serverAction(self, unusedTable, msg):
"""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, dummyClient, move):
def notifyAction(self, unusedClient, move):
"""the default action for immediate notifications"""
move.player.popupMsg(self)
......@@ -202,7 +202,7 @@ class PungChowMessage(NotifyAtOnceMessage):
def __init__(self, name=None, shortcut=None):
NotifyAtOnceMessage.__init__(self, name=name, shortcut=shortcut)
def toolTip(self, button, dummyTile):
def toolTip(self, button, unusedTile):
"""for the action button which will send this message"""
myself = button.client.game.myself
maySay = myself.sayable[self]
......@@ -270,7 +270,7 @@ class MessageKong(NotifyAtOnceMessage, ServerMessage):
else:
table.declareKong(msg.player, Meld(msg.args[0]))
def toolTip(self, button, dummyTile):
def toolTip(self, button, unusedTile):
"""for the action button which will send this message"""
myself = button.client.game.myself
maySay = myself.sayable[self]
......@@ -342,11 +342,11 @@ class MessageMahJongg(NotifyAtOnceMessage, ServerMessage):
"""the server mirrors that and tells all others"""
table.claimMahJongg(msg)
def toolTip(self, dummyButton, dummyTile):
def toolTip(self, unusedButton, unusedTile):
"""returns text and warning flag for button and text for tile"""
return i18n('Press here and you win'), False, ''
def clientAction(self, dummyClient, move):
def clientAction(self, unusedClient, move):
"""mirror the mahjongg action locally. Check if the balances are correct."""
return move.player.declaredMahJongg(move.melds, move.withDiscardTile,
move.lastTile, move.lastMeld)
......@@ -550,7 +550,7 @@ class MessageShowConcealedTiles(ServerMessage):
"""the game server assigns tiles to player"""
def clientAction(self, dummyClient, move):
def clientAction(self, unusedClient, move):
"""set tiles for player"""
return move.player.showConcealedTiles(move.tiles, move.show)
......@@ -625,7 +625,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, dummyClient, move):
def clientAction(self, unusedClient, 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)
......@@ -637,7 +637,7 @@ class MessageVoiceData(ServerMessage):
"""we got voice sounds from the server, assign them to the player voice"""
def clientAction(self, dummyClient, move):
def clientAction(self, unusedClient, move):
"""server sent us voice sounds about somebody else"""
move.player.voice = Voice(move.md5sum, move.source)
if Debug.sound:
......@@ -664,7 +664,7 @@ class MessageServerWantsVoiceData(ServerMessage):
"""The server wants voice sounds from a client"""
def clientAction(self, dummyClient, move):
def clientAction(self, unusedClient, move):
"""send voice sounds as requested to server"""
if Debug.sound:
logDebug('%s: send wanted voice data %s to server' % (
......@@ -676,7 +676,7 @@ class MessageServerGetsVoiceData(ClientMessage):
"""The server gets voice sounds from a client"""
def serverAction(self, dummyTable, msg):
def serverAction(self, unusedTable, msg):
"""save voice sounds on the server"""
voice = msg.player.voice
voice.archiveContent = msg.args[0]
......@@ -795,7 +795,7 @@ class MessageError(ServerMessage):
"""a client errors"""
needsGame = False
def clientAction(self, dummyClient, move):
def clientAction(self, unusedClient, move):
"""show the error message from server"""
return logWarning(move.source)
......@@ -815,7 +815,7 @@ class MessageOK(ClientMessage):
name=i18ncE('kajongg', 'OK'),
shortcut=i18ncE('kajongg game dialog:Key for OK', 'O'))
def toolTip(self, dummyButton, dummyTile):