1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-26 21:14:19 +00:00

Create Sculptor module (mostly empty)

This commit is contained in:
Steffo 2021-03-02 02:35:00 +01:00
parent 6c70e6e006
commit 4fc13ed307
Signed by: steffo
GPG key ID: 6965406171929D01
2 changed files with 46 additions and 0 deletions

View file

@ -0,0 +1,5 @@
"""
This module contains many :mod:`pydantic` models that may be useful to multiple projects.
"""
from a_base import *

View file

@ -0,0 +1,41 @@
"""
Base models are :class:`pydantic.BaseModel` that have specific configuration tailored for certain uses.
"""
import pydantic
class RoyalnetModel(pydantic.BaseModel):
"""
A model for generic data.
"""
class Config(pydantic.BaseModel.Config):
"""
The default :mod:`pydantic` configuration.
.. seealso:: `Pydantic Configuration <https://pydantic-docs.helpmanual.io/usage/model_config/>`_,
:class:`pydantic.BaseModel.Config`
"""
pass
class OrmModel(RoyalnetModel):
"""
A model for :mod:`sqlalchemy` table data.
"""
class Config(RoyalnetModel.Config):
"""
A configuration which allows for the loading of data from ``__getattr__`` instead of ``__getitem__``.
.. seealso:: `Pydantic ORM Mode <https://pydantic-docs.helpmanual.io/usage/models/#orm-mode-aka-arbitrary
-class-instances>`_
"""
orm_mode = True
__all__ = (
"RoyalnetModel",
"OrmModel",
)