Source code for sqlatypemodel.mixin.types
"""Custom SQLAlchemy Mutable types with hashing support."""
from __future__ import annotations
from typing import Any, TypeVar
from sqlalchemy.ext.mutable import MutableDict, MutableList, MutableSet
from sqlatypemodel.mixin.protocols import MutableMethods
_T = TypeVar("_T", bound=Any)
_KT = TypeVar("_KT")
_VT = TypeVar("_VT")
[docs]
class KeyableMutableList(MutableMethods, MutableList[_T]): # type: ignore[misc]
"""MutableList that uses identity hashing and custom change tracking."""
pass
[docs]
class KeyableMutableDict(MutableMethods, MutableDict[_KT, _VT]): # type: ignore[misc]
"""MutableDict that uses identity hashing and custom change tracking."""
pass
[docs]
class KeyableMutableSet(MutableMethods, MutableSet[_T]): # type: ignore[misc]
"""MutableSet that uses identity hashing and custom change tracking."""
pass