mirror of
https://github.com/sotam0316/docker-py-revanced.git
synced 2026-04-24 19:38:36 +09:00
🚨 Lint Fixes
This commit is contained in:
committed by
Nikhil Badyal
parent
d2347f34bf
commit
c436c4bc98
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
[tool.ruff]
|
[tool.ruff]
|
||||||
line-length = 120
|
line-length = 120
|
||||||
target-version = "py311"
|
target-version = "py313"
|
||||||
fix = true
|
fix = true
|
||||||
show-fixes = true
|
show-fixes = true
|
||||||
[tool.ruff.lint]
|
[tool.ruff.lint]
|
||||||
|
|||||||
+4
-4
@@ -63,8 +63,8 @@ class APP(object):
|
|||||||
download_cache: dict[tuple[str, str], tuple[str, str]],
|
download_cache: dict[tuple[str, str], tuple[str, str]],
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Download apk to be patched, skipping if already downloaded (matching source and version)."""
|
"""Download apk to be patched, skipping if already downloaded (matching source and version)."""
|
||||||
from src.downloader.download import Downloader
|
from src.downloader.download import Downloader # noqa: PLC0415
|
||||||
from src.downloader.factory import DownloaderFactory
|
from src.downloader.factory import DownloaderFactory # noqa: PLC0415
|
||||||
|
|
||||||
if self.download_dl:
|
if self.download_dl:
|
||||||
logger.info("Downloading apk to be patched using provided dl")
|
logger.info("Downloading apk to be patched using provided dl")
|
||||||
@@ -137,12 +137,12 @@ class APP(object):
|
|||||||
-------
|
-------
|
||||||
tuple of strings, which is the tag,file name of the downloaded file.
|
tuple of strings, which is the tag,file name of the downloaded file.
|
||||||
"""
|
"""
|
||||||
from src.downloader.download import Downloader
|
from src.downloader.download import Downloader # noqa: PLC0415
|
||||||
|
|
||||||
url = url.strip()
|
url = url.strip()
|
||||||
tag = "latest"
|
tag = "latest"
|
||||||
if url.startswith("https://github"):
|
if url.startswith("https://github"):
|
||||||
from src.downloader.github import Github
|
from src.downloader.github import Github # noqa: PLC0415
|
||||||
|
|
||||||
tag, url = Github.patch_resource(url, assets_filter, config)
|
tag, url = Github.patch_resource(url, assets_filter, config)
|
||||||
if tag.startswith("tags/"):
|
if tag.startswith("tags/"):
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
"""APK Pure Downloader Class."""
|
"""APK Pure Downloader Class."""
|
||||||
|
|
||||||
|
from functools import cmp_to_key
|
||||||
from typing import Any, Self
|
from typing import Any, Self
|
||||||
|
from urllib.parse import parse_qs, urlparse
|
||||||
|
|
||||||
import requests
|
import requests
|
||||||
from bs4 import BeautifulSoup
|
from bs4 import BeautifulSoup
|
||||||
@@ -35,8 +37,6 @@ class ApkPure(Downloader):
|
|||||||
|
|
||||||
def _compare_dls(self: Self, dl1: str, dl2: str) -> int:
|
def _compare_dls(self: Self, dl1: str, dl2: str) -> int:
|
||||||
"""Compare two dls of same type (apk or xapk) to prioritise the archs on lower indices."""
|
"""Compare two dls of same type (apk or xapk) to prioritise the archs on lower indices."""
|
||||||
from urllib.parse import parse_qs, urlparse
|
|
||||||
|
|
||||||
apk_type1 = parse_qs(urlparse(dl1).query).get("nc")
|
apk_type1 = parse_qs(urlparse(dl1).query).get("nc")
|
||||||
apk_type2 = parse_qs(urlparse(dl2).query).get("nc")
|
apk_type2 = parse_qs(urlparse(dl2).query).get("nc")
|
||||||
if apk_type1 and apk_type2:
|
if apk_type1 and apk_type2:
|
||||||
@@ -67,8 +67,6 @@ class ApkPure(Downloader):
|
|||||||
:param app: Name of the app
|
:param app: Name of the app
|
||||||
:return: Tuple of filename and app direct download link
|
:return: Tuple of filename and app direct download link
|
||||||
"""
|
"""
|
||||||
from functools import cmp_to_key
|
|
||||||
|
|
||||||
logger.debug(f"Extracting download link from\n{page}")
|
logger.debug(f"Extracting download link from\n{page}")
|
||||||
r = requests.get(page, headers=request_header, timeout=request_timeout)
|
r = requests.get(page, headers=request_header, timeout=request_timeout)
|
||||||
handle_request_response(r, page)
|
handle_request_response(r, page)
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ class Downloader(object):
|
|||||||
"""Extract download link from web page."""
|
"""Extract download link from web page."""
|
||||||
raise NotImplementedError(implement_method)
|
raise NotImplementedError(implement_method)
|
||||||
|
|
||||||
def specific_version(self: Self, app: APP, version: str) -> tuple[str, str]:
|
def specific_version(self: Self, app: "APP", version: str) -> tuple[str, str]:
|
||||||
"""Function to download the specified version of app..
|
"""Function to download the specified version of app..
|
||||||
|
|
||||||
:param app: Name of the application
|
:param app: Name of the application
|
||||||
|
|||||||
+1
-1
@@ -1,5 +1,6 @@
|
|||||||
"""Generate patches using cli."""
|
"""Generate patches using cli."""
|
||||||
|
|
||||||
|
import json
|
||||||
import re
|
import re
|
||||||
import subprocess
|
import subprocess
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
@@ -97,7 +98,6 @@ def convert_command_output_to_json(
|
|||||||
parsed_data.sort(key=lambda x: x["name"])
|
parsed_data.sort(key=lambda x: x["name"])
|
||||||
|
|
||||||
with Path("patches.json").open("w") as file:
|
with Path("patches.json").open("w") as file:
|
||||||
import json
|
|
||||||
|
|
||||||
json.dump(parsed_data, file, indent=2)
|
json.dump(parsed_data, file, indent=2)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user