From ca048f11d2ce2b2aa756fb00f7f7b8b4ef58c79e Mon Sep 17 00:00:00 2001 From: R1kaB3rN <100738684+R1kaB3rN@users.noreply.github.com> Date: Fri, 13 Dec 2024 10:02:02 -0800 Subject: [PATCH] umu_bspatch: refactor function parameters --- umu/umu_bspatch.py | 45 +++++++++++++-------------------------------- 1 file changed, 13 insertions(+), 32 deletions(-) diff --git a/umu/umu_bspatch.py b/umu/umu_bspatch.py index e32cf433..4651c575 100644 --- a/umu/umu_bspatch.py +++ b/umu/umu_bspatch.py @@ -112,14 +112,7 @@ def add_binaries(self) -> None: # noqa: D102 # Decompress the bz2 data and write the file self._futures.append( self._thread_pool.submit( - self._write_proton_file, - build_file, - self._cache, - item["data"], - item["cksum"], - item["mode"], - item["time"], - item["size"], + self._write_proton_file, build_file, self._cache, item ) ) continue @@ -160,12 +153,7 @@ def update_binaries(self) -> None: # noqa: D102 # For files, apply a binary patch self._futures.append( self._thread_pool.submit( - self._patch_proton_file, - build_file, - item["data"], - item["cksum"], - item["mode"], - item["time"], + self._patch_proton_file, build_file, item ) ) continue @@ -256,14 +244,11 @@ def _check_proton_binaries( return item - def _patch_proton_file( - self, - path: Path, - bdiff: bytes, - digest: int, - mode: int, - time: float, - ) -> None: + def _patch_proton_file(self, path: Path, item: Entry) -> None: + bdiff: bytes = item["data"] + digest: int = item["cksum"] + mode: int = item["mode"] + time: float = item["time"] try: # Since some wine binaries are missing the writable bit and # we're memory mapping files, before applying a binary patch, @@ -307,16 +292,12 @@ def _patch_proton_file( log.warning("File '%s' has mode bits 0o700", path) raise - def _write_proton_file( - self, - path: Path, - tmp: Path, - data: bytes, - digest: int, - mode: int, - time: float, - size: int, - ) -> None: + def _write_proton_file(self, path: Path, tmp: Path, item: Entry) -> None: + data: bytes = item["data"] + digest: int = item["cksum"] + mode: int = item["mode"] + time: float = item["time"] + size: int = item["size"] with NamedTemporaryFile(dir=tmp) as fp: stats: os.stat_result cksum: int = 0