style: apply black and isort formatting across entire codebase

- Standardize quote style (single to double quotes)
- Reorder and group imports alphabetically
- Fix line breaks and indentation for consistency
- Apply PEP 8 formatting standards

Also updated Makefile to exclude both venv and .venv from code quality checks.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-11-28 19:30:17 +01:00
parent 13f0094743
commit 21c13ca39b
236 changed files with 8450 additions and 6545 deletions

View File

@@ -15,7 +15,7 @@ EnvironmentType = Literal["development", "staging", "production"]
def get_environment() -> EnvironmentType:
"""
Detect current environment automatically.
Detection logic:
1. Check ENV environment variable if set
2. Check ENVIRONMENT environment variable if set
@@ -23,7 +23,7 @@ def get_environment() -> EnvironmentType:
- localhost, 127.0.0.1 → development
- Contains 'staging' → staging
- Otherwise → production (safe default)
Returns:
str: 'development', 'staging', or 'production'
"""
@@ -35,7 +35,7 @@ def get_environment() -> EnvironmentType:
return "staging"
elif env in ["production", "prod"]:
return "production"
# Priority 2: ENVIRONMENT variable
env = os.getenv("ENVIRONMENT", "").lower()
if env in ["development", "dev", "local"]:
@@ -44,22 +44,25 @@ def get_environment() -> EnvironmentType:
return "staging"
elif env in ["production", "prod"]:
return "production"
# Priority 3: Auto-detect from common indicators
# Check if running in debug mode (common in development)
if os.getenv("DEBUG", "").lower() in ["true", "1", "yes"]:
return "development"
# Check common development indicators
hostname = os.getenv("HOSTNAME", "").lower()
if any(dev_indicator in hostname for dev_indicator in ["local", "dev", "laptop", "desktop"]):
if any(
dev_indicator in hostname
for dev_indicator in ["local", "dev", "laptop", "desktop"]
):
return "development"
# Check for staging indicators
if "staging" in hostname or "stage" in hostname:
return "staging"
# Default to development for safety (HTTPS not required in dev)
# Change this to "production" if you prefer secure-by-default
return "development"
@@ -83,7 +86,7 @@ def is_production() -> bool:
def should_use_secure_cookies() -> bool:
"""
Determine if cookies should have secure flag (HTTPS only).
Returns:
bool: True if production or staging, False if development
"""
@@ -97,7 +100,7 @@ _cached_environment: EnvironmentType | None = None
def get_cached_environment() -> EnvironmentType:
"""
Get environment with caching.
Environment is detected once and cached for performance.
Useful if you call this frequently.
"""