Skip to content

Commit

Permalink
pylint: fix __init__ not called
Browse files Browse the repository at this point in the history
git-svn-id: https://xpra.org/svn/Xpra/trunk@21696 3bb7dfac-3a0b-4e04-842a-767bc560f471
  • Loading branch information
totaam committed Feb 19, 2019
1 parent 730e0ee commit 59a1424
Showing 1 changed file with 19 additions and 16 deletions.
35 changes: 19 additions & 16 deletions src/xpra/client/client_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ def __init__(self):
#skip doing internal init again:
if not hasattr(self, "exit_code"):
self.defaults_init()
ServerInfoMixin.__init__(self)
FilePrintMixin.__init__(self)
self._init_done = False
#insert in order:
Expand Down Expand Up @@ -137,7 +138,7 @@ def defaults_init(self):
self.init_packet_handlers()
sanity_checks()

def init(self, opts, _extra_args=[]):
def init(self, opts, _extra_args=()):
if self._init_done:
#the gtk client classes can inherit this method
#from multiple parents, skip initializing twice
Expand All @@ -156,8 +157,6 @@ def init(self, opts, _extra_args=[]):
self.encryption_keyfile = opts.encryption_keyfile or opts.tcp_encryption_keyfile
#register the authentication challenge handlers:
ch = tuple(x.strip().lower() for x in (opts.challenge_handlers or "").split(","))
def has_h(name):
return "all" in ch or name in ch
for ch_name in ch:
if ch_name=="all":
self.challenge_handlers.update(self.default_challenge_methods)
Expand All @@ -173,14 +172,14 @@ def has_h(name):
self.timeout_add(10*1000, print_leaks)


def timeout_add(self, *args):
raise Exception("override me!")
def timeout_add(self, *_args):
raise NotImplementedError("override me!")

def idle_add(self, *args):
raise Exception("override me!")
def idle_add(self, *_args):
raise NotImplementedError("override me!")

def source_remove(self, *args):
raise Exception("override me!")
def source_remove(self, *_args):
raise NotImplementedError("override me!")


def may_notify(self, nid, summary, body, *args, **kwargs):
Expand All @@ -203,7 +202,8 @@ def handle_app_signal(self, signum, _frame=None):
signal.signal(signal.SIGINT, self.handle_deadly_signal)
signal.signal(signal.SIGTERM, self.handle_deadly_signal)
self.signal_cleanup()
self.timeout_add(0, self.signal_disconnect_and_quit, 128 + signum, "exit on signal %s" % SIGNAMES.get(signum, signum))
reason = "exit on signal %s" % SIGNAMES.get(signum, signum)
self.timeout_add(0, self.signal_disconnect_and_quit, 128 + signum, reason)

def install_signal_handlers(self):
signal.signal(signal.SIGINT, self.handle_app_signal)
Expand Down Expand Up @@ -296,7 +296,7 @@ def remove_packet_handlers(self, *keys):
for d in (self._packet_handlers, self._ui_packet_handlers):
try:
del d[k]
except:
except KeyError:
pass

def set_packet_handlers(self, to, defs):
Expand Down Expand Up @@ -505,7 +505,8 @@ def have_more(self):
p.source_has_more()

def next_packet(self):
netlog("next_packet() packets in queues: priority=%i, ordinary=%i, mouse=%s", len(self._priority_packets), len(self._ordinary_packets), bool(self._mouse_position))
netlog("next_packet() packets in queues: priority=%i, ordinary=%i, mouse=%s",
len(self._priority_packets), len(self._ordinary_packets), bool(self._mouse_position))
synchronous = True
if self._priority_packets:
packet = self._priority_packets.pop(0)
Expand Down Expand Up @@ -566,7 +567,7 @@ def _process_disconnect(self, packet):
#ie: ("disconnect", "version error", "incompatible version")
info = tuple(nonl(bytestostr(x)) for x in packet[1:])
reason = info[0]
if self.server_capabilities is None or len(self.server_capabilities)==0:
if not self.server_capabilities:
#server never sent hello to us - so disconnect is an error
#(but we don't know which one - the info message may help)
self.server_disconnect_warning("disconnected before the session could be established", *info)
Expand Down Expand Up @@ -939,7 +940,8 @@ def get_encryption_key(self):
if not key:
XPRA_ENCRYPTION_KEY = "XPRA_ENCRYPTION_KEY"
key = strtobytes(os.environ.get(XPRA_ENCRYPTION_KEY, ''))
cryptolog("get_encryption_key() got %i bytes from '%s' environment variable", len(key or ""), XPRA_ENCRYPTION_KEY)
cryptolog("get_encryption_key() got %i bytes from '%s' environment variable",
len(key or ""), XPRA_ENCRYPTION_KEY)
if not key:
raise InitExit(1, "no encryption key")
return key.strip(b"\n\r")
Expand All @@ -960,7 +962,7 @@ def _process_hello(self, packet):

def capsget(self, capabilities, key, default):
v = capabilities.get(strtobytes(key), default)
if PYTHON3 and type(v)==bytes:
if PYTHON3 and isinstance(v, bytes):
v = bytestostr(v)
return v

Expand Down Expand Up @@ -1070,4 +1072,5 @@ def process_packet(self, _proto, packet):
except KeyboardInterrupt:
raise
except:
netlog.error("Unhandled error while processing a '%s' packet from peer using %s", packet_type, handler, exc_info=True)
netlog.error("Unhandled error while processing a '%s' packet from peer using %s",
packet_type, handler, exc_info=True)

0 comments on commit 59a1424

Please sign in to comment.