5fcb574aca
Test / test (push) Successful in 15s
- Reformatted function signatures in `organization_service.py` and `task_service.py` for better alignment. - Updated import statements across multiple files for consistency and organization. - Enhanced test files by improving formatting and ensuring consistent use of async session factories. - Added type hints and improved type safety in various service and test files. - Adjusted `pyproject.toml` to include configuration for isort, mypy, and ruff for better code quality checks. - Cleaned up unused imports and organized existing ones in several test files.
25 lines
621 B
Python
25 lines
621 B
Python
"""Declarative base for SQLAlchemy models."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from enum import StrEnum
|
|
from typing import TypeVar
|
|
|
|
from sqlalchemy.orm import DeclarativeBase, declared_attr
|
|
|
|
EnumT = TypeVar("EnumT", bound=StrEnum)
|
|
|
|
|
|
class Base(DeclarativeBase):
|
|
"""Base class that configures naming conventions."""
|
|
|
|
@declared_attr.directive
|
|
def __tablename__(cls) -> str: # type: ignore[misc]
|
|
return cls.__name__.lower()
|
|
|
|
|
|
def enum_values(enum_cls: type[EnumT]) -> list[str]:
|
|
"""Return enum member values to keep DB representation stable."""
|
|
|
|
return [member.value for member in enum_cls]
|