Skip to content

Commit

Permalink
Appease RUF lints
Browse files Browse the repository at this point in the history
  • Loading branch information
bbhtt committed Jan 16, 2025
1 parent 92c0e33 commit bf6c4b5
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion flatpak_builder_lint/appstream.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def parse_xml(path: str) -> etree._ElementTree:
try:
return etree.parse(path)
except etree.XMLSyntaxError as e:
raise RuntimeError(f"XML syntax error in file {path}: {str(e)}") from None
raise RuntimeError(f"XML syntax error in file {path}: {e!s}") from None


def components(path: str) -> list[etree._Element]:
Expand Down
14 changes: 8 additions & 6 deletions flatpak_builder_lint/checks/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from typing import ClassVar

from .. import ostree

ALL = []
Expand All @@ -13,12 +15,12 @@ def __init__(cls, *args, **kwargs) -> None: # type: ignore


class Check(metaclass=CheckMeta):
warnings: set[str] = set()
errors: set[str] = set()
jsonschema: set[str] = set()
appstream: set[str] = set()
desktopfile: set[str] = set()
info: set[str] = set()
warnings: ClassVar[set[str]] = set()
errors: ClassVar[set[str]] = set()
jsonschema: ClassVar[set[str]] = set()
appstream: ClassVar[set[str]] = set()
desktopfile: ClassVar[set[str]] = set()
info: ClassVar[set[str]] = set()
repo_primary_ref: str | None = None

def _populate_ref(self, repo: str) -> None:
Expand Down
2 changes: 1 addition & 1 deletion flatpak_builder_lint/checks/finish_args.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def _validate(self, appid: str | None, finish_args: dict[str, set[str]]) -> None

mode_suffix = "rw"
if fs.startswith(xdgdirs) and fs.endswith(modes):
mode_src = [i for i in modes if fs.endswith(i)][0]
mode_src = next(i for i in modes if fs.endswith(i))
mode_suffix = mode_src.split(":", 1)[1]

if re.match(regexp_arbitrary, fs):
Expand Down
2 changes: 1 addition & 1 deletion flatpak_builder_lint/checks/flathub_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@


class FlathubJsonCheck(Check):
arches: set[str] = {"x86_64", "aarch64"}
arches: tuple[str] = ("x86_64", "aarch64")

def _check_if_extra_data(self, modules: list) -> bool:
for module in modules:
Expand Down

0 comments on commit bf6c4b5

Please sign in to comment.