mirror of
https://github.com/sotam0316/docker-py-revanced.git
synced 2026-04-25 03:48:37 +09:00
👷 Added mypy
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
PATCH_APPS=youtube,twitter,reddit,youtube_music
|
||||
BUILD_EXTENDED=True
|
||||
EXCLUDE_PATCH_YOUTUBE=custom-branding,enable-debugging
|
||||
EXCLUDE_PATCH_YOUTUBE_EXTENDED=custom-branding-red,custom-branding-blue,materialyou
|
||||
EXCLUDE_PATCH_YOUTUBE_MUSIC_EXTENDED=custom-branding-music
|
||||
|
||||
@@ -47,6 +47,12 @@ repos:
|
||||
- id: flake8
|
||||
args: [ "--config=setup.cfg" ]
|
||||
|
||||
- repo: https://github.com/pre-commit/mirrors-mypy
|
||||
rev: v0.971
|
||||
hooks:
|
||||
- id: mypy
|
||||
additional_dependencies: [ types-requests ]
|
||||
|
||||
|
||||
|
||||
# sets up .pre-commit-ci.yaml to ensure pre-commit dependencies stay up to date
|
||||
|
||||
+17
-13
@@ -143,7 +143,11 @@ class Downloader(object):
|
||||
main_page = parser.css_first(".appRowVariantTag>.accent_color").attributes[
|
||||
"href"
|
||||
]
|
||||
int_version = re.search(r"\d", main_page).start()
|
||||
match = re.search(r"\d", main_page)
|
||||
if not match:
|
||||
logger.error("Cannot find app main page")
|
||||
sys.exit(-1)
|
||||
int_version = match.start()
|
||||
extra_release = main_page.rfind("release") - 1
|
||||
version = main_page[int_version:extra_release]
|
||||
version = version.replace("-", ".")
|
||||
@@ -167,19 +171,19 @@ class Downloader(object):
|
||||
self._download(download_url, file_name=file_name)
|
||||
|
||||
def download_revanced(self) -> None:
|
||||
assets = (
|
||||
("revanced", "revanced-cli", self.normal_cli_jar),
|
||||
("revanced", "revanced-integrations", self.normal_integrations_apk),
|
||||
("revanced", "revanced-patches", self.normal_patches_jar),
|
||||
("inotia00", "VancedMicroG", "VancedMicroG.apk"),
|
||||
)
|
||||
assets = [
|
||||
["revanced", "revanced-cli", self.normal_cli_jar],
|
||||
["revanced", "revanced-integrations", self.normal_integrations_apk],
|
||||
["revanced", "revanced-patches", self.normal_patches_jar],
|
||||
["inotia00", "VancedMicroG", "VancedMicroG.apk"],
|
||||
]
|
||||
if self.build_extended:
|
||||
assets += (
|
||||
("inotia00", "revanced-cli", self.cli_jar),
|
||||
("inotia00", "revanced-integrations", self.integrations_apk),
|
||||
("inotia00", "revanced-patches", self.patches_jar),
|
||||
)
|
||||
with ThreadPoolExecutor() as executor:
|
||||
assets += [
|
||||
["inotia00", "revanced-cli", self.cli_jar],
|
||||
["inotia00", "revanced-integrations", self.integrations_apk],
|
||||
["inotia00", "revanced-patches", self.patches_jar],
|
||||
]
|
||||
with ThreadPoolExecutor(7) as executor:
|
||||
executor.map(lambda repo: self.repository(*repo), assets)
|
||||
logger.info("Downloaded revanced microG ,cli, integrations and patches.")
|
||||
|
||||
|
||||
+9
-4
@@ -1,3 +1,4 @@
|
||||
import sys
|
||||
from subprocess import PIPE, Popen
|
||||
from time import perf_counter
|
||||
from typing import Any, List
|
||||
@@ -6,9 +7,9 @@ from loguru import logger
|
||||
|
||||
|
||||
class Parser(object):
|
||||
def __init__(self, patcher, env, temp_folder):
|
||||
self._PATCHES = []
|
||||
self._EXCLUDED = []
|
||||
def __init__(self, patcher, env, temp_folder) -> None:
|
||||
self._PATCHES: List[str] = []
|
||||
self._EXCLUDED: List[str] = []
|
||||
self.patcher = patcher
|
||||
self.keystore_name = env.str("KEYSTORE_FILE_NAME", "revanced.keystore")
|
||||
self.build_extended = env.bool("BUILD_EXTENDED", False)
|
||||
@@ -77,7 +78,11 @@ class Parser(object):
|
||||
|
||||
start = perf_counter()
|
||||
process = Popen(["java", *args], stdout=PIPE)
|
||||
for line in process.stdout:
|
||||
output = process.stdout
|
||||
if not output:
|
||||
logger.error("Failed to send request for patching.")
|
||||
sys.exit(-1)
|
||||
for line in output:
|
||||
logger.debug(line.decode(), flush=True, end="")
|
||||
process.wait()
|
||||
logger.info(
|
||||
|
||||
+5
-3
@@ -11,8 +11,10 @@ from src.utils import supported_apps
|
||||
class Patches(object):
|
||||
def check_java(self) -> None:
|
||||
logger.debug("Checking if java is available")
|
||||
jd = subprocess.check_output(["java", "-version"], stderr=subprocess.STDOUT)
|
||||
jd = str(jd)[1:-1]
|
||||
jd = subprocess.check_output(
|
||||
["java", "-version"], stderr=subprocess.STDOUT
|
||||
).decode("utf-8")
|
||||
jd = jd[1:-1]
|
||||
if "Runtime Environment" not in jd:
|
||||
logger.debug("Java Must be installed")
|
||||
exit(-1)
|
||||
@@ -91,7 +93,7 @@ class Patches(object):
|
||||
self.build_extended = env.bool("BUILD_EXTENDED", False)
|
||||
self.check_java()
|
||||
self.fetch_patches()
|
||||
self.extended_apps = ["youtube", "youtube_music"]
|
||||
self.extended_apps: List[str] = ["youtube", "youtube_music"]
|
||||
|
||||
def get(self, app: str) -> Tuple[List[Dict[str, str]], str]:
|
||||
logger.debug("Getting patches for %s" % app)
|
||||
|
||||
Reference in New Issue
Block a user