refspy.models.library
Data object for a library of books.
Libraries have names, abbrevs (short names), and a list of the books that they contain.
Attributes:
- id: 7
- name: '1 Corinthians'
- abbrev: '1 Cor'
- books: [],
See refspy.libraries.en_US for a complete example.
1"""Data object for a library of books. 2 3Libraries have names, abbrevs (short names), and a list of the books that they 4contain. 5 6Attributes: 7 id: 7 8 name: '1 Corinthians' 9 abbrev: '1 Cor' 10 books: [], 11 12See `refspy.libraries.en_US` for a complete example. 13""" 14 15from pydantic import BaseModel 16 17from refspy.models.book import Book 18from refspy.types.number import Number 19 20OT_ID: Number = 200 21DC_ID: Number = 210 22DCO_ID: Number = 220 23NT_ID: Number = 400 24 25 26class Library(BaseModel): 27 id: Number 28 name: str 29 abbrev: str 30 books: list[Book]
OT_ID: Annotated[int, Ge(ge=1), Le(le=999)] =
200
DC_ID: Annotated[int, Ge(ge=1), Le(le=999)] =
210
DCO_ID: Annotated[int, Ge(ge=1), Le(le=999)] =
220
NT_ID: Annotated[int, Ge(ge=1), Le(le=999)] =
400
class
Library(pydantic.main.BaseModel):
!!! abstract "Usage Documentation" Models
A base class for creating Pydantic models.
Attributes:
- __class_vars__: The names of the class variables defined on the model.
- __private_attributes__: Metadata about the private attributes of the model.
- __signature__: The synthesized
__init__[Signature][inspect.Signature] of the model. - __pydantic_complete__: Whether model building is completed, or if there are still undefined fields.
- __pydantic_core_schema__: The core schema of the model.
- __pydantic_custom_init__: Whether the model has a custom
__init__function. - __pydantic_decorators__: Metadata containing the decorators defined on the model.
This replaces
Model.__validators__andModel.__root_validators__from Pydantic V1. - __pydantic_generic_metadata__: A dictionary containing metadata about generic Pydantic models.
The
originandargsitems map to the [__origin__][genericalias.__origin__] and [__args__][genericalias.__args__] attributes of [generic aliases][types-genericalias], and theparameteritem maps to the__parameter__attribute of generic classes. - __pydantic_parent_namespace__: Parent namespace of the model, used for automatic rebuilding of models.
- __pydantic_post_init__: The name of the post-init method for the model, if defined.
- __pydantic_root_model__: Whether the model is a [
RootModel][pydantic.root_model.RootModel]. - __pydantic_serializer__: The
pydantic-coreSchemaSerializerused to dump instances of the model. - __pydantic_validator__: The
pydantic-coreSchemaValidatorused to validate instances of the model. - __pydantic_fields__: A dictionary of field names and their corresponding [
FieldInfo][pydantic.fields.FieldInfo] objects. - __pydantic_computed_fields__: A dictionary of computed field names and their corresponding [
ComputedFieldInfo][pydantic.fields.ComputedFieldInfo] objects. - __pydantic_extra__: A dictionary containing extra values, if [
extra][pydantic.config.ConfigDict.extra] is set to'allow'. - __pydantic_fields_set__: The names of fields explicitly set during instantiation.
- __pydantic_private__: Values of private attributes set on the model instance.
books: list[refspy.models.book.Book]