Fix no-else-raise pylint errors
This commit is contained in:
parent
30f850b567
commit
c8815a9230
|
@ -307,8 +307,7 @@ class JingleFileTransfer(JingleContent):
|
|||
self.__state_changed(State.CAND_SENT_AND_RECEIVED, args)
|
||||
self.__state_changed(State.TRANSFERING)
|
||||
raise nbxmpp.NodeProcessed
|
||||
else:
|
||||
self.__state_changed(State.CAND_RECEIVED, args)
|
||||
self.__state_changed(State.CAND_RECEIVED, args)
|
||||
|
||||
def __on_iq_result(self, stanza, content, error, action):
|
||||
log.info("__on_iq_result")
|
||||
|
|
|
@ -593,9 +593,9 @@ class JingleSession:
|
|||
text = 'Content %s (created by %s) does not exist' % (name, creator)
|
||||
self.__send_error(stanza, 'bad-request', text=text, type_='_modify')
|
||||
raise nbxmpp.NodeProcessed
|
||||
else:
|
||||
cn = self.contents[(creator, name)]
|
||||
cn.on_stanza(stanza, content, error, action)
|
||||
|
||||
cn = self.contents[(creator, name)]
|
||||
cn.on_stanza(stanza, content, error, action)
|
||||
|
||||
def __on_session_terminate(self, stanza, jingle, error, action):
|
||||
self.connection.delete_jingle_session(self.sid)
|
||||
|
|
|
@ -438,44 +438,44 @@ class AdHocCommands(BaseModule):
|
|||
self._sessions[(jid, sessionid, node)] = obj
|
||||
self._log.info('Comand %s executed: %s', node, jid)
|
||||
raise nbxmpp.NodeProcessed
|
||||
else:
|
||||
# the command is already running, check for it
|
||||
magictuple = (jid, sessionid, node)
|
||||
if magictuple not in self._sessions:
|
||||
# we don't have this session... ha!
|
||||
self._log.warning('Invalid session %s', magictuple)
|
||||
raise nbxmpp.NodeProcessed
|
||||
|
||||
action = cmd.getAttr('action')
|
||||
obj = self._sessions[magictuple]
|
||||
|
||||
try:
|
||||
if action == 'cancel':
|
||||
rc = obj.cancel(stanza)
|
||||
elif action == 'prev':
|
||||
rc = obj.prev(stanza)
|
||||
elif action == 'next':
|
||||
rc = obj.next(stanza)
|
||||
elif action == 'execute' or action is None:
|
||||
rc = obj.execute(stanza)
|
||||
elif action == 'complete':
|
||||
rc = obj.complete(stanza)
|
||||
else:
|
||||
# action is wrong. stop the session, send error
|
||||
raise AttributeError
|
||||
except AttributeError:
|
||||
# the command probably doesn't handle invoked action...
|
||||
# stop the session, return error
|
||||
del self._sessions[magictuple]
|
||||
self._log.warning('Wrong action %s %s', node, jid)
|
||||
raise nbxmpp.NodeProcessed
|
||||
|
||||
# delete the session if rc is False
|
||||
if not rc:
|
||||
del self._sessions[magictuple]
|
||||
|
||||
# the command is already running, check for it
|
||||
magictuple = (jid, sessionid, node)
|
||||
if magictuple not in self._sessions:
|
||||
# we don't have this session... ha!
|
||||
self._log.warning('Invalid session %s', magictuple)
|
||||
raise nbxmpp.NodeProcessed
|
||||
|
||||
action = cmd.getAttr('action')
|
||||
obj = self._sessions[magictuple]
|
||||
|
||||
try:
|
||||
if action == 'cancel':
|
||||
rc = obj.cancel(stanza)
|
||||
elif action == 'prev':
|
||||
rc = obj.prev(stanza)
|
||||
elif action == 'next':
|
||||
rc = obj.next(stanza)
|
||||
elif action == 'execute' or action is None:
|
||||
rc = obj.execute(stanza)
|
||||
elif action == 'complete':
|
||||
rc = obj.complete(stanza)
|
||||
else:
|
||||
# action is wrong. stop the session, send error
|
||||
raise AttributeError
|
||||
except AttributeError:
|
||||
# the command probably doesn't handle invoked action...
|
||||
# stop the session, return error
|
||||
del self._sessions[magictuple]
|
||||
self._log.warning('Wrong action %s %s', node, jid)
|
||||
raise nbxmpp.NodeProcessed
|
||||
|
||||
# delete the session if rc is False
|
||||
if not rc:
|
||||
del self._sessions[magictuple]
|
||||
|
||||
raise nbxmpp.NodeProcessed
|
||||
|
||||
def send_command(self, jid, node, session_id,
|
||||
form, action='execute'):
|
||||
"""
|
||||
|
|
|
@ -757,11 +757,10 @@ class ConnectionSocks5Bytestream(ConnectionBytestream):
|
|||
app.socks5queue.on_success[file_props.sid] = self._proxy_auth_ok
|
||||
raise nbxmpp.NodeProcessed
|
||||
|
||||
if file_props.stopped:
|
||||
self.remove_transfer(file_props)
|
||||
else:
|
||||
if file_props.stopped:
|
||||
self.remove_transfer(file_props)
|
||||
else:
|
||||
app.socks5queue.send_file(file_props, self.name, 'server')
|
||||
app.socks5queue.send_file(file_props, self.name, 'server')
|
||||
|
||||
raise nbxmpp.NodeProcessed
|
||||
|
||||
|
|
Loading…
Reference in New Issue