diff options
| author | Christophe Besson <cbesson@gmail.com> | 2026-09-19 14:24:13 +0200 |
|---|---|---|
| committer | Christophe Besson <cbesson@gmail.com> | 2026-09-19 14:24:13 +0200 |
| commit | 86188385cbdae1ee90c1dca7a7b9db2edef1ecd4 (patch) | |
| tree | cc01153f05e84ad6cd34556caecd3f4bc335d0bd /packages/meshbay-hub/src/meshbay_hub/app.py | |
| parent | d2495a2c4b89fbbfc18cefec83ae96cabdd745e2 (diff) | |
| download | meshbay-86188385cbdae1ee90c1dca7a7b9db2edef1ecd4.tar.gz | |
style: ruff's own fixes, mechanically applied
`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 <noreply@anthropic.com>
Diffstat (limited to 'packages/meshbay-hub/src/meshbay_hub/app.py')
| -rw-r--r-- | packages/meshbay-hub/src/meshbay_hub/app.py | 42 |
1 files changed, 23 insertions, 19 deletions
diff --git a/packages/meshbay-hub/src/meshbay_hub/app.py b/packages/meshbay-hub/src/meshbay_hub/app.py index afc1cde..209dc32 100644 --- a/packages/meshbay-hub/src/meshbay_hub/app.py +++ b/packages/meshbay-hub/src/meshbay_hub/app.py @@ -11,37 +11,41 @@ Usage: import asyncio from contextlib import asynccontextmanager -from pathlib import Path from fastapi import FastAPI from slowapi import _rate_limit_exceeded_handler from slowapi.errors import RateLimitExceeded from meshbay_hub import __version__ +from meshbay_hub.api.admin import router as admin_router +from meshbay_hub.api.deps import set_admin_usernames +from meshbay_hub.api.federation import router as federation_router +from meshbay_hub.api.groups import router as groups_router +from meshbay_hub.api.groups import swarm_router +from meshbay_hub.api.health import router as health_router +from meshbay_hub.api.hub import router as hub_router +from meshbay_hub.api.hub import set_config as hub_set_config +from meshbay_hub.api.middleware import limiter +from meshbay_hub.api.moderation import router as moderation_router +from meshbay_hub.api.nodes import router as nodes_router +from meshbay_hub.api.notifications import router as notifications_router +from meshbay_hub.api.relay import router as relay_router +from meshbay_hub.api.revocation import router as revocation_router +from meshbay_hub.api.signaling import router as signaling_router +from meshbay_hub.api.users import router as users_router +from meshbay_hub.api.users import set_config as users_set_config +from meshbay_hub.api.webapp import ASSET_V, CSP, STATIC_DIR +from meshbay_hub.api.webapp import router as webapp_router from meshbay_hub.auth import generate_hub_keypair, load_hub_keypair from meshbay_hub.config import HubConfig +from meshbay_hub.csam import csam_router from meshbay_hub.db.engine import close_db, init_db -from meshbay_hub.api.hub import router as hub_router, set_config as hub_set_config -from meshbay_hub.api.users import router as users_router, set_config as users_set_config -from meshbay_hub.api.deps import set_admin_usernames -from meshbay_hub.api.nodes import router as nodes_router -from meshbay_hub.api.groups import router as groups_router, swarm_router -from meshbay_hub.api.revocation import router as revocation_router -from meshbay_hub.api.moderation import router as moderation_router -from meshbay_hub.api.federation import router as federation_router -from meshbay_hub.csam import csam_router -from meshbay_hub.api.health import router as health_router -from meshbay_hub.api.relay import router as relay_router -from meshbay_hub.api.signaling import router as signaling_router -from meshbay_hub.api.admin import router as admin_router -from meshbay_hub.api.notifications import router as notifications_router -from meshbay_hub.api.webapp import router as webapp_router, STATIC_DIR, ASSET_V, CSP -from meshbay_hub.api.middleware import limiter async def _sync_admin_roles(admin_usernames: list[str]) -> None: """Ensure config-listed admin usernames have role='admin' in the DB.""" - from sqlalchemy import select, update + from sqlalchemy import select + from meshbay_hub.db.engine import get_session_factory from meshbay_hub.db.models import User @@ -122,8 +126,8 @@ def create_app(cfg: HubConfig | None = None) -> FastAPI: from meshbay_hub.csam import get_csam_checker get_csam_checker().load() - from meshbay_hub.tasks.cleanup import cleanup_loop from meshbay_hub.db.engine import get_session_factory + from meshbay_hub.tasks.cleanup import cleanup_loop cleanup_task = asyncio.create_task(cleanup_loop(get_session_factory())) yield |