# HG changeset patch # User souliane # Date 1402848984 -7200 # Node ID 437eefa53a0139dfda19cf1ac0e01b514af4a96a # Parent bbdc5357dc0006d4e88429126bc139f71c05ec46 misc: remove some pylint errors and warnings diff -r bbdc5357dc00 -r 437eefa53a01 src/browser/libervia_main.py --- a/src/browser/libervia_main.py Sun Jun 15 17:52:08 2014 +0200 +++ b/src/browser/libervia_main.py Sun Jun 15 18:16:24 2014 +0200 @@ -693,9 +693,10 @@ def _presenceUpdateCb(self, entity, show, priority, statuses): entity_jid = jid.JID(entity) if self.whoami and self.whoami == entity_jid: # XXX: QnD way to get our presence/status - self.status_panel.setPresence(show) + assert(isinstance(self.status_panel, panels.PresenceStatusPanel)) + self.status_panel.setPresence(show) # pylint: disable=E1103 if statuses: - self.status_panel.setStatus(statuses.values()[0]) + self.status_panel.setStatus(statuses.values()[0]) # pylint: disable=E1103 else: self.contact_panel.setConnected(entity_jid.bare, entity_jid.resource, show, priority, statuses) @@ -801,8 +802,8 @@ def _contactDeletedCb(self, entity): self.contact_panel.removeContact(entity) - def _newContactCb(self, contact, attributes, groups): - self.contact_panel.updateContact(contact, attributes, groups) + def _newContactCb(self, contact_jid, attributes, groups): + self.contact_panel.updateContact(contact_jid, attributes, groups) def _entityDataUpdatedCb(self, entity_jid_s, key, value): if key == "avatar": @@ -892,7 +893,8 @@ elif type_ == "COMMENT": self.bridge.call("sendMblogComment", None, entities, text, extra) elif type_ == "STATUS": - self.bridge.call('setStatus', None, self.status_panel.presence, text) + assert(isinstance(self.status_panel, panels.PresenceStatusPanel)) + self.bridge.call('setStatus', None, self.status_panel.presence, text) # pylint: disable=E1103 elif type_ in ("groupchat", "chat"): addresses.append((addr, entities)) else: diff -r bbdc5357dc00 -r 437eefa53a01 src/browser/sat_browser/panels.py --- a/src/browser/sat_browser/panels.py Sun Jun 15 17:52:08 2014 +0200 +++ b/src/browser/sat_browser/panels.py Sun Jun 15 18:16:24 2014 +0200 @@ -978,14 +978,14 @@ self._accepted_groups.append(_group) self._accepted_groups.sort() - def isJidAccepted(self, jid): + def isJidAccepted(self, jid_s): """Tell if a jid is actepted and shown in this panel - @param jid: jid + @param jid_s: jid @return: True if the jid is accepted""" if self.accept_all(): return True for group in self._accepted_groups: - if self.host.contact_panel.isContactInGroup(group, jid): + if self.host.contact_panel.isContactInGroup(group, jid_s): return True return False diff -r bbdc5357dc00 -r 437eefa53a01 src/server/server.py --- a/src/server/server.py Sun Jun 15 17:52:08 2014 +0200 +++ b/src/server/server.py Sun Jun 15 18:16:24 2014 +0200 @@ -181,7 +181,7 @@ #user is not identified, we return a jsonrpc fault parsed = jsonrpclib.loads(request.content.read()) fault = jsonrpclib.Fault(C.ERRNUM_LIBERVIA, C.NOT_ALLOWED) # FIXME: define some standard error codes for libervia - return jsonrpc.JSONRPC._cbRender(self, fault, request, parsed.get('id'), parsed.get('jsonrpc')) + return jsonrpc.JSONRPC._cbRender(self, fault, request, parsed.get('id'), parsed.get('jsonrpc')) # pylint: disable=E1103 return jsonrpc.JSONRPC.render(self, request) def jsonrpc_getProfileJid(self): @@ -580,14 +580,14 @@ return self.loginOrRegister(request) _session = request.getSession() parsed = jsonrpclib.loads(request.content.read()) - method = parsed.get("method") + method = parsed.get("method") # pylint: disable=E1103 if method not in ['isRegistered', 'registerParams', 'getMenus']: #if we don't call these methods, we need to be identified profile = ISATSession(_session).profile if not profile: #user is not identified, we return a jsonrpc fault fault = jsonrpclib.Fault(C.ERRNUM_LIBERVIA, C.NOT_ALLOWED) # FIXME: define some standard error codes for libervia - return jsonrpc.JSONRPC._cbRender(self, fault, request, parsed.get('id'), parsed.get('jsonrpc')) + return jsonrpc.JSONRPC._cbRender(self, fault, request, parsed.get('id'), parsed.get('jsonrpc')) # pylint: disable=E1103 self.request = request return jsonrpc.JSONRPC.render(self, request) @@ -855,7 +855,7 @@ if not profile in self.sat_host.prof_connected: return if profile in self.signalDeferred: - self.signalDeferred[profile].callback((function_name,args[:-1])) + self.signalDeferred[profile].callback((function_name, args[:-1])) del self.signalDeferred[profile] else: if profile not in self.queue: @@ -892,7 +892,7 @@ if not profile: #user is not identified, we return a jsonrpc fault fault = jsonrpclib.Fault(C.ERRNUM_LIBERVIA, C.NOT_ALLOWED) # FIXME: define some standard error codes for libervia - return jsonrpc.JSONRPC._cbRender(self, fault, request, parsed.get('id'), parsed.get('jsonrpc')) + return jsonrpc.JSONRPC._cbRender(self, fault, request, parsed.get('id'), parsed.get('jsonrpc')) # pylint: disable=E1103 self.request = request return jsonrpc.JSONRPC.render(self, request) @@ -1018,8 +1018,8 @@ ['security_warning', 'w', 1, _(u'Warn user that he is about to connect on HTTP.').encode('utf-8'), int], ['passphrase', 'k', '', (_(u"Passphrase for the SàT profile named '%s'") % C.SERVICE_PROFILE).encode('utf-8'), str], ['data_dir', 'd', DATA_DIR_DEFAULT, _(u'Data directory for Libervia').encode('utf-8'), coerceDataDir], - ] # options which are in sat.conf and on command line, see https://twistedmatrix.com/documents/current/api/twisted.python.usage.Options.html - OPT_PARAMETERS_CFG = [['empty_password_allowed_warning_dangerous_list', None, '', None]] # Options which are in sat.conf only + ] # options which are in sat.conf and on command line, see https://twistedmatrix.com/documents/current/api/twisted.python.usage.Options.html + OPT_PARAMETERS_CFG = [['empty_password_allowed_warning_dangerous_list', None, '', None]] # Options which are in sat.conf only def __init__(self, *args, **kwargs): self.initialised = defer.Deferred()