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

Commits:

13 changed files:

Changes:

  • .ci/appveyor_build.py
    ... ... @@ -51,7 +51,7 @@ def start_build() -> str:
    51 51
             'branch': BRANCH,
    
    52 52
             'commitId': os.environ['CI_COMMIT_SHA'],
    
    53 53
             'environmentVariables': {
    
    54
    -           'GAJIM_VERSION': get_gajim_version(),
    
    54
    +            'GAJIM_VERSION': get_gajim_version(),
    
    55 55
             }
    
    56 56
         }
    
    57 57
         req = requests.post(BUILDS_API_URL, headers=HEADERS, json=payload)
    

  • .ci/debian_build.py
    ... ... @@ -79,12 +79,12 @@ def prepare_changelog(context: ReleaseContext) -> None:
    79 79
     def build(context: ReleaseContext) -> None:
    
    80 80
         log.info('Start package build')
    
    81 81
         subprocess.run(
    
    82
    -       [
    
    83
    -        'dpkg-buildpackage',
    
    84
    -        '--no-sign'
    
    85
    -       ],
    
    86
    -       cwd=context.release_dir,
    
    87
    -       check=True)
    
    82
    +        [
    
    83
    +            'dpkg-buildpackage',
    
    84
    +            '--no-sign'
    
    85
    +        ],
    
    86
    +        cwd=context.release_dir,
    
    87
    +        check=True)
    
    88 88
     
    
    89 89
     
    
    90 90
     if __name__ == '__main__':
    

  • gajim/common/app.py
    ... ... @@ -66,7 +66,8 @@
    66 66
     
    
    67 67
     
    
    68 68
     interface = cast(types.InterfaceT, None)
    
    69
    -thread_interface = lambda *args: None # Interface to run a thread and then a callback
    
    69
    +# Interface to run a thread and then a callback
    
    70
    +thread_interface = None
    
    70 71
     config = c_config.Config()
    
    71 72
     settings = cast(types.SettingsT, None)
    
    72 73
     version = gajim.__version__
    
    ... ... @@ -74,18 +75,20 @@
    74 75
     avatar_cache: dict[str, dict[str, Any]] = {}
    
    75 76
     bob_cache: dict[str, bytes] = {}
    
    76 77
     ipython_window = None
    
    77
    -app = None # type: GajimApplication
    
    78
    -window = None # type: MainWindow
    
    78
    +app = None  # type: GajimApplication
    
    79
    +window = None  # type: MainWindow
    
    79 80
     
    
    80
    -ged = ged_module.GlobalEventsDispatcher() # Global Events Dispatcher
    
    81
    +ged = ged_module.GlobalEventsDispatcher()  # Global Events Dispatcher
    
    81 82
     plugin_manager = cast(types.PluginManagerT, None)  # Plugins Manager
    
    82 83
     plugin_repository = cast(types.PluginRepositoryT, None)
    
    83 84
     
    
    85
    +
    
    84 86
     class Storage:
    
    85 87
         def __init__(self):
    
    86 88
             self.cache: CacheStorage = None
    
    87 89
             self.archive: MessageArchiveStorage = None
    
    88 90
     
    
    91
    +
    
    89 92
     storage = Storage()
    
    90 93
     
    
    91 94
     css_config = cast(types.CSSConfigT, None)
    
    ... ... @@ -312,11 +315,12 @@ def detect_desktop_env() -> Optional[str]:
    312 315
             return 'gnome'
    
    313 316
         return desktop
    
    314 317
     
    
    318
    +
    
    315 319
     desktop_env = detect_desktop_env()
    
    316 320
     
    
    317 321
     
    
    318 322
     def get_server_from_jid(jid: str) -> str:
    
    319
    -    pos = jid.find('@') + 1 # after @
    
    323
    +    pos = jid.find('@') + 1  # after @
    
    320 324
         return jid[pos:]
    
    321 325
     
    
    322 326
     
    
    ... ... @@ -324,10 +328,10 @@ def get_room_and_nick_from_fjid(jid: str) -> list[str]:
    324 328
         # fake jid is the jid for a contact in a room
    
    325 329
         # gaim@conference.jabber.no/nick/nick-continued
    
    326 330
         # return ('gaim@conference.jabber.no', 'nick/nick-continued')
    
    327
    -    l = jid.split('/', 1)
    
    328
    -    if len(l) == 1: # No nick
    
    329
    -        l.append('')
    
    330
    -    return l
    
    331
    +    list_ = jid.split('/', 1)
    
    332
    +    if len(list_) == 1:  # No nick
    
    333
    +        list_.append('')
    
    334
    +    return list_
    
    331 335
     
    
    332 336
     
    
    333 337
     def get_jid_without_resource(jid: str) -> str:
    
    ... ... @@ -446,7 +450,7 @@ def get_transport_name_from_jid(
    446 450
         """
    
    447 451
         # TODO: Rewrite/remove
    
    448 452
     
    
    449
    -    #FIXME: jid can be None! one TB I saw had this problem:
    
    453
    +    # FIXME: jid can be None! one TB I saw had this problem:
    
    450 454
         # in the code block # it is a groupchat presence in handle_event_notify
    
    451 455
         # jid was None. Yann why?
    
    452 456
         if not jid:
    
    ... ... @@ -472,6 +476,7 @@ def get_transport_name_from_jid(
    472 476
             return 'facebook'
    
    473 477
         return None
    
    474 478
     
    
    479
    +
    
    475 480
     def jid_is_transport(jid: str) -> bool:
    
    476 481
         # if not '@' or '@' starts the jid then it is transport
    
    477 482
         if jid.find('@') <= 0:
    
    ... ... @@ -551,7 +556,8 @@ def get_priority(account: str, show: str) -> int:
    551 556
             show = 'online'
    
    552 557
     
    
    553 558
         if show in ('online', 'chat', 'away', 'xa', 'dnd') and \
    
    554
    -    settings.get_account_setting(account, 'adjust_priority_with_status'):
    
    559
    +            settings.get_account_setting(account,
    
    560
    +                                         'adjust_priority_with_status'):
    
    555 561
             prio = settings.get_account_setting(account, 'autopriority_' + show)
    
    556 562
         else:
    
    557 563
             prio = settings.get_account_setting(account, 'priority')
    

  • gajim/common/sound.py
    ... ... @@ -162,10 +162,13 @@ def _init_platform() -> PlaySound:
    162 162
     
    
    163 163
         return PlatformUnix()
    
    164 164
     
    
    165
    +
    
    165 166
     _platform_player = _init_platform()
    
    166 167
     
    
    168
    +
    
    167 169
     def play(path: Path, loop: bool = False) -> None:
    
    168 170
         _platform_player.play(path, loop)
    
    169 171
     
    
    172
    +
    
    170 173
     def stop():
    
    171 174
         _platform_player.stop()

  • gajim/dev/ipython_view.py
    ... ... @@ -75,7 +75,6 @@
    75 75
     from IPython.core.display_trap import DisplayTrap
    
    76 76
     
    
    77 77
     
    
    78
    -
    
    79 78
     class MyPromptDisplayHook(DisplayHook):
    
    80 79
         def __init__(self, shell, view):
    
    81 80
             DisplayHook.__init__(self, shell=shell)
    
    ... ... @@ -129,7 +128,6 @@ def __init__(self, argv=None, user_ns=None, user_global_ns=None, cin=None,
    129 128
             if input_func:
    
    130 129
                 IPython.terminal.interactiveshell.raw_input_original = input_func
    
    131 130
     
    
    132
    -
    
    133 131
             # This is to get rid of the blockage that occurs during
    
    134 132
             # IPython.Shell.InteractiveShell.user_setup()
    
    135 133
             io.raw_input = lambda x: None
    

  • gajim/gajim.py
    ... ... @@ -143,7 +143,7 @@ def _set_proc_title() -> None:
    143 143
     
    
    144 144
             if sysname == 'Linux':
    
    145 145
                 proc_name = b'gajim'
    
    146
    -            buff = create_string_buffer(len(proc_name)+1)
    
    146
    +            buff = create_string_buffer(len(proc_name) + 1)
    
    147 147
                 buff.value = proc_name
    
    148 148
                 libc.prctl(PR_SET_NAME, byref(buff), 0, 0, 0)
    
    149 149
             elif sysname in ('FreeBSD', 'OpenBSD', 'NetBSD'):
    

  • gajim/plugins/pluginmanager.py
    ... ... @@ -433,8 +433,8 @@ def _add_gui_extension_point_call_to_list(self,
    433 433
             :type args: tuple
    
    434 434
     
    
    435 435
             '''
    
    436
    -        if ((gui_extpoint_name not in self.gui_extension_points)
    
    437
    -                or (args not in self.gui_extension_points[gui_extpoint_name])):
    
    436
    +        if (gui_extpoint_name not in self.gui_extension_points or
    
    437
    +                args not in self.gui_extension_points[gui_extpoint_name]):
    
    438 438
                 self.gui_extension_points.setdefault(gui_extpoint_name, []).append(
    
    439 439
                     args)
    
    440 440
     
    

  • gajim/plugins/repository.py
    ... ... @@ -229,7 +229,8 @@ def download_plugins(self, manifests: Iterable[PluginManifest]) -> None:
    229 229
                 log.warning('Unable to download plugins because repository not set')
    
    230 230
                 return
    
    231 231
     
    
    232
    -        manifests = [self._manifests[manifest.short_name] for manifest in manifests]
    
    232
    +        manifests = [self._manifests[manifest.short_name] for manifest
    
    233
    +                     in manifests]
    
    233 234
     
    
    234 235
             manifests = set(manifests) - self._download_queue
    
    235 236
             if not manifests:
    

  • mac/makebundle.py
    1 1
     #!/usr/bin/env python3
    
    2
    +
    
    2 3
     import os
    
    3 4
     import sys
    
    4 5
     from argparse import ArgumentParser
    
    ... ... @@ -18,12 +19,25 @@
    18 19
             version = args.version
    
    19 20
         else:
    
    20 21
             try:
    
    21
    -            version = check_output(['git', 'describe', '--tags']).decode().strip()
    
    22
    +            version = check_output(['git', 'describe', '--tags'])
    
    23
    +            version = version.decode().strip()
    
    22 24
             except CalledProcessError:
    
    23 25
                 version = 'unknown'
    
    24 26
         dmg_name = 'gajim-{}.dmg'.format(version)
    
    25 27
     
    
    26
    -    run(['cp', 'mac/gajim.spec', 'gajim.spec'], check=True) # the .spec has to be in the project root
    
    28
    +    # the .spec has to be in the project root
    
    29
    +    run(['cp', 'mac/gajim.spec', 'gajim.spec'], check=True)
    
    27 30
         run(['pyinstaller', 'gajim.spec'], check=True)
    
    28
    -    run(['rm', '-rf', 'dist/launch']) # we only want Gajim.app in the dmg
    
    29
    -    run(['hdiutil', 'create', '-volname', 'Gajim', '-srcfolder', 'dist', '-ov', '-format', 'UDZO', dmg_name], check=True)
    31
    +    # we only want Gajim.app in the dmg
    
    32
    +    run(['rm', '-rf', 'dist/launch'])
    
    33
    +    run(['hdiutil',
    
    34
    +         'create',
    
    35
    +         '-volname',
    
    36
    +         'Gajim',
    
    37
    +         '-srcfolder',
    
    38
    +         'dist',
    
    39
    +         '-ov',
    
    40
    +         '-format',
    
    41
    +         'UDZO',
    
    42
    +         dmg_name],
    
    43
    +        check=True)

  • scripts/generate_ui_types.py
    ... ... @@ -36,7 +36,7 @@ class Builder(Gtk.Builder): ...
    36 36
     
    
    37 37
     GET_BUILDER_OVERLOAD = '''
    
    38 38
     @overload
    
    39
    -def get_builder(file_name: Literal['%s'], widgets: list[str] = ...) -> %s: ...'''
    
    39
    +def get_builder(file_name: Literal['%s'], widgets: list[str] = ...) -> %s: ...'''  # noqa
    
    40 40
     
    
    41 41
     GET_BUILDER = '''
    
    42 42
     def get_builder(file_name: str, widgets: list[str] = ...) -> Builder: ...'''
    

  • setup.cfg
    ... ... @@ -14,6 +14,7 @@ exclude =
    14 14
     max-complexity = 15
    
    15 15
     builtins=_
    
    16 16
     max-line-length = 80
    
    17
    +statistics = True
    
    17 18
     
    
    18 19
     [metadata]
    
    19 20
     name = gajim
    

  • setup.py
    ... ... @@ -162,7 +162,7 @@ def run(self):
    162 162
     
    
    163 163
     class install(_install):
    
    164 164
         def run(self):
    
    165
    -        data_files = cast(DataFilesT, self.distribution.data_files)  # pyright: ignore
    
    165
    +        data_files = cast(DataFilesT, self.distribution.data_files)  # pyright: ignore  # noqa: E501
    
    166 166
             install_trans(data_files)
    
    167 167
             if sys.platform != 'win32':
    
    168 168
                 install_man(data_files)
    

  • win/misc/depcheck.py
    ... ... @@ -16,7 +16,7 @@
    16 16
     
    
    17 17
     import gi
    
    18 18
     gi.require_version("GIRepository", "2.0")
    
    19
    -from gi.repository import GIRepository
    
    19
    +from gi.repository import GIRepository  # noqa: E402
    
    20 20
     
    
    21 21
     
    
    22 22
     def get_required_by_typelibs() -> set[str]: