From 5da62077779b3c9cfba43a5b1d0aa92c20eafe72 Mon Sep 17 00:00:00 2001 From: R1kaB3rN <100738684+R1kaB3rN@users.noreply.github.com> Date: Wed, 1 Jan 2025 17:21:40 -0800 Subject: [PATCH] umu: address lint errors --- umu/umu_bspatch.py | 12 +++++++++--- umu/umu_proton.py | 5 +++-- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/umu/umu_bspatch.py b/umu/umu_bspatch.py index 1e7832689..4df6148bb 100644 --- a/umu/umu_bspatch.py +++ b/umu/umu_bspatch.py @@ -238,7 +238,11 @@ def _check_binaries( return None if stats.st_size > MMAP_MIN: with mmap(fp.fileno(), length=0, access=ACCESS_READ) as mm: - xxhash = xxh3_64_intdigest(mm) + # Ignore. According to the docs: + # "Memory-mapped file objects behave like both bytearray and + # like file objects. You can use mmap objects in most places + # where bytearray are expected;" + xxhash = xxh3_64_intdigest(mm) # type: ignore mm.madvise(MADV_DONTNEED, 0, stats.st_size) else: xxhash = xxh3_64_intdigest(fp.read()) @@ -305,7 +309,8 @@ def _patch_proton_file(self, path: Path, item: Entry) -> None: if size < stats.st_size: mm.resize(size) - xxhash = xxh3_64_intdigest(mm) + # Ignore. Passing an mmap is valid + xxhash = xxh3_64_intdigest(mm) # type: ignore if xxhash != digest: err: str = ( @@ -337,7 +342,8 @@ def _write_proton_file(self, path: Path, item: Entry) -> None: # Decompress our data and write to our file with mmap(fp.fileno(), length=0, access=ACCESS_WRITE) as mm: mm[:] = decompress(data) - xxhash = xxh3_64_intdigest(mm) + # Ignore. Passing an mmap is valid + xxhash = xxh3_64_intdigest(mm) # type: ignore if xxhash != digest: err: str = ( diff --git a/umu/umu_proton.py b/umu/umu_proton.py index 16eb14128..2c8fc6a5f 100644 --- a/umu/umu_proton.py +++ b/umu/umu_proton.py @@ -485,7 +485,7 @@ def _get_delta( env: dict[str, str], umu_compat: Path, patch: bytes, - assets: tuple[tuple[str, str], tuple[str, str]], + assets: tuple[tuple[str, str], tuple[str, str]] | tuple[()], session_pools: SessionPools, ) -> dict[str, str] | None: thread_pool, _ = session_pools @@ -532,7 +532,8 @@ def _get_delta( try: with vdf.open(encoding="utf-8") as file: # We're up to date if the internal tool is the GH asset name w/o suffix - if any(filter(lambda line: build in line, file)): + # Ignore. See https://github.com/python/mypy/issues/12682 + if any(filter(lambda line: build in line, file)): # type: ignore log.info("%s is up to date", version) os.environ["PROTONPATH"] = str(umu_compat.joinpath(version)) env["PROTONPATH"] = os.environ["PROTONPATH"]