Skip to content

Commit

Permalink
umu: address lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
R1kaB3rN committed Jan 2, 2025
1 parent 2120af6 commit 5da6207
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
12 changes: 9 additions & 3 deletions umu/umu_bspatch.py
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down Expand Up @@ -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 = (
Expand Down Expand Up @@ -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 = (
Expand Down
5 changes: 3 additions & 2 deletions umu/umu_proton.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"]
Expand Down

0 comments on commit 5da6207

Please sign in to comment.