style: apply ruff auto-fixes

This commit is contained in:
2026-01-19 03:14:30 -08:00
parent 3ab122a55d
commit a961ac3ce7
72 changed files with 2477 additions and 2871 deletions

View File

@@ -15,7 +15,7 @@ import time
import traceback
import re
import os
from typing import Optional, Dict, Any, Callable, BinaryIO, List, Iterable, Set, Union
from typing import Optional, Dict, Any, Callable, List, Union
from pathlib import Path
from urllib.parse import unquote, urlparse, parse_qs
import logging

View File

@@ -12,7 +12,6 @@ import sys
import time
from typing import Any, Dict, Optional, Set, List, Sequence, Tuple
import time
from urllib.parse import urlparse
from SYS.logger import log, debug
@@ -1124,7 +1123,7 @@ def unlock_link_cmdlet(result: Any, args: Sequence[str], config: Dict[str, Any])
# Note: The cmdlet wrapper will handle emitting to pipeline
return 0
else:
log(f"❌ Failed to unlock link or already unrestricted", file=sys.stderr)
log("❌ Failed to unlock link or already unrestricted", file=sys.stderr)
return 1

View File

@@ -1,6 +1,5 @@
from __future__ import annotations
import json
from typing import Any, Dict, Optional
from .HTTP import HTTPClient

View File

@@ -92,7 +92,7 @@
"(hitfile\\.net/[a-z0-9A-Z]{4,9})"
],
"regexp": "(hitf\\.(to|cc)/([a-z0-9A-Z]{4,9}))|(htfl\\.(net|to|cc)/([a-z0-9A-Z]{4,9}))|(hitfile\\.(net)/download/free/([a-z0-9A-Z]{4,9}))|((hitfile\\.net/[a-z0-9A-Z]{4,9}))",
"status": false
"status": true
},
"mega": {
"name": "mega",
@@ -353,7 +353,7 @@
"filedot\\.(xyz|to|top)/([0-9a-zA-Z]{12})"
],
"regexp": "filedot\\.(xyz|to|top)/([0-9a-zA-Z]{12})",
"status": true
"status": false
},
"filefactory": {
"name": "filefactory",
@@ -622,7 +622,7 @@
"(simfileshare\\.net/download/[0-9]+/)"
],
"regexp": "(simfileshare\\.net/download/[0-9]+/)",
"status": true
"status": false
},
"streamtape": {
"name": "streamtape",

View File

@@ -13,8 +13,6 @@ from __future__ import annotations
import sqlite3
import json
import logging
import subprocess
import shutil
import time
import os
from contextlib import contextmanager
@@ -303,8 +301,21 @@ class API_folder_store:
if should_check_empty:
# Check if there are any files or directories in the library root (excluding the DB itself if it was just created)
# We use a generator and next() for efficiency.
existing_items = [item for item in self.library_root.iterdir() if item.name != self.DB_NAME]
# Allow an empty 'incoming' directory created by upload flow to exist
# (this prevents a false-positive safety check when an upload endpoint
# creates the incoming dir before DB initialization).
if existing_items:
if len(existing_items) == 1 and existing_items[0].name == "incoming" and existing_items[0].is_dir():
try:
# If the incoming directory is empty, treat it as harmless.
if not any(existing_items[0].iterdir()):
existing_items = []
except Exception:
# If we can't inspect it safely, leave the original items in place
pass
if existing_items:
# Log the items found for debugging
item_names = [i.name for i in existing_items[:5]]
@@ -1378,7 +1389,7 @@ class API_folder_store:
(file_hash,
existing_title[0]),
)
logger.debug(f"[save_tags] Preserved existing title tag")
logger.debug("[save_tags] Preserved existing title tag")
elif not existing_title and not new_title_provided:
filename_without_ext = abs_path.stem
if filename_without_ext:

View File

@@ -12,7 +12,6 @@ The LoC JSON API does not require an API key.
from __future__ import annotations
import json
from typing import Any, Dict, Optional
from .base import API, ApiError

View File

@@ -12,7 +12,6 @@ Authentication headers required for most endpoints:
from __future__ import annotations
import hashlib
import json
import time
from typing import Any, Dict, List, Optional

View File

@@ -32,7 +32,7 @@ from dataclasses import dataclass
from pathlib import Path
from typing import Any, Dict, List, Optional, Tuple
from SYS.logger import debug, log
from SYS.logger import debug
# Optional Python ZeroTier bindings - prefer them when available
_HAVE_PY_ZEROTIER = False