Philipp Hörist pushed to branch master at gajim / gajim


Commits:
6ddcf4bb by lovetox at 2021-11-02T15:54:11+01:00
Fix various pylint errors

- - - - -


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:

=====================================
gajim/common/modules/adhoc_commands.py
=====================================
@@ -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:


=====================================
gajim/common/modules/bits_of_binary.py
=====================================
@@ -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:


=====================================
gajim/common/modules/bookmarks.py
=====================================
@@ -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


=====================================
gajim/common/modules/bytestream.py
=====================================
@@ -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')


=====================================
gajim/common/modules/httpupload.py
=====================================
@@ -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)
 


=====================================
gajim/common/modules/ibb.py
=====================================
@@ -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':


=====================================
gajim/common/modules/jingle.py
=====================================
@@ -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



View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/commit/6ddcf4bb22b7a9318fb91a5fa3194225a1fc0013

-- 
View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/commit/6ddcf4bb22b7a9318fb91a5fa3194225a1fc0013
You're receiving this email because of your account on dev.gajim.org.


_______________________________________________
Commits mailing list
Commits@gajim.org
https://lists.gajim.org/cgi-bin/listinfo/commits

Reply via email to