'Refactored by Sourcery'

This commit is contained in:
Sourcery AI
2023-08-08 03:36:41 +00:00
parent b1668a96a1
commit 6b1cefadf4
7 changed files with 43 additions and 53 deletions
+1 -2
View File
@@ -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.
+1 -3
View File
@@ -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,
+1 -1
View File
@@ -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)
+1 -3
View File
@@ -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":