fix some pylint errors

This commit is contained in:
Yann Leboulanger 2017-08-24 23:01:06 +02:00
parent e57817addc
commit 8d4e815f3e
7 changed files with 25 additions and 11 deletions

View File

@ -85,6 +85,10 @@ class ChangeStatusCommand(AdHocCommand):
commandnode = 'change-status' commandnode = 'change-status'
commandname = _('Change status information') commandname = _('Change status information')
def __init__(self, conn, jid, sessionid):
AdHocCommand.__init__(self, conn, jid, sessionid)
self.cb = self.first_step
@staticmethod @staticmethod
def isVisibleFor(samejid): def isVisibleFor(samejid):
""" """
@ -93,6 +97,9 @@ class ChangeStatusCommand(AdHocCommand):
return samejid return samejid
def execute(self, request): def execute(self, request):
return self.cb(request)
def first_step(self, request):
# first query... # first query...
response, cmd = self.buildResponse(request, defaultaction = 'execute', response, cmd = self.buildResponse(request, defaultaction = 'execute',
actions = ['execute']) actions = ['execute'])
@ -120,11 +127,11 @@ class ChangeStatusCommand(AdHocCommand):
self.connection.connection.send(response) self.connection.connection.send(response)
# for next invocation # for next invocation
self.execute = self.changestatus self.cb = self.second_step
return True # keep the session return True # keep the session
def changestatus(self, request): def second_step(self, request):
# check if the data is correct # check if the data is correct
try: try:
form = dataforms.SimpleDataForm(extend = request.getTag('command').\ form = dataforms.SimpleDataForm(extend = request.getTag('command').\
@ -184,6 +191,10 @@ class LeaveGroupchatsCommand(AdHocCommand):
commandnode = 'leave-groupchats' commandnode = 'leave-groupchats'
commandname = _('Leave Groupchats') commandname = _('Leave Groupchats')
def __init__(self, conn, jid, sessionid):
AdHocCommand.__init__(self, conn, jid, sessionid)
self.cb = self.first_step
@staticmethod @staticmethod
def isVisibleFor(samejid): def isVisibleFor(samejid):
""" """
@ -192,6 +203,9 @@ class LeaveGroupchatsCommand(AdHocCommand):
return samejid return samejid
def execute(self, request): def execute(self, request):
return self.cb(request)
def first_step(self, request):
# first query... # first query...
response, cmd = self.buildResponse(request, defaultaction = 'execute', response, cmd = self.buildResponse(request, defaultaction = 'execute',
actions=['execute']) actions=['execute'])
@ -220,11 +234,11 @@ class LeaveGroupchatsCommand(AdHocCommand):
self.connection.connection.send(response) self.connection.connection.send(response)
# for next invocation # for next invocation
self.execute = self.leavegroupchats self.cb = self.second_step
return True # keep the session return True # keep the session
def leavegroupchats(self, request): def second_step(self, request):
# check if the data is correct # check if the data is correct
try: try:
form = dataforms.SimpleDataForm(extend = request.getTag('command').\ form = dataforms.SimpleDataForm(extend = request.getTag('command').\

View File

@ -305,7 +305,7 @@ class Media(nbxmpp.Node):
for uri in value: for uri in value:
self.addChild(node=uri) self.addChild(node=uri)
def fdel(self, value): def fdel(self):
for element in self.getTags('uri'): for element in self.getTags('uri'):
self.delChild(element) self.delChild(element)

View File

@ -720,7 +720,7 @@ class ConnectionSocks5Bytestream(ConnectionBytestream):
if file_props.stopped: if file_props.stopped:
self.remove_transfer(file_props) self.remove_transfer(file_props)
else: else:
app.socks5queue.send_file(file_props, self.name) app.socks5queue.send_file(file_props, self.name, 'server')
raise nbxmpp.NodeProcessed raise nbxmpp.NodeProcessed
proxy = None proxy = None

View File

@ -730,7 +730,7 @@ class Socks5(object):
try: try:
fd = self.get_fd() fd = self.get_fd()
except IOError: except IOError:
self.disconnect(False) self.disconnect()
self.file_props.error = -6 # file system error self.file_props.error = -6 # file system error
return 0 return 0
fd.write(self.remaining_buff) fd.write(self.remaining_buff)
@ -751,7 +751,7 @@ class Socks5(object):
try: try:
fd = self.get_fd() fd = self.get_fd()
except IOError: except IOError:
self.disconnect(False) self.disconnect()
self.file_props.error = -6 # file system error self.file_props.error = -6 # file system error
return 0 return 0
try: try:

View File

@ -375,7 +375,7 @@ class P2PConnection(IdleObject, PlugIn):
self.ais = socket.getaddrinfo(address['host'], address['port'], socket.AF_UNSPEC, self.ais = socket.getaddrinfo(address['host'], address['port'], socket.AF_UNSPEC,
socket.SOCK_STREAM) socket.SOCK_STREAM)
except socket.gaierror as e: except socket.gaierror as e:
log.info('Lookup failure for %s: %s[%s]', host, e[1], log.info('Lookup failure for %s: %s[%s]', self.host, e[1],
repr(e[0]), exc_info=True) repr(e[0]), exc_info=True)
if len(self.addresses_) > 0: return self.get_next_addrinfo() if len(self.addresses_) > 0: return self.get_next_addrinfo()
else: else:

View File

@ -2582,7 +2582,7 @@ class Interface:
win.hide() win.hide()
return True return True
window.connect('delete_event', on_delete) window.connect('delete_event', on_delete)
view.updateNamespace({'gajim': gajim}) view.updateNamespace({'gajim': app})
app.ipython_window = window app.ipython_window = window
def run(self, application): def run(self, application):

View File

@ -568,7 +568,7 @@ class PluginManager(metaclass=Singleton):
for option in fields: for option in fields:
if conf.get('info', option) is '': if conf.get('info', option) is '':
raise configparser.NoOptionError('field empty') raise configparser.NoOptionError(option, 'info')
if option == 'description': if option == 'description':
setattr(module_attr, option, _(conf.get('info', option))) setattr(module_attr, option, _(conf.get('info', option)))
continue continue