Philipp Hörist pushed to branch master at gajim / gajim
Commits: 8f304acb by lovetox at 2022-06-14T23:46:35+02:00 chore: Fix codestyle errors
- - - - - a46a1095 by lovetox at 2022-06-14T23:46:56+02:00 ci: Flake8: Update configuration
- - - - -
13 changed files:
- .ci/appveyor_build.py - .ci/debian_build.py - gajim/common/app.py - gajim/common/sound.py - gajim/dev/ipython_view.py - gajim/gajim.py - gajim/plugins/pluginmanager.py - gajim/plugins/repository.py - mac/makebundle.py - scripts/generate_ui_types.py - setup.cfg - setup.py - win/misc/depcheck.py
Changes:
===================================== .ci/appveyor_build.py ===================================== @@ -51,7 +51,7 @@ def start_build() -> str: 'branch': BRANCH, 'commitId': os.environ['CI_COMMIT_SHA'], 'environmentVariables': { - 'GAJIM_VERSION': get_gajim_version(), + 'GAJIM_VERSION': get_gajim_version(), } } req = requests.post(BUILDS_API_URL, headers=HEADERS, json=payload)
===================================== .ci/debian_build.py ===================================== @@ -79,12 +79,12 @@ def prepare_changelog(context: ReleaseContext) -> None: def build(context: ReleaseContext) -> None: log.info('Start package build') subprocess.run( - [ - 'dpkg-buildpackage', - '--no-sign' - ], - cwd=context.release_dir, - check=True) + [ + 'dpkg-buildpackage', + '--no-sign' + ], + cwd=context.release_dir, + check=True)
if __name__ == '__main__':
===================================== gajim/common/app.py ===================================== @@ -66,7 +66,8 @@
interface = cast(types.InterfaceT, None) -thread_interface = lambda *args: None # Interface to run a thread and then a callback +# Interface to run a thread and then a callback +thread_interface = None config = c_config.Config() settings = cast(types.SettingsT, None) version = gajim.__version__ @@ -74,18 +75,20 @@ avatar_cache: dict[str, dict[str, Any]] = {} bob_cache: dict[str, bytes] = {} ipython_window = None -app = None # type: GajimApplication -window = None # type: MainWindow +app = None # type: GajimApplication +window = None # type: MainWindow
-ged = ged_module.GlobalEventsDispatcher() # Global Events Dispatcher +ged = ged_module.GlobalEventsDispatcher() # Global Events Dispatcher plugin_manager = cast(types.PluginManagerT, None) # Plugins Manager plugin_repository = cast(types.PluginRepositoryT, None)
+ class Storage: def __init__(self): self.cache: CacheStorage = None self.archive: MessageArchiveStorage = None
+ storage = Storage()
css_config = cast(types.CSSConfigT, None) @@ -312,11 +315,12 @@ def detect_desktop_env() -> Optional[str]: return 'gnome' return desktop
+ desktop_env = detect_desktop_env()
def get_server_from_jid(jid: str) -> str: - pos = jid.find('@') + 1 # after @ + pos = jid.find('@') + 1 # after @ return jid[pos:]
@@ -324,10 +328,10 @@ def get_room_and_nick_from_fjid(jid: str) -> list[str]: # fake jid is the jid for a contact in a room # gaim@conference.jabber.no/nick/nick-continued # return ('gaim@conference.jabber.no', 'nick/nick-continued') - l = jid.split('/', 1) - if len(l) == 1: # No nick - l.append('') - return l + list_ = jid.split('/', 1) + if len(list_) == 1: # No nick + list_.append('') + return list_
def get_jid_without_resource(jid: str) -> str: @@ -446,7 +450,7 @@ def get_transport_name_from_jid( """ # TODO: Rewrite/remove
- #FIXME: jid can be None! one TB I saw had this problem: + # FIXME: jid can be None! one TB I saw had this problem: # in the code block # it is a groupchat presence in handle_event_notify # jid was None. Yann why? if not jid: @@ -472,6 +476,7 @@ def get_transport_name_from_jid( return 'facebook' return None
+ def jid_is_transport(jid: str) -> bool: # if not '@' or '@' starts the jid then it is transport if jid.find('@') <= 0: @@ -551,7 +556,8 @@ def get_priority(account: str, show: str) -> int: show = 'online'
if show in ('online', 'chat', 'away', 'xa', 'dnd') and \ - settings.get_account_setting(account, 'adjust_priority_with_status'): + settings.get_account_setting(account, + 'adjust_priority_with_status'): prio = settings.get_account_setting(account, 'autopriority_' + show) else: prio = settings.get_account_setting(account, 'priority')
===================================== gajim/common/sound.py ===================================== @@ -162,10 +162,13 @@ def _init_platform() -> PlaySound:
return PlatformUnix()
+ _platform_player = _init_platform()
+ def play(path: Path, loop: bool = False) -> None: _platform_player.play(path, loop)
+ def stop(): _platform_player.stop()
===================================== gajim/dev/ipython_view.py ===================================== @@ -75,7 +75,6 @@ from IPython.core.display_trap import DisplayTrap
- class MyPromptDisplayHook(DisplayHook): def __init__(self, shell, view): DisplayHook.__init__(self, shell=shell) @@ -129,7 +128,6 @@ def __init__(self, argv=None, user_ns=None, user_global_ns=None, cin=None, if input_func: IPython.terminal.interactiveshell.raw_input_original = input_func
- # This is to get rid of the blockage that occurs during # IPython.Shell.InteractiveShell.user_setup() io.raw_input = lambda x: None
===================================== gajim/gajim.py ===================================== @@ -143,7 +143,7 @@ def _set_proc_title() -> None:
if sysname == 'Linux': proc_name = b'gajim' - buff = create_string_buffer(len(proc_name)+1) + buff = create_string_buffer(len(proc_name) + 1) buff.value = proc_name libc.prctl(PR_SET_NAME, byref(buff), 0, 0, 0) elif sysname in ('FreeBSD', 'OpenBSD', 'NetBSD'):
===================================== gajim/plugins/pluginmanager.py ===================================== @@ -433,8 +433,8 @@ def _add_gui_extension_point_call_to_list(self, :type args: tuple
''' - if ((gui_extpoint_name not in self.gui_extension_points) - or (args not in self.gui_extension_points[gui_extpoint_name])): + if (gui_extpoint_name not in self.gui_extension_points or + args not in self.gui_extension_points[gui_extpoint_name]): self.gui_extension_points.setdefault(gui_extpoint_name, []).append( args)
===================================== gajim/plugins/repository.py ===================================== @@ -229,7 +229,8 @@ def download_plugins(self, manifests: Iterable[PluginManifest]) -> None: log.warning('Unable to download plugins because repository not set') return
- manifests = [self._manifests[manifest.short_name] for manifest in manifests] + manifests = [self._manifests[manifest.short_name] for manifest + in manifests]
manifests = set(manifests) - self._download_queue if not manifests:
===================================== mac/makebundle.py ===================================== @@ -1,4 +1,5 @@ #!/usr/bin/env python3 + import os import sys from argparse import ArgumentParser @@ -18,12 +19,25 @@ version = args.version else: try: - version = check_output(['git', 'describe', '--tags']).decode().strip() + version = check_output(['git', 'describe', '--tags']) + version = version.decode().strip() except CalledProcessError: version = 'unknown' dmg_name = 'gajim-{}.dmg'.format(version)
- run(['cp', 'mac/gajim.spec', 'gajim.spec'], check=True) # the .spec has to be in the project root + # the .spec has to be in the project root + run(['cp', 'mac/gajim.spec', 'gajim.spec'], check=True) run(['pyinstaller', 'gajim.spec'], check=True) - run(['rm', '-rf', 'dist/launch']) # we only want Gajim.app in the dmg - run(['hdiutil', 'create', '-volname', 'Gajim', '-srcfolder', 'dist', '-ov', '-format', 'UDZO', dmg_name], check=True) + # we only want Gajim.app in the dmg + run(['rm', '-rf', 'dist/launch']) + run(['hdiutil', + 'create', + '-volname', + 'Gajim', + '-srcfolder', + 'dist', + '-ov', + '-format', + 'UDZO', + dmg_name], + check=True)
===================================== scripts/generate_ui_types.py ===================================== @@ -36,7 +36,7 @@ class Builder(Gtk.Builder): ...
GET_BUILDER_OVERLOAD = ''' @overload -def get_builder(file_name: Literal['%s'], widgets: list[str] = ...) -> %s: ...''' +def get_builder(file_name: Literal['%s'], widgets: list[str] = ...) -> %s: ...''' # noqa
GET_BUILDER = ''' def get_builder(file_name: str, widgets: list[str] = ...) -> Builder: ...'''
===================================== setup.cfg ===================================== @@ -14,6 +14,7 @@ exclude = max-complexity = 15 builtins=_ max-line-length = 80 +statistics = True
[metadata] name = gajim
===================================== setup.py ===================================== @@ -162,7 +162,7 @@ def run(self):
class install(_install): def run(self): - data_files = cast(DataFilesT, self.distribution.data_files) # pyright: ignore + data_files = cast(DataFilesT, self.distribution.data_files) # pyright: ignore # noqa: E501 install_trans(data_files) if sys.platform != 'win32': install_man(data_files)
===================================== win/misc/depcheck.py ===================================== @@ -16,7 +16,7 @@
import gi gi.require_version("GIRepository", "2.0") -from gi.repository import GIRepository +from gi.repository import GIRepository # noqa: E402
def get_required_by_typelibs() -> set[str]:
View it on GitLab: https://dev.gajim.org/gajim/gajim/-/compare/50aec5745171d286ed215c8349cfccbe...