Unsafe fixes.

This commit is contained in:
2026-05-25 02:12:31 +00:00
parent 95081ca50e
commit 54a4b57230
20 changed files with 55 additions and 81 deletions
+1 -1
View File
@@ -49,7 +49,7 @@ async def run_devserver(
await pg.spawn(*vite, cwd=front)
def main():
def main() -> None:
parser = argparse.ArgumentParser(
description="Run Vite and FastAPI development servers",
formatter_class=argparse.RawDescriptionHelpFormatter,
+1 -1
View File
@@ -10,6 +10,6 @@ from buildutil import build
class CustomBuildHook(BuildHookInterface):
def initialize(self, version, build_data):
def initialize(self, version, build_data) -> None:
super().initialize(version, build_data)
build("frontend")
+1 -1
View File
@@ -178,7 +178,7 @@ def build(folder: str = "frontend") -> None:
logger.warning(e)
raise SystemExit(1)
def run(cmd):
def run(cmd) -> None:
display_cmd = [Path(cmd[0]).stem, *cmd[1:]]
logger.info("### %s", " ".join(display_cmd))
subprocess.run(cmd, check=True, cwd=folder)
+2 -2
View File
@@ -16,7 +16,7 @@ from fastapi_vue.hostutil import parse_endpoint
class ProcessGroup:
"""Manage async subprocesses with automatic cleanup, like TaskGroup for processes."""
def __init__(self):
def __init__(self) -> None:
self._procs: list[asyncio.subprocess.Process] = []
self._cmds: dict[int, str] = {} # pid -> command name
@@ -59,7 +59,7 @@ class ProcessGroup:
"""Wait for one process to exit, terminate others, then wait for all."""
await self._cleanup(immediate=exc_type is not None)
async def _cleanup(self, immediate: bool = False):
async def _cleanup(self, immediate: bool = False) -> None:
running = [p for p in self._procs if p.returncode is None]
if not running:
return
+1 -2
View File
@@ -84,13 +84,12 @@ def find_dist_files(version: str) -> list[Path]:
Raises FileNotFoundError listing every missing file if any are absent.
"""
dist_dir = REPO_ROOT / "dist"
ver = re.escape(version)
wheel = next((p for p in dist_dir.glob(f"mediahive-{version}-*.whl")), None)
sdist = next(
(
p
for p in dist_dir.glob(f"mediahive-{version}.*")
if p.suffix in (".gz", ".zip") and p.name != f"mediahive-{version}.zip"
if p.suffix in {".gz", ".zip"} and p.name != f"mediahive-{version}.zip"
),
None,
)
+2 -3
View File
@@ -164,8 +164,7 @@ def scan_torrent_directories(paths: list[str]) -> Iterator[Path]:
for dir_path in glob.glob(pattern):
torrent_dir = Path(dir_path)
if torrent_dir.is_dir():
for torrent_file in torrent_dir.glob("*.torrent"):
yield torrent_file
yield from torrent_dir.glob("*.torrent")
def find_torrents_with_tracker(
@@ -203,7 +202,7 @@ def format_size(size_bytes: int | None) -> str:
return f"{size_bytes:.2f} PB"
def main():
def main() -> None:
"""Main entry point for the torrent scanner."""
parser = argparse.ArgumentParser(
description="Scan and manage torrent files",