Philipp Hörist pushed to branch master at gajim / gajim
Commits:
-
6ddcf4bb
by lovetox at 2021-11-02T15:54:11+01:00
7 changed files:
- gajim/common/modules/adhoc_commands.py
- gajim/common/modules/bits_of_binary.py
- gajim/common/modules/bookmarks.py
- gajim/common/modules/bytestream.py
- gajim/common/modules/httpupload.py
- gajim/common/modules/ibb.py
- gajim/common/modules/jingle.py
Changes:
| ... | ... | @@ -350,12 +350,12 @@ def _execute_command_received(self, _con, stanza, _properties): |
| 350 | 350 |
else:
|
| 351 | 351 |
# action is wrong. stop the session, send error
|
| 352 | 352 |
raise AttributeError
|
| 353 |
- except AttributeError:
|
|
| 353 |
+ except AttributeError as error:
|
|
| 354 | 354 |
# the command probably doesn't handle invoked action...
|
| 355 | 355 |
# stop the session, return error
|
| 356 | 356 |
del self._sessions[magictuple]
|
| 357 | 357 |
self._log.warning('Wrong action %s %s', node, jid)
|
| 358 |
- raise nbxmpp.NodeProcessed
|
|
| 358 |
+ raise nbxmpp.NodeProcessed from error
|
|
| 359 | 359 |
|
| 360 | 360 |
# delete the session if rc is False
|
| 361 | 361 |
if not rc:
|
| ... | ... | @@ -59,6 +59,7 @@ def _on_bob_received(self, _nbxmpp_client, result, cid): |
| 59 | 59 |
if cid not in self.awaiting_cids:
|
| 60 | 60 |
return
|
| 61 | 61 |
|
| 62 |
+ # pylint: disable=cell-var-from-loop
|
|
| 62 | 63 |
if result.getType() == 'result':
|
| 63 | 64 |
data = result.getTags('data', namespace=Namespace.BOB)
|
| 64 | 65 |
if data.getAttr('cid') == cid:
|
| ... | ... | @@ -16,7 +16,6 @@ |
| 16 | 16 |
|
| 17 | 17 |
from typing import Any
|
| 18 | 18 |
from typing import List
|
| 19 |
-from typing import Dict
|
|
| 20 | 19 |
from typing import Set
|
| 21 | 20 |
from typing import Tuple
|
| 22 | 21 |
from typing import Union
|
| ... | ... | @@ -159,7 +158,8 @@ def _bookmark_module(self): |
| 159 | 158 |
return 'PEPBookmarks'
|
| 160 | 159 |
return 'PrivateBookmarks'
|
| 161 | 160 |
|
| 162 |
- def _act_on_changed_bookmarks(self, current_bookmarks: BookmarksDict) -> None:
|
|
| 161 |
+ def _act_on_changed_bookmarks(self,
|
|
| 162 |
+ current_bookmarks: BookmarksDict) -> None:
|
|
| 163 | 163 |
new_bookmarks = self._convert_to_set(self._bookmarks)
|
| 164 | 164 |
old_bookmarks = self._convert_to_set(current_bookmarks)
|
| 165 | 165 |
changed = new_bookmarks - old_bookmarks
|
| ... | ... | @@ -189,7 +189,8 @@ def _convert_to_set(bookmarks: BookmarksDict) -> Set[Tuple[JID, bool]]: |
| 189 | 189 |
return set_
|
| 190 | 190 |
|
| 191 | 191 |
@staticmethod
|
| 192 |
- def _convert_to_dict(bookmarks: Optional[List[BookmarkData]]) -> BookmarksDict:
|
|
| 192 |
+ def _convert_to_dict(
|
|
| 193 |
+ bookmarks: Optional[List[BookmarkData]]) -> BookmarksDict:
|
|
| 193 | 194 |
_dict: BookmarksDict = {}
|
| 194 | 195 |
if not bookmarks:
|
| 195 | 196 |
return _dict
|
| ... | ... | @@ -564,7 +564,7 @@ def _on_bytestream_error(self, _con, iq_obj, _properties): |
| 564 | 564 |
error_msg=''))
|
| 565 | 565 |
raise nbxmpp.NodeProcessed
|
| 566 | 566 |
|
| 567 |
- def _on_bytestream_set(self, con, iq_obj, _properties):
|
|
| 567 |
+ def _on_bytestream_set(self, _con, iq_obj, _properties):
|
|
| 568 | 568 |
target = iq_obj.getAttr('to')
|
| 569 | 569 |
id_ = iq_obj.getAttr('id')
|
| 570 | 570 |
query = iq_obj.getTag('query')
|
| ... | ... | @@ -640,7 +640,7 @@ def _on_result(self, _con, iq_obj, _properties): |
| 640 | 640 |
app.socks5queue.activate_proxy(host['idx'])
|
| 641 | 641 |
raise nbxmpp.NodeProcessed
|
| 642 | 642 |
|
| 643 |
- def _on_bytestream_result(self, con, iq_obj, _properties):
|
|
| 643 |
+ def _on_bytestream_result(self, _con, iq_obj, _properties):
|
|
| 644 | 644 |
frm = self._ft_get_from(iq_obj)
|
| 645 | 645 |
real_id = iq_obj.getAttr('id')
|
| 646 | 646 |
query = iq_obj.getTag('query')
|
| ... | ... | @@ -376,7 +376,7 @@ def _close(self): |
| 376 | 376 |
def get_chunk(self):
|
| 377 | 377 |
if self._stream is None:
|
| 378 | 378 |
if self._encryption is None:
|
| 379 |
- self._stream = open(self._path, 'rb')
|
|
| 379 |
+ self._stream = open(self._path, 'rb') # pylint: disable=consider-using-with
|
|
| 380 | 380 |
else:
|
| 381 | 381 |
self._stream = io.BytesIO(self._data)
|
| 382 | 382 |
|
| ... | ... | @@ -86,7 +86,7 @@ def _ibb_received(self, _con, stanza, properties): |
| 86 | 86 |
file_props.disconnect_cb = None
|
| 87 | 87 |
file_props.continue_cb = None
|
| 88 | 88 |
file_props.syn_id = stanza.getID()
|
| 89 |
- file_props.fp = open(file_props.file_name, 'wb')
|
|
| 89 |
+ file_props.fp = open(file_props.file_name, 'wb') # pylint: disable=consider-using-with
|
|
| 90 | 90 |
self.send_reply(stanza)
|
| 91 | 91 |
|
| 92 | 92 |
elif properties.ibb.type == 'close':
|
| ... | ... | @@ -122,7 +122,7 @@ def _on_jingle_iq(self, _con, stanza, _properties): |
| 122 | 122 |
logger.warning('Invalid JID: %s, ignoring it', stanza.getFrom())
|
| 123 | 123 |
return
|
| 124 | 124 |
id_ = stanza.getID()
|
| 125 |
- if (jid, id_) in self.__iq_responses.keys():
|
|
| 125 |
+ if (jid, id_) in self.__iq_responses:
|
|
| 126 | 126 |
self.__iq_responses[(jid, id_)].on_stanza(stanza)
|
| 127 | 127 |
del self.__iq_responses[(jid, id_)]
|
| 128 | 128 |
raise nbxmpp.NodeProcessed
|