Philipp Hörist pushed to branch master at gajim / gajim
Commits: 975d0081 by Philipp Hörist at 2019-12-01T11:23:46Z MusicTrackListener: Fix pylint errors
- - - - - 0f6f860f by Philipp Hörist at 2019-12-01T12:04:28Z CI: Update pylint script
Ignore import-outside-toplevel
- - - - - 4c7af48c by Philipp Hörist at 2019-12-01T12:05:37Z Bytestream: Fix pylint error
- - - - - 652ef0af by Philipp Hörist at 2019-12-01T12:05:59Z Jingle: Fix pylint errors
- - - - - 75c28d25 by Philipp Hörist at 2019-12-01T12:07:59Z CI: Upgrade pylint to version 2.4.4
- - - - - fe096977 by Philipp Hörist at 2019-12-01T12:43:23Z Fix various pylint errors
- - - - -
14 changed files:
- .gitlab-ci.yml - gajim/common/connection.py - gajim/common/dbus/music_track.py - gajim/common/file_props.py - gajim/common/helpers.py - gajim/common/jingle_session.py - gajim/common/modules/bytestream.py - gajim/common/modules/jingle.py - gajim/gtk/discovery.py - gajim/gtk/htmltextview.py - gajim/gui_interface.py - gajim/message_window.py - gajim/remote_control.py - scripts/dev/pylint-ci.sh
Changes:
===================================== .gitlab-ci.yml ===================================== @@ -14,7 +14,7 @@ run-tests: - . ./civenv/bin/activate - pip3 install mypy - pip3 install git+https://dev.gajim.org/gajim/python-nbxmpp.git@master --upgrade - - pip3 install pylint==2.3.1 + - pip3 install pylint==2.4.4 - /home/gitlab-runner/.local/bin/mypy gajim - scripts/dev/pylint-ci.sh --jobs=2 gajim - python3 setup.py test -s test.no_gui
===================================== gajim/common/connection.py ===================================== @@ -1423,9 +1423,9 @@ class Connection(CommonConnection, ConnectionHandlers): '_stun._udp.' + helpers.idn_to_ascii(hostname), self._on_stun_resolved)
- def _on_stun_resolved(self, host, result_array): + def _on_stun_resolved(self, _host, result_array): if result_array: - self._stun_servers = self._hosts = [i for i in result_array] + self._stun_servers = self._hosts = result_array
@helpers.call_counter def connect_machine(self, restart=False):
===================================== gajim/common/dbus/music_track.py ===================================== @@ -32,6 +32,13 @@ MPRIS_PLAYER_PREFIX = 'org.mpris.MediaPlayer2.' class MusicTrackInfo: __slots__ = ['title', 'album', 'artist', 'duration', 'track_number', 'paused'] + def __init__(self): + self.title = None + self.album = None + self.artist = None + self.duration = None + self.track_number = None + self.paused = None
class MusicTrackListener(GObject.GObject): @@ -167,11 +174,7 @@ class MusicTrackListener(GObject.GObject): info = MusicTrackInfo() info.title = meta.get('xesam:title') info.album = meta.get('xesam:album') - artist = meta.get('xesam:artist') - if artist: - info.artist = artist[0] - else: - info.artist = None + info.artist = meta.get('xesam:artist') info.duration = float(meta.get('mpris:length', 0)) info.track_number = meta.get('xesam:trackNumber', 0)
===================================== gajim/common/file_props.py ===================================== @@ -87,7 +87,8 @@ class FilesProp: def deleteFileProp(cls, file_prop): files_props = cls._files_props a = s = None - for account, sid in files_props: + for key in files_props: + account, sid = key fp = files_props[account, sid] if fp is file_prop: a = account
===================================== gajim/common/helpers.py ===================================== @@ -263,8 +263,7 @@ def temp_failure_retry(func, *args, **kwargs): except (os.error, IOError, select.error) as ex: if ex.errno == errno.EINTR: continue - else: - raise + raise
def get_uf_show(show, use_mnemonic=False): """
===================================== gajim/common/jingle_session.py ===================================== @@ -383,7 +383,7 @@ class JingleSession: if child.getNamespace() == nbxmpp.NS_JINGLE_ERRORS: error_name = child.getName() break - elif child.getNamespace() == nbxmpp.NS_STANZAS: + if child.getNamespace() == nbxmpp.NS_STANZAS: error_name = child.getName() self.__dispatch_error(error_name, text, error.getAttr('type'))
===================================== gajim/common/modules/bytestream.py ===================================== @@ -548,7 +548,7 @@ class Bytestream(BaseModule): iq.setID(auth_id) self._con.connection.send(iq)
- def _on_bytestream_error(self, con, iq_obj): + def _on_bytestream_error(self, _con, iq_obj): id_ = iq_obj.getAttr('id') frm = helpers.get_full_jid_from_iq(iq_obj) query = iq_obj.getTag('query')
===================================== gajim/common/modules/jingle.py ===================================== @@ -105,7 +105,7 @@ class Jingle(BaseModule): self._log.info('Pubkey result from %s', jid_from) jingle_xtls.handle_new_cert(con, stanza, jid_from)
- def _on_jingle_iq(self, con, stanza, properties): + def _on_jingle_iq(self, _con, stanza, _properties): """ The jingle stanza dispatcher
===================================== gajim/gtk/discovery.py ===================================== @@ -870,7 +870,7 @@ class AgentBrowser: if identity.category == 'server' and identity.name is not None: name = identity.name break - elif identities[0].name is not None: + if identities[0].name is not None: name = identities[0].name
if name:
===================================== gajim/gtk/htmltextview.py ===================================== @@ -638,7 +638,6 @@ class HtmlHandler(xml.sax.handler.ContentHandler): tag = self.textbuf.create_tag() # we create anonymous tag for attr, val in style_iter(style): attr = attr.lower() - val = val try: getattr(self, self.__style_methods[attr])(tag, val) except KeyError:
===================================== gajim/gui_interface.py ===================================== @@ -1445,7 +1445,6 @@ class Interface: @staticmethod def _create_muc_data(account, room_jid, password, config): nick = app.nicks[account] - password = password
# Fetch data from bookmarks con = app.connections[account]
===================================== gajim/message_window.py ===================================== @@ -779,7 +779,7 @@ class MessageWindow(EventHelper): if ctrl.get_nb_unread() > 0: found = True break # found - elif app.config.get('ctrl_tab_go_to_next_composing'): + if app.config.get('ctrl_tab_go_to_next_composing'): # Search for a composing contact contact = ctrl.contact if first_composing_ind == -1 and contact.chatstate == 'composing':
===================================== gajim/remote_control.py ===================================== @@ -592,14 +592,14 @@ class GajimRemote(Server): connected_account = acct break # jid is in roster - elif contact: + if contact: minimized_control = \ jid in app.interface.minimized_controls[acct] connected_account = acct break # we send the message to jid not in roster, because account is # specified, or there is only one account - elif account: + if account: connected_account = acct elif first_connected_acct is None: first_connected_acct = acct
===================================== scripts/dev/pylint-ci.sh ===================================== @@ -5,9 +5,9 @@ set -e
PYLINT=${PYLINT:-pylint}
-IGNORE_ERRORS=C0103,C0302,C0301,C0330,E0401,E0611,E1101,E1133,E1136,R0201,R0901,R0904,R0912,R0913,R0914,R0915,R0916,R1702,R1710,W0201,W0212,W0221,W0223,W0231,W0233,W0603,W0613 +IGNORE_ERRORS=C0103,C0302,C0301,C0330,C0415,E0401,E0611,E1101,E1133,E1136,R0201,R0901,R0904,R0912,R0913,R0914,R0915,R0916,R1702,R1710,W0201,W0212,W0221,W0223,W0231,W0233,W0603,W0613
-IGNORE_GTK_MODULE_ERRORS=C0103,C0301,C0330,E0401,E0611,E1101,E1133,E1136,R0201,R0904,R0915,R1710,W0201,W0212,W0233,W0221,W0613 +IGNORE_GTK_MODULE_ERRORS=C0103,C0301,C0330,C0415,E0401,E0611,E1101,E1133,E1136,R0201,R0904,R0915,R1710,W0201,W0212,W0233,W0221,W0613
"$PYLINT" --version
@@ -19,6 +19,7 @@ IGNORE_GTK_MODULE_ERRORS=C0103,C0301,C0330,E0401,E0611,E1101,E1133,E1136,R0201,R # C0301 line-too-long # C0302 too-many-lines # C0330 bad-continuation +# C0415 import-outside-toplevel # E0401 import-error # E0611 no-name-in-module # E1101 no-member
View it on GitLab: https://dev.gajim.org/gajim/gajim/compare/390bae9da412fd65438cfd8c69ca96ffcd...