From 2bcd0a6b3a48a9e80ffda0db7c4242190eb54c6f Mon Sep 17 00:00:00 2001 From: Nikhil Badyal Date: Mon, 22 Aug 2022 23:14:08 +0530 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20Fixed=20Patched=20getting?= =?UTF-8?q?=20mixed?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.py | 42 +++++++++++++++++------------------------- 1 file changed, 17 insertions(+), 25 deletions(-) diff --git a/main.py b/main.py index af49ce9..4bee164 100644 --- a/main.py +++ b/main.py @@ -49,7 +49,7 @@ apk_mirror_version_urls = { } -class Downloader: +class Downloader(object): _CHUNK_SIZE = 2**21 * 5 _QUEUE = PriorityQueue() _QUEUE_LENGTH = 0 @@ -172,7 +172,7 @@ class Downloader: break -class Patches: +class Patches(object): def __init__(self) -> None: logger.debug("fetching all patches") resp = session.get( @@ -246,29 +246,22 @@ class Patches: return patches, version -class ArgParser: - _PATCHES = [] - _EXCLUDED = [] +class ArgParser(object): + def __init__(self): + self._PATCHES = [] + self._EXCLUDED = [] - @classmethod - def include(cls, name: str) -> None: - cls._PATCHES.extend(["-i", name]) + def include(self, name: str) -> None: + self._PATCHES.extend(["-i", name]) - @classmethod - def exclude(cls, name: str) -> None: - cls._PATCHES.extend(["-e", name]) - cls._EXCLUDED.append(name) + def exclude(self, name: str) -> None: + self._PATCHES.extend(["-e", name]) + self._EXCLUDED.append(name) - @classmethod - def get_excluded_patches(cls) -> List[Any]: - return cls._EXCLUDED + def get_excluded_patches(self) -> List[Any]: + return self._EXCLUDED - @classmethod - def reset_excluded_patches(cls) -> None: - cls._EXCLUDED = [] - - @classmethod - def run(cls, app: str, version: str, is_experimental: bool = False) -> None: + def run(self, app: str, version: str, is_experimental: bool = False) -> None: logger.debug(f"Sending request to revanced cli for building {app} revanced") args = [ "-jar", @@ -294,8 +287,8 @@ class ArgParser: if app in ("reddit", "tiktok"): args.append("-r") - if cls._PATCHES: - args.extend(cls._PATCHES) + if self._PATCHES: + args.extend(self._PATCHES) start = perf_counter() process = Popen(["java", *args], stdout=PIPE) @@ -368,7 +361,6 @@ def main() -> None: logger.debug(f"Excluded patches {excluded} for {app}") else: logger.debug(f"No excluded patches for {app}") - arg_parser.reset_excluded_patches() def get_patches_version() -> Any: experiment = False @@ -384,7 +376,7 @@ def main() -> None: for app in apps: try: is_experimental = False - arg_parser = ArgParser + arg_parser = ArgParser() logger.debug("Trying to build %s" % app) app_patches, version, is_experimental = get_patches_version() download_from_apkmirror(version, app, downloader)