Commit 6ddcf4bb authored by Philipp Hörist's avatar Philipp Hörist
Browse files

Fix various pylint errors

parent f47c9025
Pipeline #8436 failed with stages
in 4 minutes and 22 seconds
......@@ -350,12 +350,12 @@ def _execute_command_received(self, _con, stanza, _properties):
else:
# action is wrong. stop the session, send error
raise AttributeError
except AttributeError:
except AttributeError as error:
# 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
raise nbxmpp.NodeProcessed from error
# delete the session if rc is False
if not rc:
......
......@@ -59,6 +59,7 @@ def _on_bob_received(self, _nbxmpp_client, result, cid):
if cid not in self.awaiting_cids:
return
# pylint: disable=cell-var-from-loop
if result.getType() == 'result':
data = result.getTags('data', namespace=Namespace.BOB)
if data.getAttr('cid') == cid:
......
......@@ -16,7 +16,6 @@
from typing import Any
from typing import List
from typing import Dict
from typing import Set
from typing import Tuple
from typing import Union
......@@ -159,7 +158,8 @@ def _bookmark_module(self):
return 'PEPBookmarks'
return 'PrivateBookmarks'
def _act_on_changed_bookmarks(self, current_bookmarks: BookmarksDict) -> None:
def _act_on_changed_bookmarks(self,
current_bookmarks: BookmarksDict) -> None:
new_bookmarks = self._convert_to_set(self._bookmarks)
old_bookmarks = self._convert_to_set(current_bookmarks)
changed = new_bookmarks - old_bookmarks
......@@ -189,7 +189,8 @@ def _convert_to_set(bookmarks: BookmarksDict) -> Set[Tuple[JID, bool]]:
return set_
@staticmethod
def _convert_to_dict(bookmarks: Optional[List[BookmarkData]]) -> BookmarksDict:
def _convert_to_dict(
bookmarks: Optional[List[BookmarkData]]) -> BookmarksDict:
_dict: BookmarksDict = {}
if not bookmarks:
return _dict
......
......@@ -564,7 +564,7 @@ def _on_bytestream_error(self, _con, iq_obj, _properties):
error_msg=''))
raise nbxmpp.NodeProcessed
def _on_bytestream_set(self, con, iq_obj, _properties):
def _on_bytestream_set(self, _con, iq_obj, _properties):
target = iq_obj.getAttr('to')
id_ = iq_obj.getAttr('id')
query = iq_obj.getTag('query')
......@@ -640,7 +640,7 @@ def _on_result(self, _con, iq_obj, _properties):
app.socks5queue.activate_proxy(host['idx'])
raise nbxmpp.NodeProcessed
def _on_bytestream_result(self, con, iq_obj, _properties):
def _on_bytestream_result(self, _con, iq_obj, _properties):
frm = self._ft_get_from(iq_obj)
real_id = iq_obj.getAttr('id')
query = iq_obj.getTag('query')
......
......@@ -376,7 +376,7 @@ def _close(self):
def get_chunk(self):
if self._stream is None:
if self._encryption is None:
self._stream = open(self._path, 'rb')
self._stream = open(self._path, 'rb') # pylint: disable=consider-using-with
else:
self._stream = io.BytesIO(self._data)
......
......@@ -86,7 +86,7 @@ def _ibb_received(self, _con, stanza, properties):
file_props.disconnect_cb = None
file_props.continue_cb = None
file_props.syn_id = stanza.getID()
file_props.fp = open(file_props.file_name, 'wb')
file_props.fp = open(file_props.file_name, 'wb') # pylint: disable=consider-using-with
self.send_reply(stanza)
elif properties.ibb.type == 'close':
......
......@@ -122,7 +122,7 @@ def _on_jingle_iq(self, _con, stanza, _properties):
logger.warning('Invalid JID: %s, ignoring it', stanza.getFrom())
return
id_ = stanza.getID()
if (jid, id_) in self.__iq_responses.keys():
if (jid, id_) in self.__iq_responses:
self.__iq_responses[(jid, id_)].on_stanza(stanza)
del self.__iq_responses[(jid, id_)]
raise nbxmpp.NodeProcessed
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment