mirror of
https://github.com/DragoonAethis/itch-dl.git
synced 2025-04-19 21:51:27 +02:00
Fix/disable all linter warnings
This commit is contained in:
parent
7a833a8a5b
commit
5f5f61bffb
@ -51,9 +51,9 @@ def parse_args() -> argparse.Namespace:
|
||||
parser.add_argument("--parallel", metavar="parallel", type=int, default=None,
|
||||
help="how many threads to use for downloading games (default: 1)")
|
||||
|
||||
parser.add_argument("--filter-files-platform", metavar="platforms", action="extend", nargs='+',
|
||||
parser.add_argument("--filter-files-platform", metavar="platforms", action="extend", nargs="+",
|
||||
help="filter downloaded files by platform (windows, mac, linux, android, native)")
|
||||
parser.add_argument("--filter-files-type", metavar="types", action="extend", nargs='+',
|
||||
parser.add_argument("--filter-files-type", metavar="types", action="extend", nargs="+",
|
||||
help="filter downloaded files by type (see wiki for valid values)")
|
||||
parser.add_argument("--filter-files-glob", metavar="glob", default=None,
|
||||
help="filter downloaded files with a shell-style glob/fnmatch (unmatched files are skipped)")
|
||||
|
@ -52,13 +52,13 @@ def process_platform_traits(platforms: list[str]) -> list[str] | None:
|
||||
traits = set()
|
||||
for p in platforms:
|
||||
platform_trait = None
|
||||
p = p.strip().lower().removeprefix("p_")
|
||||
p = p.strip().lower().removeprefix("p_") # noqa: PLW2901
|
||||
|
||||
if p.startswith("native"):
|
||||
p = platform.system().lower()
|
||||
p = platform.system().lower() # noqa: PLW2901
|
||||
if p.endswith("bsd"):
|
||||
logging.warning("Note: Native downloads for *BSDs are not available - Linux binaries will be used.")
|
||||
p = "linux"
|
||||
p = "linux" # noqa: PLW2901
|
||||
|
||||
for key, trait in trait_mapping.items():
|
||||
if p.startswith(key):
|
||||
|
@ -1,7 +1,6 @@
|
||||
import os
|
||||
import json
|
||||
import re
|
||||
import fnmatch
|
||||
import logging
|
||||
import urllib.parse
|
||||
import zipfile
|
||||
|
@ -255,8 +255,8 @@ def get_jobs_for_url_or_path(path_or_url: str, settings: Settings) -> list[str]:
|
||||
|
||||
def preprocess_job_urls(jobs: list[str], settings: Settings) -> list[str]:
|
||||
cleaned_jobs = set()
|
||||
for job in jobs:
|
||||
job = job.strip()
|
||||
for base_job in jobs:
|
||||
job = base_job.strip()
|
||||
|
||||
if should_skip_item_by_glob("URL", job, settings.filter_urls_glob):
|
||||
continue
|
||||
|
@ -37,7 +37,7 @@ def get_int_after_marker_in_json(text: str, marker: str, key: str) -> int | None
|
||||
return int(found_ints[0])
|
||||
|
||||
|
||||
def should_skip_item_by_glob(kind: Literal['File'] | Literal['URL'], item: str, glob: str):
|
||||
def should_skip_item_by_glob(kind: Literal["File"] | Literal["URL"], item: str, glob: str) -> bool:
|
||||
if glob and not fnmatch(item, glob):
|
||||
logging.info("%s '%s' does not match the glob filter '%s', skipping", kind, item, glob)
|
||||
return True
|
||||
@ -45,7 +45,7 @@ def should_skip_item_by_glob(kind: Literal['File'] | Literal['URL'], item: str,
|
||||
return False
|
||||
|
||||
|
||||
def should_skip_item_by_regex(kind: Literal['File'] | Literal['URL'], item: str, regex: str):
|
||||
def should_skip_item_by_regex(kind: Literal["File"] | Literal["URL"], item: str, regex: str) -> bool:
|
||||
if regex and not re.fullmatch(regex, item):
|
||||
logging.info("%s '%s' does not match the regex filter '%s', skipping", kind, item, regex)
|
||||
return True
|
||||
|
@ -51,4 +51,4 @@ target-version = "py310"
|
||||
[tool.ruff.lint]
|
||||
# https://docs.astral.sh/ruff/rules/
|
||||
select = ["F", "E", "N", "UP", "ANN", "S", "B", "A", "COM", "C4", "T10", "ISC", "LOG", "Q", "SIM", "TC", "ARG", "PGH", "PLE", "PLW", "RUF", "G"]
|
||||
ignore = ["COM812"]
|
||||
ignore = ["COM812", "LOG015"]
|
||||
|
Loading…
x
Reference in New Issue
Block a user