strat-gameplay-webapp/backend/app/config/__init__.py
Cal Corum a4b99ee53e CLAUDE: Replace black and flake8 with ruff for formatting and linting
Migrated to ruff for faster, modern code formatting and linting:

Configuration changes:
- pyproject.toml: Added ruff 0.8.6, removed black/flake8
- Configured ruff with black-compatible formatting (88 chars)
- Enabled comprehensive linting rules (pycodestyle, pyflakes, isort,
  pyupgrade, bugbear, comprehensions, simplify, return)
- Updated CLAUDE.md: Changed code quality commands to use ruff

Code improvements (490 auto-fixes):
- Modernized type hints: List[T] → list[T], Dict[K,V] → dict[K,V],
  Optional[T] → T | None
- Sorted all imports (isort integration)
- Removed unused imports
- Fixed whitespace issues
- Reformatted 38 files for consistency

Bug fixes:
- app/core/play_resolver.py: Fixed type hint bug (any → Any)
- tests/unit/core/test_runner_advancement.py: Removed obsolete random mock

Testing:
- All 739 unit tests passing (100%)
- No regressions introduced

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-20 15:33:21 -06:00

59 lines
1.6 KiB
Python

"""
League configuration system for game rules and settings.
Provides:
- League configurations (BaseGameConfig, SbaConfig, PdConfig)
- Play outcome definitions (PlayOutcome enum)
- Application settings (Settings, get_settings) - imported from config.py for backward compatibility
Usage:
from app.config import get_league_config, PlayOutcome, get_settings
# Get config for specific league
config = get_league_config("sba")
api_url = config.get_api_base_url()
# Use play outcomes
if outcome == PlayOutcome.SINGLE_UNCAPPED:
# Handle uncapped hit decision tree
# Get application settings
settings = get_settings()
"""
# Import Settings and get_settings from sibling config.py for backward compatibility
# This imports from /app/config.py (not /app/config/__init__.py)
import sys
from pathlib import Path
from app.config.base_config import BaseGameConfig
from app.config.league_configs import (
LEAGUE_CONFIGS,
PdConfig,
SbaConfig,
get_league_config,
)
from app.config.result_charts import PlayOutcome
# Temporarily modify path to import the config.py file
config_py_path = Path(__file__).parent.parent / "config.py"
spec = __import__("importlib.util").util.spec_from_file_location(
"_app_config", config_py_path
)
_app_config = __import__("importlib.util").util.module_from_spec(spec)
spec.loader.exec_module(_app_config)
Settings = _app_config.Settings
get_settings = _app_config.get_settings
__all__ = [
"BaseGameConfig",
"SbaConfig",
"PdConfig",
"LEAGUE_CONFIGS",
"get_league_config",
"PlayOutcome",
"Settings",
"get_settings",
]