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

Commits:

10 changed files:

Changes:

  • .ci/pylint.sh
    ... ... @@ -39,7 +39,7 @@ PYLINT=${PYLINT:-pylint}
    39 39
     # W1115 non-str-assignment-to-dunder-name
    
    40 40
     # W1116 isinstance-second-argument-not-valid-type
    
    41 41
     
    
    42
    -IGNORE_FLAKE8='C0301'
    
    42
    +IGNORE_FLAKE8='C0301,W0611'
    
    43 43
     
    
    44 44
     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'
    
    45 45
     
    

  • .gitlab-ci.yml
    ... ... @@ -35,7 +35,6 @@ test-pyright:
    35 35
     
    
    36 36
     test-flake8:
    
    37 37
       stage: test
    
    38
    -  allow_failure: true
    
    39 38
       rules:
    
    40 39
         - changes:
    
    41 40
           - "**/*.py"
    

  • gajim/command_system/dispatcher.py
    ... ... @@ -31,13 +31,12 @@
    31 31
     over the process.
    
    32 32
     """
    
    33 33
     
    
    34
    -from typing import Any  # pylint: disable=unused-import
    
    35
    -from typing import Dict  # pylint: disable=unused-import
    
    34
    +from typing import Any
    
    36 35
     
    
    37 36
     from gajim.command_system.tools import remove
    
    38 37
     
    
    39
    -COMMANDS = {}  # type: Dict[Any, Any]
    
    40
    -CONTAINERS = {}  # type: Dict[Any, Any]
    
    38
    +COMMANDS: dict[Any, Any] = {}
    
    39
    +CONTAINERS: dict[Any, Any] = {}
    
    41 40
     
    
    42 41
     
    
    43 42
     def add_host(host):
    

  • gajim/common/app.py
    ... ... @@ -197,7 +197,7 @@ def detect_dependencies() -> None:
    197 197
             gi.require_version('Gst', '1.0')
    
    198 198
             gi.require_version('GstPbutils', '1.0')
    
    199 199
             from gi.repository import Gst
    
    200
    -        from gi.repository import GstPbutils  # pylint: disable=unused-import
    
    200
    +        from gi.repository import GstPbutils  # noqa: F401
    
    201 201
             success, _argv = Gst.init_check(None)
    
    202 202
             _dependencies['GST'] = success
    
    203 203
         except Exception:
    
    ... ... @@ -224,7 +224,7 @@ def detect_dependencies() -> None:
    224 224
         # GEOCLUE
    
    225 225
         try:
    
    226 226
             gi.require_version('Geoclue', '2.0')
    
    227
    -        from gi.repository import Geoclue  # pylint: disable=unused-import
    
    227
    +        from gi.repository import Geoclue  # noqa: F401
    
    228 228
             _dependencies['GEOCLUE'] = True
    
    229 229
         except (ImportError, ValueError):
    
    230 230
             pass
    
    ... ... @@ -277,21 +277,21 @@ def detect_dependencies() -> None:
    277 277
         # APPINDICATOR
    
    278 278
         try:
    
    279 279
             gi.require_version('AppIndicator3', '0.1')
    
    280
    -        from gi.repository import AppIndicator3  # pylint: disable=unused-import
    
    280
    +        from gi.repository import AppIndicator3  # noqa: F401
    
    281 281
             _dependencies['APPINDICATOR'] = True
    
    282 282
         except (ImportError, ValueError):
    
    283 283
             pass
    
    284 284
         # AYATANA APPINDICATOR
    
    285 285
         try:
    
    286 286
             gi.require_version('AyatanaAppIndicator3', '0.1')
    
    287
    -        from gi.repository import AyatanaAppIndicator3  # pylint: disable=unused-import
    
    287
    +        from gi.repository import AyatanaAppIndicator3  # noqa: F401
    
    288 288
             _dependencies['AYATANA_APPINDICATOR'] = True
    
    289 289
         except (ImportError, ValueError):
    
    290 290
             pass
    
    291 291
     
    
    292 292
         # SENTRY SDK
    
    293 293
         try:
    
    294
    -        import sentry_sdk  # pylint: disable=unused-import
    
    294
    +        import sentry_sdk  # noqa: F401
    
    295 295
             _dependencies['SENTRY_SDK'] = True
    
    296 296
         except ImportError:
    
    297 297
             pass
    

  • gajim/common/config.py
    ... ... @@ -27,10 +27,7 @@
    27 27
     # You should have received a copy of the GNU General Public License
    
    28 28
     # along with Gajim. If not, see <http://www.gnu.org/licenses/>.
    
    29 29
     
    
    30
    -from typing import Any  # pylint: disable=unused-import
    
    31
    -from typing import Dict  # pylint: disable=unused-import
    
    32
    -from typing import List  # pylint: disable=unused-import
    
    33
    -from typing import Tuple  # pylint: disable=unused-import
    
    30
    +from typing import Any
    
    34 31
     
    
    35 32
     import re
    
    36 33
     import copy
    
    ... ... @@ -63,7 +60,7 @@ class Config:
    63 60
         DEFAULT_MOOD_ICONSET = 'default'
    
    64 61
         DEFAULT_ACTIVITY_ICONSET = 'default'
    
    65 62
     
    
    66
    -    __options = ({
    
    63
    +    __options: tuple[dict[str, list[Any]], dict[Any, Any]] = ({
    
    67 64
             # name: [ type, default_value, help_string, restart ]
    
    68 65
             'autopopup': [opt_bool, False],
    
    69 66
             'autopopupaway': [opt_bool, False],
    
    ... ... @@ -208,9 +205,10 @@ class Config:
    208 205
             'check_for_update': [opt_bool, True, 'Check for Gajim updates periodically'],
    
    209 206
             'last_update_check': [opt_str, '', 'Date of the last update check'],
    
    210 207
             'always_ask_for_status_message': [opt_bool, False],
    
    211
    -    }, {})  # type: Tuple[Dict[str, List[Any]], Dict[Any, Any]]
    
    208
    +    }, {})
    
    212 209
     
    
    213
    -    __options_per_key = {
    
    210
    +    __options_per_key: dict[str,
    
    211
    +                            tuple[dict[str, list[Any]], dict[Any, Any]]] = {
    
    214 212
             'accounts': ({
    
    215 213
                 'name': [opt_str, '', '', True],
    
    216 214
                 'account_label': [opt_str, '', '', False],
    
    ... ... @@ -314,7 +312,7 @@ class Config:
    314 312
             'plugins': ({
    
    315 313
                 '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.'],
    
    316 314
             }, {}),
    
    317
    -    }  # type: Dict[str, Tuple[Dict[str, List[Any]], Dict[Any, Any]]]
    
    315
    +    }
    
    318 316
     
    
    319 317
         statusmsg_default = {
    
    320 318
             'Sleeping': ['ZZZZzzzzzZZZZZ', 'inactive', 'sleeping', '', 'sleepy', ''],
    

  • gajim/common/helpers.py
    ... ... @@ -81,7 +81,7 @@
    81 81
     from gi.repository import GObject
    
    82 82
     from gi.repository import Soup
    
    83 83
     
    
    84
    -import precis_i18n.codec  # pylint: disable=unused-import  # noqa: F401
    
    84
    +import precis_i18n.codec  # noqa: F401
    
    85 85
     
    
    86 86
     from gajim.common import app
    
    87 87
     from gajim.common import configpaths
    

  • gajim/common/types.py
    ... ... @@ -32,7 +32,6 @@
    32 32
     from nbxmpp.structs import BookmarkData
    
    33 33
     
    
    34 34
     if TYPE_CHECKING:
    
    35
    -    # pylint: disable=unused-import
    
    36 35
         from gajim.common.client import Client
    
    37 36
         from nbxmpp.client import Client as xmppClient  # noqa: F401
    
    38 37
         from gajim.common.modules.contacts import CommonContact  # noqa: F401
    

  • gajim/gtk/controls/base.py
    ... ... @@ -89,10 +89,8 @@
    89 89
     # module, but still they need to be kept around. Importing them automatically
    
    90 90
     # registers the contained CommandContainers with the command system, thereby
    
    91 91
     # populating the list of available commands.
    
    92
    -# pylint: disable=unused-import
    
    93 92
     from gajim.command_system.implementation import standard  # noqa: F401
    
    94 93
     from gajim.command_system.implementation import execute  # noqa: F401
    
    95
    -# pylint: enable=unused-import
    
    96 94
     
    
    97 95
     if app.is_installed('GSPELL'):
    
    98 96
         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:
    216 216
                             groups = []
    
    217 217
                         jid = model[iter_][1]
    
    218 218
                         if app.jid_is_transport(str(self._jid_from)):
    
    219
    -                        self._client.get_module('Presence').automatically_added.append(
    
    220
    -                            jid)
    
    219
    +                        self._client.get_module('Presence')\
    
    220
    +                            .automatically_added.append(jid)
    
    221 221
     
    
    222 222
                         self._client.get_module('Presence').subscribe(
    
    223 223
                             jid,
    

  • gajim/gtk/status_icon.py
    ... ... @@ -45,10 +45,12 @@
    45 45
     from .util import open_window
    
    46 46
     
    
    47 47
     if app.is_installed('APPINDICATOR'):
    
    48
    -    from gi.repository import AppIndicator3 as appindicator  # pylint: disable=ungrouped-imports
    
    48
    +    # pylint: disable=ungrouped-imports
    
    49
    +    from gi.repository import AppIndicator3 as appindicator
    
    49 50
     
    
    50 51
     elif app.is_installed('AYATANA_APPINDICATOR'):
    
    51
    -    from gi.repository import AyatanaAppIndicator3 as appindicator  # pylint: disable=ungrouped-imports
    
    52
    +    # pylint: disable=ungrouped-imports
    
    53
    +    from gi.repository import AyatanaAppIndicator3 as appindicator
    
    52 54
     
    
    53 55
     
    
    54 56
     log = logging.getLogger('gajim.gui.statusicon')