Skip to content

Commit

Permalink
minor linter fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
totaam committed Nov 11, 2024
1 parent 9b3d73e commit 854231f
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions xpra/client/gtk3/launcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion xpra/net/file_transfer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions xpra/platform/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
12 changes: 6 additions & 6 deletions xpra/util/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 ())
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 854231f

Please sign in to comment.