From fd0ef8407b7177fea491e9c37c3a44e2473a6980 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Tue, 13 Oct 2026 15:19:17 +0000 Subject: [PATCH] Drop unused imports and dead locals in spaces and server. Remove F401 imports and two unread assignments so ruff F401 and F841 are clean on these files, with no behavior change. Co-authored-by: herklos.dev --- packages/python/server/starfish_server/router/middleware.py | 2 +- packages/python/server/tests/storage/test_store_context.py | 2 +- packages/python/spaces/starfish_spaces/members.py | 6 ++---- packages/python/spaces/starfish_spaces/node_keyring.py | 1 - packages/python/spaces/starfish_spaces/objects.py | 1 - packages/python/spaces/starfish_spaces/plugin.py | 2 +- packages/python/spaces/starfish_spaces/request_verify.py | 1 - packages/python/spaces/starfish_spaces/session.py | 2 +- packages/python/spaces/starfish_spaces/space_access.py | 5 +---- .../python/spaces/starfish_spaces/space_access_store.py | 1 - 10 files changed, 7 insertions(+), 16 deletions(-) diff --git a/packages/python/server/starfish_server/router/middleware.py b/packages/python/server/starfish_server/router/middleware.py index bd95aa71..44a666e7 100644 --- a/packages/python/server/starfish_server/router/middleware.py +++ b/packages/python/server/starfish_server/router/middleware.py @@ -3,7 +3,7 @@ import asyncio from dataclasses import dataclass, field -from typing import Any, Callable, Awaitable, Sequence +from typing import Any, Sequence from fastapi import FastAPI, Request, Response from fastapi.responses import JSONResponse diff --git a/packages/python/server/tests/storage/test_store_context.py b/packages/python/server/tests/storage/test_store_context.py index a18d7ac0..c1e2da42 100644 --- a/packages/python/server/tests/storage/test_store_context.py +++ b/packages/python/server/tests/storage/test_store_context.py @@ -88,7 +88,7 @@ def test_accepts_ctx_list_4arg_lambda(): async def test_old_1arg_on_get_still_works(): store = CustomObjectStore(on_get=lambda key: f"val:{key}") - result = ctx_obj = None + result = None result = await store.get_string("k") assert result == "val:k" diff --git a/packages/python/spaces/starfish_spaces/members.py b/packages/python/spaces/starfish_spaces/members.py index 7e6dee88..0a5eaf54 100644 --- a/packages/python/spaces/starfish_spaces/members.py +++ b/packages/python/spaces/starfish_spaces/members.py @@ -17,12 +17,12 @@ from __future__ import annotations import json -from typing import TYPE_CHECKING, Any, Callable, Optional, TypedDict +from typing import TYPE_CHECKING, Any, Optional, TypedDict from starfish_protocol.encoding import decode_link_fragment, encode_link_fragment from starfish_sharing.cap_mint import MintOpts -from starfish_spaces.account_seal import seal_to_self, unseal_from_self +from starfish_spaces.account_seal import seal_to_self from starfish_spaces.client import ( add_space_keyring_recipient, ensure_space_keyring_recipient, @@ -57,7 +57,6 @@ from starfish_spaces.token_types import JoinRequest, SpaceInviteLinkToken if TYPE_CHECKING: - from starfish_spaces.config import SealedBlob from starfish_spaces.session import Session @@ -339,7 +338,6 @@ async def recover_space_access( link_access: dict[str, Any] = {} for space_id, sealed_blob in pub_access.items(): try: - from starfish_spaces.config import SealedBlob as SealedBlobType sealed = sealed_blob if isinstance(sealed_blob, dict) else dict(sealed_blob) from starfish_spaces.account_seal import unseal_from_self as _unseal raw = _unseal(session, sealed) diff --git a/packages/python/spaces/starfish_spaces/node_keyring.py b/packages/python/spaces/starfish_spaces/node_keyring.py index 8a392109..cbec692e 100644 --- a/packages/python/spaces/starfish_spaces/node_keyring.py +++ b/packages/python/spaces/starfish_spaces/node_keyring.py @@ -13,7 +13,6 @@ from starfish_identities import compute_owner_trusted_adders from starfish_spaces.client import ( - DeviceKeys, add_keyring_recipient_core, build_encryptor, open_encryptor, diff --git a/packages/python/spaces/starfish_spaces/objects.py b/packages/python/spaces/starfish_spaces/objects.py index 35a25015..edcc2105 100644 --- a/packages/python/spaces/starfish_spaces/objects.py +++ b/packages/python/spaces/starfish_spaces/objects.py @@ -6,7 +6,6 @@ from __future__ import annotations -import math import time from dataclasses import dataclass, field from typing import Any, Optional diff --git a/packages/python/spaces/starfish_spaces/plugin.py b/packages/python/spaces/starfish_spaces/plugin.py index d266f1b7..671d066d 100644 --- a/packages/python/spaces/starfish_spaces/plugin.py +++ b/packages/python/spaces/starfish_spaces/plugin.py @@ -18,7 +18,7 @@ from __future__ import annotations import json -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, TYPE_CHECKING from starfish_sharing import make_registry_role_enricher diff --git a/packages/python/spaces/starfish_spaces/request_verify.py b/packages/python/spaces/starfish_spaces/request_verify.py index 37633ed0..739f321e 100644 --- a/packages/python/spaces/starfish_spaces/request_verify.py +++ b/packages/python/spaces/starfish_spaces/request_verify.py @@ -10,7 +10,6 @@ from __future__ import annotations from cryptography.exceptions import InvalidSignature -from cryptography.hazmat.primitives import serialization from cryptography.hazmat.primitives.asymmetric.ed25519 import ( Ed25519PrivateKey, Ed25519PublicKey, diff --git a/packages/python/spaces/starfish_spaces/session.py b/packages/python/spaces/starfish_spaces/session.py index c11f2883..af0423c0 100644 --- a/packages/python/spaces/starfish_spaces/session.py +++ b/packages/python/spaces/starfish_spaces/session.py @@ -14,7 +14,7 @@ from __future__ import annotations -from dataclasses import dataclass, field +from dataclasses import dataclass from typing import Any, Callable, Coroutine, Optional, TYPE_CHECKING from starfish_identities import bootstrap_root_identity, mint_device_cap, compute_owner_trusted_adders diff --git a/packages/python/spaces/starfish_spaces/space_access.py b/packages/python/spaces/starfish_spaces/space_access.py index 3f8efbe3..d8de38d3 100644 --- a/packages/python/spaces/starfish_spaces/space_access.py +++ b/packages/python/spaces/starfish_spaces/space_access.py @@ -28,21 +28,18 @@ from __future__ import annotations -import json -from dataclasses import dataclass, field +from dataclasses import dataclass from typing import TYPE_CHECKING, Any, Optional from starfish_spaces.client import ( build_encryptor, make_space_client, - open_encryptor, ) from starfish_spaces.space_access_error import SpaceAccessError from starfish_spaces.space_access_store import ( get_node_access_entry, get_node_keyring_access_entry, get_node_stream_access_entry, - get_space_access_entry, link_access_from_store, member_caps_from_store, ) diff --git a/packages/python/spaces/starfish_spaces/space_access_store.py b/packages/python/spaces/starfish_spaces/space_access_store.py index a0f2407c..54331aa0 100644 --- a/packages/python/spaces/starfish_spaces/space_access_store.py +++ b/packages/python/spaces/starfish_spaces/space_access_store.py @@ -154,7 +154,6 @@ async def hydrate_space_access_store( # Step 2 — server wins if server_entries: for uid, entry in server_entries.items(): - cache_key = f"{_active_key}:{space_id}:{uid}" if uid != _active_key else _key_for(space_id) # Server entries are space-level member entries for each userId. # Store under the main space key for the active user. if uid == _active_key: