🚨 Lint Fixes

This commit is contained in:
Nikhil Badyal
2025-06-25 09:27:00 +05:30
committed by Nikhil Badyal
parent d2347f34bf
commit c436c4bc98
5 changed files with 9 additions and 11 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
[tool.ruff]
line-length = 120
target-version = "py311"
target-version = "py313"
fix = true
show-fixes = true
[tool.ruff.lint]
+4 -4
View File
@@ -63,8 +63,8 @@ class APP(object):
download_cache: dict[tuple[str, str], tuple[str, str]],
) -> None:
"""Download apk to be patched, skipping if already downloaded (matching source and version)."""
from src.downloader.download import Downloader
from src.downloader.factory import DownloaderFactory
from src.downloader.download import Downloader # noqa: PLC0415
from src.downloader.factory import DownloaderFactory # noqa: PLC0415
if self.download_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.
"""
from src.downloader.download import Downloader
from src.downloader.download import Downloader # noqa: PLC0415
url = url.strip()
tag = "latest"
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)
if tag.startswith("tags/"):
+2 -4
View File
@@ -1,6 +1,8 @@
"""APK Pure Downloader Class."""
from functools import cmp_to_key
from typing import Any, Self
from urllib.parse import parse_qs, urlparse
import requests
from bs4 import BeautifulSoup
@@ -35,8 +37,6 @@ class ApkPure(Downloader):
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."""
from urllib.parse import parse_qs, urlparse
apk_type1 = parse_qs(urlparse(dl1).query).get("nc")
apk_type2 = parse_qs(urlparse(dl2).query).get("nc")
if apk_type1 and apk_type2:
@@ -67,8 +67,6 @@ class ApkPure(Downloader):
:param app: Name of the app
:return: Tuple of filename and app direct download link
"""
from functools import cmp_to_key
logger.debug(f"Extracting download link from\n{page}")
r = requests.get(page, headers=request_header, timeout=request_timeout)
handle_request_response(r, page)
+1 -1
View File
@@ -67,7 +67,7 @@ class Downloader(object):
"""Extract download link from web page."""
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..
:param app: Name of the application
+1 -1
View File
@@ -1,5 +1,6 @@
"""Generate patches using cli."""
import json
import re
import subprocess
from pathlib import Path
@@ -97,7 +98,6 @@ def convert_command_output_to_json(
parsed_data.sort(key=lambda x: x["name"])
with Path("patches.json").open("w") as file:
import json
json.dump(parsed_data, file, indent=2)