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:
parent
6c70e6e006
commit
4fc13ed307
2 changed files with 46 additions and 0 deletions
5
royalnet/sculptor/__init__.py
Normal file
5
royalnet/sculptor/__init__.py
Normal file
|
@ -0,0 +1,5 @@
|
|||
"""
|
||||
This module contains many :mod:`pydantic` models that may be useful to multiple projects.
|
||||
"""
|
||||
|
||||
from a_base import *
|
41
royalnet/sculptor/a_base.py
Normal file
41
royalnet/sculptor/a_base.py
Normal 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",
|
||||
)
|
Loading…
Reference in a new issue