- Updated test functions in various test files to enhance code clarity by formatting long lines and improving indentation. - Adjusted assertions to use multi-line formatting for better readability. - Added new test cases for theme settings API to ensure proper functionality. - Ensured consistent use of line breaks and spacing across test files for uniformity.
30 lines
1.0 KiB
Python
30 lines
1.0 KiB
Python
from typing import Any, Dict, Optional
|
|
|
|
from sqlalchemy import ForeignKey, JSON
|
|
from sqlalchemy.orm import Mapped, mapped_column, relationship
|
|
from config.database import Base
|
|
|
|
|
|
class Parameter(Base):
|
|
__tablename__ = "parameter"
|
|
|
|
id: Mapped[int] = mapped_column(primary_key=True, index=True)
|
|
scenario_id: Mapped[int] = mapped_column(
|
|
ForeignKey("scenario.id"), nullable=False
|
|
)
|
|
name: Mapped[str] = mapped_column(nullable=False)
|
|
value: Mapped[float] = mapped_column(nullable=False)
|
|
distribution_id: Mapped[Optional[int]] = mapped_column(
|
|
ForeignKey("distribution.id"), nullable=True
|
|
)
|
|
distribution_type: Mapped[Optional[str]] = mapped_column(nullable=True)
|
|
distribution_parameters: Mapped[Optional[Dict[str, Any]]] = mapped_column(
|
|
JSON, nullable=True
|
|
)
|
|
|
|
scenario = relationship("Scenario", back_populates="parameters")
|
|
distribution = relationship("Distribution")
|
|
|
|
def __repr__(self):
|
|
return f"<Parameter id={self.id} name={self.name} value={self.value}>"
|