mirror of
https://github.com/sotam0316/docker-py-revanced.git
synced 2026-04-25 03:48:37 +09:00
'Refactored by Sourcery'
This commit is contained in:
@@ -56,8 +56,7 @@ class ApkMirror(Downloader):
|
||||
f"Unable to find any apk on apkmirror_specific_version on {main_page}"
|
||||
)
|
||||
raise AppNotFound("Unable to find apk on apkmirror site.")
|
||||
download_url = self.config.apk_mirror + sub_url
|
||||
return download_url
|
||||
return self.config.apk_mirror + sub_url
|
||||
|
||||
def specific_version(self, app: str, version: str) -> None:
|
||||
"""Function to download the specified version of app from apkmirror.
|
||||
|
||||
@@ -45,9 +45,7 @@ class Downloader(object):
|
||||
headers = {}
|
||||
if self.config.personal_access_token and "github" in url:
|
||||
logger.debug("Using personal access token")
|
||||
headers.update(
|
||||
{"Authorization": "token " + self.config.personal_access_token}
|
||||
)
|
||||
headers["Authorization"] = f"token {self.config.personal_access_token}"
|
||||
response = self.config.session.get(
|
||||
url,
|
||||
stream=True,
|
||||
|
||||
@@ -24,7 +24,7 @@ class DownloaderFactory(object):
|
||||
patcher : Patcher
|
||||
config : Config
|
||||
"""
|
||||
if app == "patches" or app == "microg":
|
||||
if app in {"patches", "microg"}:
|
||||
return Github(patcher, config)
|
||||
if app in config.apk_pure:
|
||||
return ApkPure(patcher, config)
|
||||
|
||||
@@ -31,9 +31,7 @@ class Github(Downloader):
|
||||
}
|
||||
if self.config.personal_access_token:
|
||||
logger.debug("Using personal access token")
|
||||
headers.update(
|
||||
{"Authorization": "token " + self.config.personal_access_token}
|
||||
)
|
||||
headers["Authorization"] = f"token {self.config.personal_access_token}"
|
||||
response = requests.get(repo_url, headers=headers)
|
||||
handle_response(response)
|
||||
if repo_name == "revanced-patches":
|
||||
|
||||
+2
-4
@@ -81,7 +81,7 @@ class Parser(object):
|
||||
"-jar",
|
||||
app.resource["cli"],
|
||||
"-a",
|
||||
app.app_name + ".apk",
|
||||
f"{app.app_name}.apk",
|
||||
"-b",
|
||||
app.resource["patches"],
|
||||
"-m",
|
||||
@@ -104,9 +104,7 @@ class Parser(object):
|
||||
if app.app_name in self.config.rip_libs_apps:
|
||||
excluded = set(possible_archs) - set(app.archs_to_build)
|
||||
for arch in excluded:
|
||||
args.append("--rip-lib")
|
||||
args.append(arch)
|
||||
|
||||
args.extend(("--rip-lib", arch))
|
||||
start = perf_counter()
|
||||
logger.debug(
|
||||
f"Sending request to revanced cli for building with args java {args}"
|
||||
|
||||
+20
-21
@@ -16,27 +16,26 @@ possible_archs = ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"]
|
||||
def update_changelog(name: str, response: Dict[str, str]) -> None:
|
||||
"""Updated Changelog."""
|
||||
parent_repo = "https://github.com/nikhilbadyal/docker-py-revanced"
|
||||
file1 = open("changelog.md", "a", encoding="utf_8")
|
||||
collapse_start = f"\n<details> <summary>👀 {name} </summary>\n\n"
|
||||
release_version = (
|
||||
f"**Release Version** - [{response['tag_name']}]({response['html_url']})<br>"
|
||||
)
|
||||
change_log = f"**Changelog** -<br> {response['body']}"
|
||||
publish_time = f"**Published at** -<br> {response['published_at']}"
|
||||
footer = (
|
||||
f"<br><sub>Change logs generated by [Docker Py Revanced]({parent_repo})</sub>\n"
|
||||
)
|
||||
collapse_end = "</details>"
|
||||
change_log = (
|
||||
collapse_start
|
||||
+ release_version
|
||||
+ change_log
|
||||
+ publish_time
|
||||
+ footer
|
||||
+ collapse_end
|
||||
)
|
||||
file1.write(change_log)
|
||||
file1.close()
|
||||
with open("changelog.md", "a", encoding="utf_8") as file1:
|
||||
collapse_start = f"\n<details> <summary>👀 {name} </summary>\n\n"
|
||||
release_version = (
|
||||
f"**Release Version** - [{response['tag_name']}]({response['html_url']})<br>"
|
||||
)
|
||||
change_log = f"**Changelog** -<br> {response['body']}"
|
||||
publish_time = f"**Published at** -<br> {response['published_at']}"
|
||||
footer = (
|
||||
f"<br><sub>Change logs generated by [Docker Py Revanced]({parent_repo})</sub>\n"
|
||||
)
|
||||
collapse_end = "</details>"
|
||||
change_log = (
|
||||
collapse_start
|
||||
+ release_version
|
||||
+ change_log
|
||||
+ publish_time
|
||||
+ footer
|
||||
+ collapse_end
|
||||
)
|
||||
file1.write(change_log)
|
||||
|
||||
|
||||
class AppNotFound(ValueError):
|
||||
|
||||
Reference in New Issue
Block a user