From 86188385cbdae1ee90c1dca7a7b9db2edef1ecd4 Mon Sep 17 00:00:00 2001 From: Christophe Besson Date: Sat, 19 Sep 2026 14:24:13 +0200 Subject: style: ruff's own fixes, mechanically applied MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `ruff check .` had gone unrun long enough to report 568 errors, which is the same as having no linter: the next real finding would have been invisible in the noise. This is the 521 it fixes by itself, in 173 files, and nothing else — the 98 it cannot fix are the next commit. What actually changed: import sorting (225), imports nobody used (87, none of them a re-export — no `__init__.py` is touched, which was the one way this could have broken an import elsewhere), `datetime.timezone.utc` to `datetime.UTC` (69) and `asyncio.TimeoutError` to `TimeoutError` (18), both plain aliases on the 3.12 this project requires, `Optional[X]` to `X | None` (24), and f-strings with nothing to interpolate (19). Checked rather than assumed: every module in the three packages still imports, and the suite is 2893 passed — the same count, test for test, as the merge before it. Co-Authored-By: Claude Opus 5 --- packages/meshbay-node/src/meshbay_node/daemon.py | 39 +++++++++++++----------- 1 file changed, 21 insertions(+), 18 deletions(-) (limited to 'packages/meshbay-node/src/meshbay_node/daemon.py') diff --git a/packages/meshbay-node/src/meshbay_node/daemon.py b/packages/meshbay-node/src/meshbay_node/daemon.py index 3492d03..a0ce211 100644 --- a/packages/meshbay-node/src/meshbay_node/daemon.py +++ b/packages/meshbay-node/src/meshbay_node/daemon.py @@ -25,43 +25,43 @@ Usage: """ import asyncio -from dataclasses import asdict, replace import base64 -import json import logging import os import signal import sys import time +from dataclasses import asdict, replace from pathlib import Path import uvicorn - +from meshbay_common import MNP_VERSION from meshbay_common.background import spawn from meshbay_common.paths import fold -from meshbay_common import MNP_VERSION from meshbay_common.protocol import MNP -from meshbay_node.audit import RETENTION_DAYS as AUDIT_RETENTION_DAYS, AuditStore + +from meshbay_node import uploads as uploads_mod +from meshbay_node.audit import RETENTION_DAYS as AUDIT_RETENTION_DAYS +from meshbay_node.audit import AuditStore from meshbay_node.bundle_store import BundleStore from meshbay_node.chat.store import ChatStore -from meshbay_node.config import Config, DEFAULT_CONFIG_PATH, load_config, write_example_config -from meshbay_node.roots import RootSet, RootError, entry_abs_path, off_disk +from meshbay_node.config import DEFAULT_CONFIG_PATH, Config, load_config from meshbay_node.hub_client import HubClient, HubConfig -from meshbay_node.indexer import DirectoryIndexer, IndexCache, GroupIndex +from meshbay_node.indexer import DirectoryIndexer, GroupIndex, IndexCache from meshbay_node.indexer.enrich import Enricher from meshbay_node.indexer.enrich_audio import AudioEnricher from meshbay_node.indexer.enrich_photo import PhotoEnricher +from meshbay_node.keystore import create_keystore, load_keystore, load_or_create_keystore from meshbay_node.media_cache import MediaCache -from meshbay_node.tmdb import TmdbClient -from meshbay_node import uploads as uploads_mod from meshbay_node.musicbrainz import MusicBrainzClient -from meshbay_node.keystore import create_keystore, load_keystore, load_or_create_keystore from meshbay_node.platform import chmod_private, config_dir, data_dir, state_dir +from meshbay_node.roots import RootError, RootSet, entry_abs_path, off_disk from meshbay_node.roster import Roster +from meshbay_node.tmdb import TmdbClient from meshbay_node.transport import ( - Denylist, QUIC_AVAILABLE, WEBRTC_AVAILABLE, + Denylist, ) from meshbay_node.transport.wire import index_delta_message, index_sync_message @@ -109,8 +109,8 @@ def _owning_directory(path: str, directories: list[str]) -> str | None: def calibrate_argon2(target_ms: int = 500) -> None: """Benchmark Argon2id and suggest parameters targeting ~target_ms.""" - import time import os + import time print(f"Calibrating Argon2id (target: {target_ms}ms) ...") salt = os.urandom(16) @@ -1938,8 +1938,7 @@ def _systemctl_user(verb: str, unit: str, *, not_running_hint: str, def main() -> None: import argparse - from meshbay_node.platform import (configure_event_loop, force_utf8_stdio, - load_node_env) + from meshbay_node.platform import configure_event_loop, force_utf8_stdio, load_node_env force_utf8_stdio() configure_event_loop() # Before anything reads the environment. On Linux systemd has usually loaded @@ -2164,10 +2163,10 @@ def main() -> None: print("Aborted.") return - import subprocess as _sp import json as _json - import urllib.request + import subprocess as _sp import urllib.error + import urllib.request token_file = data_dir_ / "ui-token" if token_file.exists(): @@ -2475,7 +2474,11 @@ def main() -> None: if args.command == "restart-daemon": if sys.platform == "win32": from meshbay_node.platform import ( - autostart_end, autostart_run, service_end, service_run, service_status, + autostart_end, + autostart_run, + service_end, + service_run, + service_status, ) if service_status()["installed"]: service_end() -- cgit v1.2.3