diff --git a/setup.py b/setup.py index a243c6c79b..14265613fd 100755 --- a/setup.py +++ b/setup.py @@ -1259,7 +1259,7 @@ def addldflags(*s: str): #******************************************************************************* -def get_base_conf_dir(install_dir: str, stripbuildroot=True) -> Sequence[str]: +def get_base_conf_dir(install_dir: str, stripbuildroot=True) -> list[str]: # in some cases we want to strip the buildroot (to generate paths in the config file) # but in other cases we want the buildroot path (when writing out the config files) # and in some cases, we don't have the install_dir specified (called from detect_xorg_setup, and that's fine too) diff --git a/xpra/client/gtk3/launcher.py b/xpra/client/gtk3/launcher.py index 5a06b9d9c7..2a2ffcf53d 100755 --- a/xpra/client/gtk3/launcher.py +++ b/xpra/client/gtk3/launcher.py @@ -17,7 +17,7 @@ import sys import traceback from typing import Any -from collections.abc import Callable, Sequence +from collections.abc import Callable from xpra.scripts.config import read_config, make_defaults_struct, validate_config, save_config from xpra.gtk.signals import register_os_signals @@ -1138,7 +1138,7 @@ def main(argv) -> int: return do_main(argv) -def do_main(argv: Sequence[str]) -> int: +def do_main(argv: list[str]) -> int: from xpra.util.system import SIGNAMES from xpra.scripts.main import InitExit, InitInfo from xpra.platform.gui import init as gui_init, ready as gui_ready diff --git a/xpra/net/file_transfer.py b/xpra/net/file_transfer.py index 149c3eb0af..7d4634bddf 100644 --- a/xpra/net/file_transfer.py +++ b/xpra/net/file_transfer.py @@ -465,7 +465,7 @@ def error(message: str) -> None: # check file size and digest then process it: if chunk_state.written != chunk_state.filesize: - error("expected a file of %i bytes, got %i", chunk_state.filesize, chunk_state.written) + error(f"expected a file of {chunk_state.filesize} bytes, got {chunk_state.written}") return progress(chunk_state.written) diff --git a/xpra/platform/events.py b/xpra/platform/events.py index 076ef769d4..a61e79cdde 100755 --- a/xpra/platform/events.py +++ b/xpra/platform/events.py @@ -6,12 +6,12 @@ # later version. See the file COPYING for details. import sys -from collections.abc import Callable +from collections.abc import Callable, Sequence from xpra.platform import platform_import -EVENTS: tuple[str] = ("suspend", "resume", ) +EVENTS: Sequence[str] = ("suspend", "resume", ) def add_handler(event: str, handler: Callable) -> None: diff --git a/xpra/util/version.py b/xpra/util/version.py index 21e53b4f56..e3eafde4d0 100755 --- a/xpra/util/version.py +++ b/xpra/util/version.py @@ -235,11 +235,11 @@ def add_attrs(attrs: dict) -> None: def parse_version(v) -> tuple[Any]: if isinstance(v, str) and v: - def maybeint(v): + def maybeint(value: str) -> int | str: try: - return int(v) + return int(value) except ValueError: - return v + return value v = tuple(maybeint(x) for x in v.split("-")[0].split(".")) return tuple(v or ()) @@ -362,12 +362,12 @@ def get_latest_version(branch: str) -> bool | None | tuple[int, ...]: if len(branch_parts) >= 2: branch_strs.append("_" + branch_parts[0]) # ie: "_v6" branch_strs.append("") - platform_name = PLATFORM_FRIENDLY_NAMES.get(sys.platform, sys.platform) + platname = PLATFORM_FRIENDLY_NAMES.get(sys.platform, sys.platform) arch = get_platform_info().get("machine") for branch_str in branch_strs: for url in ( - f"{CURRENT_VERSION_URL}{branch_str}_{platform_name}_{arch}?{XPRA_VERSION}", - f"{CURRENT_VERSION_URL}{branch_str}_{platform_name}?{XPRA_VERSION}", + f"{CURRENT_VERSION_URL}{branch_str}_{platname}_{arch}?{XPRA_VERSION}", + f"{CURRENT_VERSION_URL}{branch_str}_{platname}?{XPRA_VERSION}", f"{CURRENT_VERSION_URL}{branch_str}?{XPRA_VERSION}", ): latest_version_no = get_version_from_url(url)