Philipp Hörist pushed to branch master at gajim / gajim
Commits: 6db439ca by lovetox at 2022-06-18T15:47:27+02:00 ci: Use flake8 for unused-import check
- - - - - a06e0ab3 by lovetox at 2022-06-18T15:52:06+02:00 chore: Fix codestyle errors
- - - - - c8a6c2a2 by lovetox at 2022-06-18T15:52:52+02:00 ci: Don’t allow flake8 test to fail
- - - - -
10 changed files:
- .ci/pylint.sh - .gitlab-ci.yml - gajim/command_system/dispatcher.py - gajim/common/app.py - gajim/common/config.py - gajim/common/helpers.py - gajim/common/types.py - gajim/gtk/controls/base.py - gajim/gtk/roster_item_exchange.py - gajim/gtk/status_icon.py
Changes:
===================================== .ci/pylint.sh ===================================== @@ -39,7 +39,7 @@ PYLINT=${PYLINT:-pylint} # W1115 non-str-assignment-to-dunder-name # W1116 isinstance-second-argument-not-valid-type
-IGNORE_FLAKE8='C0301' +IGNORE_FLAKE8='C0301,W0611'
IGNORE_PYRIGHT='E1101,E1102,E1111,E1120,E1121,E1123,E1124,E1125,E1126,E1127,E1128,E1129,E1130,E1131,E1132,E1133,E1134,E1135,E1136,E1137,E1138,E1139,E1140,E1141,E1142,I1101,W0212,W1113,W1114,W1115,W1116'
===================================== .gitlab-ci.yml ===================================== @@ -35,7 +35,6 @@ test-pyright:
test-flake8: stage: test - allow_failure: true rules: - changes: - "**/*.py"
===================================== gajim/command_system/dispatcher.py ===================================== @@ -31,13 +31,12 @@ over the process. """
-from typing import Any # pylint: disable=unused-import -from typing import Dict # pylint: disable=unused-import +from typing import Any
from gajim.command_system.tools import remove
-COMMANDS = {} # type: Dict[Any, Any] -CONTAINERS = {} # type: Dict[Any, Any] +COMMANDS: dict[Any, Any] = {} +CONTAINERS: dict[Any, Any] = {}
def add_host(host):
===================================== gajim/common/app.py ===================================== @@ -197,7 +197,7 @@ def detect_dependencies() -> None: gi.require_version('Gst', '1.0') gi.require_version('GstPbutils', '1.0') from gi.repository import Gst - from gi.repository import GstPbutils # pylint: disable=unused-import + from gi.repository import GstPbutils # noqa: F401 success, _argv = Gst.init_check(None) _dependencies['GST'] = success except Exception: @@ -224,7 +224,7 @@ def detect_dependencies() -> None: # GEOCLUE try: gi.require_version('Geoclue', '2.0') - from gi.repository import Geoclue # pylint: disable=unused-import + from gi.repository import Geoclue # noqa: F401 _dependencies['GEOCLUE'] = True except (ImportError, ValueError): pass @@ -277,21 +277,21 @@ def detect_dependencies() -> None: # APPINDICATOR try: gi.require_version('AppIndicator3', '0.1') - from gi.repository import AppIndicator3 # pylint: disable=unused-import + from gi.repository import AppIndicator3 # noqa: F401 _dependencies['APPINDICATOR'] = True except (ImportError, ValueError): pass # AYATANA APPINDICATOR try: gi.require_version('AyatanaAppIndicator3', '0.1') - from gi.repository import AyatanaAppIndicator3 # pylint: disable=unused-import + from gi.repository import AyatanaAppIndicator3 # noqa: F401 _dependencies['AYATANA_APPINDICATOR'] = True except (ImportError, ValueError): pass
# SENTRY SDK try: - import sentry_sdk # pylint: disable=unused-import + import sentry_sdk # noqa: F401 _dependencies['SENTRY_SDK'] = True except ImportError: pass
===================================== gajim/common/config.py ===================================== @@ -27,10 +27,7 @@ # You should have received a copy of the GNU General Public License # along with Gajim. If not, see http://www.gnu.org/licenses/.
-from typing import Any # pylint: disable=unused-import -from typing import Dict # pylint: disable=unused-import -from typing import List # pylint: disable=unused-import -from typing import Tuple # pylint: disable=unused-import +from typing import Any
import re import copy @@ -63,7 +60,7 @@ class Config: DEFAULT_MOOD_ICONSET = 'default' DEFAULT_ACTIVITY_ICONSET = 'default'
- __options = ({ + __options: tuple[dict[str, list[Any]], dict[Any, Any]] = ({ # name: [ type, default_value, help_string, restart ] 'autopopup': [opt_bool, False], 'autopopupaway': [opt_bool, False], @@ -208,9 +205,10 @@ class Config: 'check_for_update': [opt_bool, True, 'Check for Gajim updates periodically'], 'last_update_check': [opt_str, '', 'Date of the last update check'], 'always_ask_for_status_message': [opt_bool, False], - }, {}) # type: Tuple[Dict[str, List[Any]], Dict[Any, Any]] + }, {})
- __options_per_key = { + __options_per_key: dict[str, + tuple[dict[str, list[Any]], dict[Any, Any]]] = { 'accounts': ({ 'name': [opt_str, '', '', True], 'account_label': [opt_str, '', '', False], @@ -314,7 +312,7 @@ class Config: 'plugins': ({ 'active': [opt_bool, False, 'If enabled, plugins will be activated on startup (this is saved when exiting Gajim). This option SHOULD NOT be used to (de)activate plugins. Use the plugin window instead.'], }, {}), - } # type: Dict[str, Tuple[Dict[str, List[Any]], Dict[Any, Any]]] + }
statusmsg_default = { 'Sleeping': ['ZZZZzzzzzZZZZZ', 'inactive', 'sleeping', '', 'sleepy', ''],
===================================== gajim/common/helpers.py ===================================== @@ -81,7 +81,7 @@ from gi.repository import GObject from gi.repository import Soup
-import precis_i18n.codec # pylint: disable=unused-import # noqa: F401 +import precis_i18n.codec # noqa: F401
from gajim.common import app from gajim.common import configpaths
===================================== gajim/common/types.py ===================================== @@ -32,7 +32,6 @@ from nbxmpp.structs import BookmarkData
if TYPE_CHECKING: - # pylint: disable=unused-import from gajim.common.client import Client from nbxmpp.client import Client as xmppClient # noqa: F401 from gajim.common.modules.contacts import CommonContact # noqa: F401
===================================== gajim/gtk/controls/base.py ===================================== @@ -89,10 +89,8 @@ # module, but still they need to be kept around. Importing them automatically # registers the contained CommandContainers with the command system, thereby # populating the list of available commands. -# pylint: disable=unused-import from gajim.command_system.implementation import standard # noqa: F401 from gajim.command_system.implementation import execute # noqa: F401 -# pylint: enable=unused-import
if app.is_installed('GSPELL'): from gi.repository import Gspell # pylint: disable=ungrouped-imports
===================================== gajim/gtk/roster_item_exchange.py ===================================== @@ -216,8 +216,8 @@ def _on_accept_button_clicked(self, _button: Gtk.Button) -> None: groups = [] jid = model[iter_][1] if app.jid_is_transport(str(self._jid_from)): - self._client.get_module('Presence').automatically_added.append( - jid) + self._client.get_module('Presence')\ + .automatically_added.append(jid)
self._client.get_module('Presence').subscribe( jid,
===================================== gajim/gtk/status_icon.py ===================================== @@ -45,10 +45,12 @@ from .util import open_window
if app.is_installed('APPINDICATOR'): - from gi.repository import AppIndicator3 as appindicator # pylint: disable=ungrouped-imports + # pylint: disable=ungrouped-imports + from gi.repository import AppIndicator3 as appindicator
elif app.is_installed('AYATANA_APPINDICATOR'): - from gi.repository import AyatanaAppIndicator3 as appindicator # pylint: disable=ungrouped-imports + # pylint: disable=ungrouped-imports + from gi.repository import AyatanaAppIndicator3 as appindicator
log = logging.getLogger('gajim.gui.statusicon')
View it on GitLab: https://dev.gajim.org/gajim/gajim/-/compare/910a9109f3e9e9f419ef05597cf04e31...