3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-11-27 21:19:31 +01:00

updateTS: remove usage of mutable as function default argument

This may subtly break things: https://docs.quantifiedcode.com/python-anti-patterns/correctness/mutable_default_value_as_argument.html
This commit is contained in:
James Lu 2017-04-09 14:44:36 -07:00
parent 9d50a4363b
commit 6d96dd21ac

View File

@ -1450,7 +1450,7 @@ class Protocol():
log.debug('Removing client %s from self.irc.servers[%s].users', numeric, sid) log.debug('Removing client %s from self.irc.servers[%s].users', numeric, sid)
self.irc.servers[sid].users.discard(numeric) self.irc.servers[sid].users.discard(numeric)
def updateTS(self, sender, channel, their_ts, modes=[]): def updateTS(self, sender, channel, their_ts, modes=None):
""" """
Merges modes of a channel given the remote TS and a list of modes. Merges modes of a channel given the remote TS and a list of modes.
""" """
@ -1461,6 +1461,9 @@ class Protocol():
# mode origin is us | OVERWRITE | MERGE | IGNORE # mode origin is us | OVERWRITE | MERGE | IGNORE
# mode origin is uplink | IGNORE | MERGE | OVERWRITE # mode origin is uplink | IGNORE | MERGE | OVERWRITE
if modes is None:
modes = []
def _clear(): def _clear():
log.debug("(%s) Clearing local modes from channel %s due to TS change", self.irc.name, log.debug("(%s) Clearing local modes from channel %s due to TS change", self.irc.name,
channel) channel)