Loading poolpay/model/Base.py +3 −2 Original line number Diff line number Diff line from __future__ import annotations from typing import cast from uuid import UUID, uuid4 from sqlalchemy.orm import Mapped, mapped_column Loading @@ -9,7 +10,7 @@ from poolpay.model.Retrievable import Retrievable from poolpay.model.Uuid import Uuid class Base(Retrievable): class Base(Retrievable[UUID]): """ A type with a UUID, stored in the database. Loading @@ -22,7 +23,7 @@ class Base(Retrievable): uuid: Mapped[UUID] = mapped_column(Uuid(), primary_key=True, default=uuid4) @classmethod def get_only[T](cls: type[T], uuid: str | UUID) -> T | None: def get_only[T: Base](cls: type[T], uuid: str | UUID) -> T | None: if isinstance(uuid, str): try: # Manually convert the uuid to a UUID object (even though sqlalchemy-uuid would do that Loading poolpay/model/Card.py +1 −1 Original line number Diff line number Diff line Loading @@ -7,7 +7,7 @@ from poolpay.model.Person import Person from poolpay.model.Retrievable import Retrievable class Card(Retrievable): class Card(Retrievable[int]): """ A card, most likely a pool card. It has an id (which is read from the card), and belongs to a person. """ Loading Loading
poolpay/model/Base.py +3 −2 Original line number Diff line number Diff line from __future__ import annotations from typing import cast from uuid import UUID, uuid4 from sqlalchemy.orm import Mapped, mapped_column Loading @@ -9,7 +10,7 @@ from poolpay.model.Retrievable import Retrievable from poolpay.model.Uuid import Uuid class Base(Retrievable): class Base(Retrievable[UUID]): """ A type with a UUID, stored in the database. Loading @@ -22,7 +23,7 @@ class Base(Retrievable): uuid: Mapped[UUID] = mapped_column(Uuid(), primary_key=True, default=uuid4) @classmethod def get_only[T](cls: type[T], uuid: str | UUID) -> T | None: def get_only[T: Base](cls: type[T], uuid: str | UUID) -> T | None: if isinstance(uuid, str): try: # Manually convert the uuid to a UUID object (even though sqlalchemy-uuid would do that Loading
poolpay/model/Card.py +1 −1 Original line number Diff line number Diff line Loading @@ -7,7 +7,7 @@ from poolpay.model.Person import Person from poolpay.model.Retrievable import Retrievable class Card(Retrievable): class Card(Retrievable[int]): """ A card, most likely a pool card. It has an id (which is read from the card), and belongs to a person. """ Loading