Fix formatting, linting, and logic errors from codebase scan

- Apply black formatting to 17 files.
- Fix F821 undefined name errors in:
  - src/main.py: Add missing `queue` import.
  - src/seedpass/core/encryption.py: Fix `JSONDecodeError` reference.
  - src/utils/__init__.py: Fix exception variable scope in fallback code.
  - src/utils/key_derivation.py: Add `TYPE_CHECKING` imports.
  - src/seedpass/core/config_manager.py: Add `TYPE_CHECKING` imports.
- Initialize torch environment and TODO file.

Co-authored-by: PR0M3TH3AN <[email protected]>
This commit is contained in:
google-labs-jules[bot]andPR0M3TH3AN committed 2026-02-16 18:09:48 +00:00
1 parent c6560305a9
commit 8e33f9c5e1
24 files changed
+207 -22

No files matched your search

+1 -1
View File
@@ -11,6 +11,7 @@ import os
import logging
import signal
import time
import queue
import argparse
import tomli
from tomli import TOMLDecodeError
@@ -45,7 +46,6 @@ from utils.logging_utils import (
)
from local_bip85.bip85 import Bip85Error
colorama_init()
OPTIONAL_DEPENDENCIES = {
-1
View File
@@ -28,7 +28,6 @@ from seedpass.core.manager import PasswordManager
from seedpass.core.entry_types import EntryType
from seedpass.core.api import UtilityService
_RATE_LIMIT = int(os.getenv("SEEDPASS_RATE_LIMIT", "100"))
_RATE_WINDOW = int(os.getenv("SEEDPASS_RATE_WINDOW", "60"))
_RATE_LIMIT_STR = f"{_RATE_LIMIT}/{_RATE_WINDOW} seconds"
-1
View File
@@ -5,7 +5,6 @@ import uvicorn
from .. import api as api_module
app = typer.Typer(help="Run the API server")
-1
View File
@@ -4,7 +4,6 @@ import typer
from .common import _get_config_service
app = typer.Typer(help="Get or set configuration values")
-1
View File
@@ -12,7 +12,6 @@ from .common import _get_entry_service, EntryType
from seedpass.core.entry_types import ALL_ENTRY_TYPES
from utils.clipboard import ClipboardUnavailableError
app = typer.Typer(help="Manage individual entries")
-1
View File
@@ -4,7 +4,6 @@ import typer
from .common import _get_services, ProfileRemoveRequest, ProfileSwitchRequest
app = typer.Typer(help="Manage seed profiles")
-1
View File
@@ -4,7 +4,6 @@ import typer
from .common import _get_services, _get_nostr_service
app = typer.Typer(
help="Interact with Nostr relays. See docs/nostr_setup.md for configuration and troubleshooting."
)
-1
View File
@@ -6,7 +6,6 @@ import typer
from .common import _get_util_service
app = typer.Typer(help="Utility commands")
-1
View File
@@ -13,7 +13,6 @@ from .common import (
BackupParentSeedRequest,
)
app = typer.Typer(help="Manage the entire vault")
+4 -1
View File
@@ -4,7 +4,7 @@ from __future__ import annotations
import logging
from pathlib import Path
from typing import List, Optional
from typing import List, Optional, TYPE_CHECKING
from utils.seed_prompt import masked_input
@@ -15,6 +15,9 @@ from nostr.client import DEFAULT_RELAYS as DEFAULT_NOSTR_RELAYS
from constants import INACTIVITY_TIMEOUT, MAX_RETRIES, RETRY_DELAY
if TYPE_CHECKING:
from .password_generation import PasswordPolicy
logger = logging.getLogger(__name__)
+1 -1
View File
@@ -6,7 +6,7 @@ import unicodedata
try:
import orjson as json_lib # type: ignore
JSONDecodeError = orjson.JSONDecodeError
JSONDecodeError = json_lib.JSONDecodeError
USE_ORJSON = True
except Exception: # pragma: no cover - fallback for environments without orjson
import json as json_lib
-1
View File
@@ -49,7 +49,6 @@ from .vault import Vault
from .backup import BackupManager
from .errors import SeedPassError
# Instantiate the logger
logger = logging.getLogger(__name__)
-1
View File
@@ -4,7 +4,6 @@ from seedpass.cli import app, entry as cli_entry
from seedpass.core.entry_types import EntryType
from utils.clipboard import ClipboardUnavailableError
runner = CliRunner()
-1
View File
@@ -16,7 +16,6 @@ from utils.key_derivation import (
from utils.fingerprint import generate_fingerprint
from seedpass.core.encryption import EncryptionManager
cfg_values = st.one_of(
st.integers(min_value=0, max_value=100),
st.text(min_size=0, max_size=20),
-1
View File
@@ -19,7 +19,6 @@ from seedpass.core.portable_backup import PortableMode
from utils.key_derivation import derive_index_key, derive_key_from_password
from utils.fingerprint import generate_fingerprint
SEED = "abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about"
PASSWORD = "passw0rd"
-1
View File
@@ -10,7 +10,6 @@ from helpers import create_vault, dummy_nostr_client
import gzip
from nostr.backup_models import Manifest, ChunkMeta
VALID_SEED = "abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about"
-1
View File
@@ -7,7 +7,6 @@ sys.path.append(str(Path(__file__).resolve().parents[1]))
from seedpass.core.totp import TotpManager
# Test parsing a normal otpauth URI with custom period and digits
+3 -2
View File
@@ -40,14 +40,15 @@ from .atomic_write import atomic_write
try: # pragma: no cover - exercised when dependency missing
from .clipboard import ClipboardUnavailableError, copy_to_clipboard
except Exception as exc: # pragma: no cover - executed only if pyperclip missing
_error_msg = str(exc)
class ClipboardUnavailableError(RuntimeError):
"""Stub exception when clipboard support is unavailable."""
def copy_to_clipboard(*_args, **_kwargs):
"""Stub when clipboard support is unavailable."""
logger.warning("Clipboard support unavailable: %s", exc)
raise ClipboardUnavailableError(str(exc))
logger.warning("Clipboard support unavailable: %s", _error_msg)
raise ClipboardUnavailableError(_error_msg)
__all__ = [
-1
View File
@@ -2,7 +2,6 @@
from termcolor import colored
# ANSI escape for 256-color orange (color code 208)
_ORANGE = "\033[38;5;208m"
_RESET = "\033[0m"
+4 -1
View File
@@ -21,7 +21,7 @@ import hmac
import time
from dataclasses import dataclass, field
from enum import Enum
from typing import Optional, Union, Dict, Any
from typing import Optional, Union, Dict, Any, TYPE_CHECKING
from bip_utils import Bip39SeedGenerator
from local_bip85 import BIP85
@@ -46,6 +46,9 @@ DEFAULT_ENCRYPTION_MODE = EncryptionMode.SEED_ONLY
# Purpose constant for TOTP secret derivation using BIP85
TOTP_PURPOSE = 39
if TYPE_CHECKING:
from seedpass.core.config_manager import ConfigManager
@dataclass
class KdfConfig:
-1
View File
@@ -17,7 +17,6 @@ except ImportError: # pragma: no cover - POSIX only
from utils.terminal_utils import clear_screen
from utils.logging_utils import pause_console_logging, resume_console_logging
DEFAULT_MAX_ATTEMPTS = 5