Skip to content

Bulk asynchronous downloader for multiple file hosts

ci/cd: update ruff and dependencies (#660)

NTFSvolumef8c563c4d154
diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml
index b3a289707..92c26fde5 100644
--- a/.github/ISSUE_TEMPLATE/bug_report.yml
+++ b/.github/ISSUE_TEMPLATE/bug_report.yml
@@ -22,7 +22,7 @@ body:
required: true
- label: "I understand this is open source software provided for free and that I might not receive a timely response."
required: true
- - label: "I’ve checked existing issues to avoid creating a duplicates."
+ - label: "I’ve checked existing issues to avoid creating a duplicate."
required: true
- label: "A similar issue was previously marked as `completed` and the [changelog](https://github.com/jbsparrow/CyberDropDownloader/blob/dev/CHANGELOG.md) says it was implemented, but I'm confident the bug still exists"
required: false
diff --git a/.github/workflows/ruff.yaml b/.github/workflows/ruff.yaml
index 69d751efb..3ba76e9b1 100644
--- a/.github/workflows/ruff.yaml
+++ b/.github/workflows/ruff.yaml
@@ -10,10 +10,10 @@ jobs:
- name: ruff lint
uses: astral-sh/ruff-action@v3
with:
- version: "0.8.0"
+ version: "0.9.6"
- name: ruff format check
uses: astral-sh/ruff-action@v3
with:
args: "format --check"
- version: "0.8.0"
+ version: "0.9.6"
diff --git a/cyberdrop_dl/managers/client_manager.py b/cyberdrop_dl/managers/client_manager.py
index 83cb1447a..94d576612 100644
--- a/cyberdrop_dl/managers/client_manager.py
+++ b/cyberdrop_dl/managers/client_manager.py
@@ -118,7 +118,7 @@ class ClientManager:
continue
current_cookie_file_domains = set()
for cookie in cookie_jar:
- simplified_domain = cookie.domain[1:] if cookie.domain.startswith(".") else cookie.domain
+ simplified_domain = cookie.domain.removeprefix(".")
if simplified_domain not in current_cookie_file_domains:
log(f"Found cookies for {simplified_domain} in file '{file.name}'", 20)
current_cookie_file_domains.add(simplified_domain)
diff --git a/cyberdrop_dl/managers/path_manager.py b/cyberdrop_dl/managers/path_manager.py
index 4bdb60a8d..17576be0c 100644
--- a/cyberdrop_dl/managers/path_manager.py
+++ b/cyberdrop_dl/managers/path_manager.py
@@ -117,7 +117,7 @@ class PathManager:
log_settings_config = log_settings_config.model_copy(update=log_files)
for model_name in self._logs_model_names:
- internal_name = f"{model_name.replace('_log','')}_log"
+ internal_name = f"{model_name.replace('_log', '')}_log"
setattr(self, internal_name, self.log_folder / getattr(log_settings_config, model_name))
def _delete_logs_and_folders(self, now):
@@ -131,7 +131,7 @@ class PathManager:
def _create_output_folders(self):
for model_name in self._logs_model_names:
- internal_name = f"{model_name.replace('_log','')}_log"
+ internal_name = f"{model_name.replace('_log', '')}_log"
path: Path = getattr(self, internal_name)
path.parent.mkdir(parents=True, exist_ok=True)
diff --git a/cyberdrop_dl/scraper/crawlers/eightmuses_crawler.py b/cyberdrop_dl/scraper/crawlers/eightmuses_crawler.py
index 61e23a455..768c12b93 100644
--- a/cyberdrop_dl/scraper/crawlers/eightmuses_crawler.py
+++ b/cyberdrop_dl/scraper/crawlers/eightmuses_crawler.py
@@ -63,7 +63,7 @@ class EightMusesCrawler(Crawler):
tile_link,
tile_title,
part_of_album=part_of_album,
- album_id=f'{scrape_item.album_id}/{tile_title.replace(" ", "-")}',
+ album_id=f"{scrape_item.album_id}/{tile_title.replace(' ', '-')}",
add_parent=scrape_item.url,
)
if part_of_album:
diff --git a/cyberdrop_dl/scraper/crawlers/eporner_crawler.py b/cyberdrop_dl/scraper/crawlers/eporner_crawler.py
index 95668cbcd..e710491c8 100644
--- a/cyberdrop_dl/scraper/crawlers/eporner_crawler.py
+++ b/cyberdrop_dl/scraper/crawlers/eporner_crawler.py
@@ -122,7 +122,7 @@ class EpornerCrawler(Crawler):
filename, ext = self.get_filename_and_ext(link.name)
if ext == ".m3u8":
raise ScrapeError(422, origin=scrape_item)
- custom_filename = f"{info_dict["name"]} [{video_id}][{resolution}]{ext}"
+ custom_filename = f"{info_dict['name']} [{video_id}][{resolution}]{ext}"
custom_filename, _ = self.get_filename_and_ext(custom_filename)
await self.handle_file(link, scrape_item, filename, ext, custom_filename=custom_filename)
diff --git a/cyberdrop_dl/scraper/crawlers/spankbang_crawler.py b/cyberdrop_dl/scraper/crawlers/spankbang_crawler.py
index a7a3ee258..febca1bab 100644
--- a/cyberdrop_dl/scraper/crawlers/spankbang_crawler.py
+++ b/cyberdrop_dl/scraper/crawlers/spankbang_crawler.py
@@ -138,7 +138,7 @@ class SpankBangCrawler(Crawler):
scrape_item.possible_datetime = date
filename, ext = self.get_filename_and_ext(link.name)
- custom_filename = f"{info["title"]} [{resolution}]{ext}"
+ custom_filename = f"{info['title']} [{resolution}]{ext}"
custom_filename, _ = self.get_filename_and_ext(custom_filename)
await self.handle_file(link, scrape_item, filename, ext, custom_filename=custom_filename)
diff --git a/cyberdrop_dl/scraper/crawlers/tiktok_crawler.py b/cyberdrop_dl/scraper/crawlers/tiktok_crawler.py
index d4d26fa38..9d53d7b55 100644
--- a/cyberdrop_dl/scraper/crawlers/tiktok_crawler.py
+++ b/cyberdrop_dl/scraper/crawlers/tiktok_crawler.py
@@ -86,7 +86,7 @@ class TikTokCrawler(Crawler):
if item.get("images"):
await self.handle_image_post(scrape_item, item)
elif not post_url.path.endswith("mp3"):
- filename, ext = f'{item["video_id"]}.mp4', "mp4"
+ filename, ext = f"{item['video_id']}.mp4", "mp4"
new_scrape_item = self.create_scrape_item(
scrape_item, canonical_url, "", True, scrape_item.album_id, item["create_time"]
)
@@ -116,7 +116,7 @@ class TikTokCrawler(Crawler):
return
video_url = self.parse_url(json_data["data"]["play"])
- filename, ext = f'{json_data["data"]["video_id"]}.mp4', "mp4"
+ filename, ext = f"{json_data['data']['video_id']}.mp4", "mp4"
new_scrape_item = self.create_scrape_item(
scrape_item, canonical_url, "", True, scrape_item.album_id, json_data["data"]["create_time"]
)
@@ -135,7 +135,7 @@ class TikTokCrawler(Crawler):
return
audio_url = self.parse_url(data["music_info"]["play"])
- filename = f'{data["music_info"]["title"]}.mp3'
+ filename = f"{data['music_info']['title']}.mp3"
filename, ext = get_filename_and_ext(filename)
new_scrape_item = self.create_scrape_item(
scrape_item,
diff --git a/cyberdrop_dl/scraper/crawlers/youjizz_crawler.py b/cyberdrop_dl/scraper/crawlers/youjizz_crawler.py
index 1e1ff4b91..cbf17e0aa 100644
--- a/cyberdrop_dl/scraper/crawlers/youjizz_crawler.py
+++ b/cyberdrop_dl/scraper/crawlers/youjizz_crawler.py
@@ -80,7 +80,7 @@ class YouJizzCrawler(Crawler):
filename, ext = self.get_filename_and_ext(link.name)
if ext == ".m3u8":
raise ScrapeError(422, origin=scrape_item)
- custom_filename = f"{info["title"]} [{video_id}][{resolution}]{ext}"
+ custom_filename = f"{info['title']} [{video_id}][{resolution}]{ext}"
custom_filename, _ = self.get_filename_and_ext(custom_filename)
await self.handle_file(link, scrape_item, filename, ext, custom_filename=custom_filename)
diff --git a/cyberdrop_dl/ui/progress/deque_progress.py b/cyberdrop_dl/ui/progress/deque_progress.py
index 30e9bbb38..d96152f74 100644
--- a/cyberdrop_dl/ui/progress/deque_progress.py
+++ b/cyberdrop_dl/ui/progress/deque_progress.py
@@ -15,7 +15,7 @@ if TYPE_CHECKING:
def adjust_title(s: str, length: int = 40, placeholder: str = "...") -> str:
"""Collapse and truncate or pad the given string to fit in the given length."""
- return f"{s[:length - len(placeholder)]}{placeholder}" if len(s) >= length else s.ljust(length)
+ return f"{s[: length - len(placeholder)]}{placeholder}" if len(s) >= length else s.ljust(length)
class DequeProgress(ABC):
diff --git a/cyberdrop_dl/utils/yaml.py b/cyberdrop_dl/utils/yaml.py
index dbda070cc..a800a3b59 100644
--- a/cyberdrop_dl/utils/yaml.py
+++ b/cyberdrop_dl/utils/yaml.py
@@ -70,7 +70,7 @@ def handle_validation_error(e: ValidationError, *, title: str | None = None, sou
source = sources.get(e.title) if sources else None
title = title or e.title
source = f"from {source.resolve()}" if source else ""
- msg = f"Found {error_count} error{'s' if error_count>1 else ''} parsing {title} {source}"
+ msg = f"Found {error_count} error{'s' if error_count > 1 else ''} parsing {title} {source}"
startup_logger.error(msg)
for error in e.errors(include_url=False):
loc = ".".join(map(str, error["loc"]))
diff --git a/poetry.lock b/poetry.lock
index 5499d6c3c..66cd95d5c 100644
--- a/poetry.lock
+++ b/poetry.lock
@@ -1862,30 +1862,30 @@ jupyter = ["ipywidgets (>=7.5.1,<9)"]
[[package]]
name = "ruff"
-version = "0.8.6"
+version = "0.9.6"
description = "An extremely fast Python linter and code formatter, written in Rust."
optional = false
python-versions = ">=3.7"
groups = ["dev"]
files = [
- {file = "ruff-0.8.6-py3-none-linux_armv6l.whl", hash = "sha256:defed167955d42c68b407e8f2e6f56ba52520e790aba4ca707a9c88619e580e3"},
- {file = "ruff-0.8.6-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:54799ca3d67ae5e0b7a7ac234baa657a9c1784b48ec954a094da7c206e0365b1"},
- {file = "ruff-0.8.6-py3-none-macosx_11_0_arm64.whl", hash = "sha256:e88b8f6d901477c41559ba540beeb5a671e14cd29ebd5683903572f4b40a9807"},
- {file = "ruff-0.8.6-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:0509e8da430228236a18a677fcdb0c1f102dd26d5520f71f79b094963322ed25"},
- {file = "ruff-0.8.6-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:91a7ddb221779871cf226100e677b5ea38c2d54e9e2c8ed847450ebbdf99b32d"},
- {file = "ruff-0.8.6-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:248b1fb3f739d01d528cc50b35ee9c4812aa58cc5935998e776bf8ed5b251e75"},
- {file = "ruff-0.8.6-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:bc3c083c50390cf69e7e1b5a5a7303898966be973664ec0c4a4acea82c1d4315"},
- {file = "ruff-0.8.6-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:52d587092ab8df308635762386f45f4638badb0866355b2b86760f6d3c076188"},
- {file = "ruff-0.8.6-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:61323159cf21bc3897674e5adb27cd9e7700bab6b84de40d7be28c3d46dc67cf"},
- {file = "ruff-0.8.6-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:7ae4478b1471fc0c44ed52a6fb787e641a2ac58b1c1f91763bafbc2faddc5117"},
- {file = "ruff-0.8.6-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:0c000a471d519b3e6cfc9c6680025d923b4ca140ce3e4612d1a2ef58e11f11fe"},
- {file = "ruff-0.8.6-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:9257aa841e9e8d9b727423086f0fa9a86b6b420fbf4bf9e1465d1250ce8e4d8d"},
- {file = "ruff-0.8.6-py3-none-musllinux_1_2_i686.whl", hash = "sha256:45a56f61b24682f6f6709636949ae8cc82ae229d8d773b4c76c09ec83964a95a"},
- {file = "ruff-0.8.6-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:496dd38a53aa173481a7d8866bcd6451bd934d06976a2505028a50583e001b76"},
- {file = "ruff-0.8.6-py3-none-win32.whl", hash = "sha256:e169ea1b9eae61c99b257dc83b9ee6c76f89042752cb2d83486a7d6e48e8f764"},
- {file = "ruff-0.8.6-py3-none-win_amd64.whl", hash = "sha256:f1d70bef3d16fdc897ee290d7d20da3cbe4e26349f62e8a0274e7a3f4ce7a905"},
- {file = "ruff-0.8.6-py3-none-win_arm64.whl", hash = "sha256:7d7fc2377a04b6e04ffe588caad613d0c460eb2ecba4c0ccbbfe2bc973cbc162"},
- {file = "ruff-0.8.6.tar.gz", hash = "sha256:dcad24b81b62650b0eb8814f576fc65cfee8674772a6e24c9b747911801eeaa5"},
+ {file = "ruff-0.9.6-py3-none-linux_armv6l.whl", hash = "sha256:2f218f356dd2d995839f1941322ff021c72a492c470f0b26a34f844c29cdf5ba"},
+ {file = "ruff-0.9.6-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:b908ff4df65dad7b251c9968a2e4560836d8f5487c2f0cc238321ed951ea0504"},
+ {file = "ruff-0.9.6-py3-none-macosx_11_0_arm64.whl", hash = "sha256:b109c0ad2ececf42e75fa99dc4043ff72a357436bb171900714a9ea581ddef83"},
+ {file = "ruff-0.9.6-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1de4367cca3dac99bcbd15c161404e849bb0bfd543664db39232648dc00112dc"},
+ {file = "ruff-0.9.6-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:ac3ee4d7c2c92ddfdaedf0bf31b2b176fa7aa8950efc454628d477394d35638b"},
+ {file = "ruff-0.9.6-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:5dc1edd1775270e6aa2386119aea692039781429f0be1e0949ea5884e011aa8e"},
+ {file = "ruff-0.9.6-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:4a091729086dffa4bd070aa5dab7e39cc6b9d62eb2bef8f3d91172d30d599666"},
+ {file = "ruff-0.9.6-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:d1bbc6808bf7b15796cef0815e1dfb796fbd383e7dbd4334709642649625e7c5"},
+ {file = "ruff-0.9.6-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:589d1d9f25b5754ff230dce914a174a7c951a85a4e9270613a2b74231fdac2f5"},
+ {file = "ruff-0.9.6-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:dc61dd5131742e21103fbbdcad683a8813be0e3c204472d520d9a5021ca8b217"},
+ {file = "ruff-0.9.6-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:5e2d9126161d0357e5c8f30b0bd6168d2c3872372f14481136d13de9937f79b6"},
+ {file = "ruff-0.9.6-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:68660eab1a8e65babb5229a1f97b46e3120923757a68b5413d8561f8a85d4897"},
+ {file = "ruff-0.9.6-py3-none-musllinux_1_2_i686.whl", hash = "sha256:c4cae6c4cc7b9b4017c71114115db0445b00a16de3bcde0946273e8392856f08"},
+ {file = "ruff-0.9.6-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:19f505b643228b417c1111a2a536424ddde0db4ef9023b9e04a46ed8a1cb4656"},
+ {file = "ruff-0.9.6-py3-none-win32.whl", hash = "sha256:194d8402bceef1b31164909540a597e0d913c0e4952015a5b40e28c146121b5d"},
+ {file = "ruff-0.9.6-py3-none-win_amd64.whl", hash = "sha256:03482d5c09d90d4ee3f40d97578423698ad895c87314c4de39ed2af945633caa"},
+ {file = "ruff-0.9.6-py3-none-win_arm64.whl", hash = "sha256:0e2bb706a2be7ddfea4a4af918562fdc1bcb16df255e5fa595bbd800ce322a5a"},
+ {file = "ruff-0.9.6.tar.gz", hash = "sha256:81761592f72b620ec8fa1068a6fd00e98a5ebee342a3642efd84454f3031dca9"},
]
[[package]]
@@ -2347,4 +2347,4 @@ propcache = ">=0.2.0"
[metadata]
lock-version = "2.1"
python-versions = ">=3.11,<4"
-content-hash = "d761837b3dcd11b0218e1f4553e623e9127057a4a2a419aaa341a4415401d153"
+content-hash = "c145983db6d65fa095ca5fdddf4600177c0d2e2a46fc3905d8f6e20a5d994cff"
diff --git a/pyproject.toml b/pyproject.toml
index 1b88a4bb4..cacb4dfa7 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -2,30 +2,30 @@
name = "cyberdrop-dl-patched"
authors = [{name = "Jacob B", email = "[email protected]"}]
dependencies = [
- "aiofiles>=24.1.0,<25",
- "aiohttp-client-cache>=0.12.4,<0.13",
- "aiohttp>=3.11.10,<4",
- "aiolimiter>=1.2.1,<2",
+ "aiofiles (>=24.1.0,<25.0.0)",
+ "aiohttp (>=3.11.12,<4.0.0)",
+ "aiohttp-client-cache (>=0.12.4,<0.13.0)",
+ "aiolimiter (>=1.2.1,<2.0.0)",
"aiosqlite==0.17.0",
- "apprise>=1.9.0,<2",
- "arrow>=1.3.0,<2",
- "asyncpraw>=7.8.0,<8",
- "beautifulsoup4>=4.12.2,<5",
+ "apprise (>=1.9.2,<2.0.0)",
+ "arrow (>=1.3.0,<2.0.0)",
+ "asyncpraw (>=7.8.1,<8.0.0)",
+ "beautifulsoup4 (>=4.13.3,<5.0.0)",
"browser-cookie3 (>=0.20.1,<0.21.0)",
- "certifi>=2024.12.14",
- "filedate~=3.0",
- "get-video-properties>=0.1.1,<0.2",
- "inquirerpy>=0.3.4,<0.4",
- "mediafire>=0.6.1,<0.7",
- "myjdapi>=1.1.7,<2",
- "pillow>=11.0.0,<12",
- "platformdirs>=4.3.6,<5",
- "pydantic>=2.10.4,<3",
+ "certifi (>=2025.1.31,<2026.0.0)",
+ "filedate (>=3.0,<4.0)",
+ "get-video-properties (>=0.1.1,<0.2.0)",
+ "inquirerpy (>=0.3.4,<0.4.0)",
+ "mediafire (>=0.6.1,<0.7.0)",
+ "myjdapi (>=1.1.9,<2.0.0)",
+ "pillow (>=11.1.0,<12.0.0)",
+ "platformdirs (>=4.3.6,<5.0.0)",
+ "pydantic (>=2.10.6,<3.0.0)",
"pywin32>=308 ; sys_platform == 'win32'",
- "pyyaml>=6.0.2,<7",
- "rich>=13.9.4,<14",
- "send2trash>=1.8.3,<2",
- "xxhash>=3.5.0,<4"
+ "pyyaml (>=6.0.2,<7.0.0)",
+ "rich (>=13.9.4,<14.0.0)",
+ "send2trash (>=1.8.3,<2.0.0)",
+ "xxhash (>=3.5.0,<4.0.0)"
]
description = "Bulk downloader for multiple file hosts"
license = {text = "GPL-3.0-only"}
@@ -49,7 +49,7 @@ requires-poetry = ">=2.0"
[tool.poetry.group.dev.dependencies]
pre-commit = ">=4.0.1,<5"
-ruff = ">=0.8.0,<0.9"
+ruff = "0.9.6"
snakeviz = "^2.2.2"
[tool.poetry.group.test.dependencies]
@@ -77,8 +77,10 @@ select = [
"E", # pycodestyle errors
"F", # pyflakes
"FA102", # future annotations
+ "FURB188", # slice-to-remove-prefix-or-suffix
"I", # isort
"N", # PEP8 naming conventions
+ "PLR1716", # boolean chained comparison
"PTH", # use pathlib instead of os
"Q", # flake8-quotes
"RUF", # RUF specific fixes
diff --git a/tests/test_apprise.py b/tests/test_apprise.py
index 5078cd149..535fe052f 100644
--- a/tests/test_apprise.py
+++ b/tests/test_apprise.py
@@ -87,9 +87,8 @@ async def send_notification(test_case: AppriseTestCase):
logs_as_str = "\n".join([line.msg for line in logs])
print(logs_as_str)
if test_case.include:
- assert all(
- match.casefold() in logs_as_str.casefold() for match in test_case.include
- ), "Logs do not match expected pattern"
+ matches = [match.casefold() in logs_as_str.casefold() for match in test_case.include]
+ assert all(matches), "Logs do not match expected pattern"
if test_case.exclude:
assert not any(match in logs_as_str for match in test_case.exclude), "Logs should not match exclude pattern"