Source code for openff.bespokefit.executor.services.models

from typing import Generic, List, Optional, TypeVar

import numpy as np

from openff.bespokefit._pydantic import BaseModel, Field, GenericModel

_T = TypeVar("_T")


[docs]class Error(BaseModel): type: str = Field(..., description="The type of exception that was raised.") message: str = Field(..., description="The message associated with the exception.") traceback: Optional[str] = Field( None, description="The traceback associated with the exception" )
[docs]class PaginatedCollection(GenericModel, Generic[_T]): self: str = Field(..., description="The API endpoint associated with this object.") prev: Optional[str] = Field( None, description="The API endpoint to use to retrieve the previous items in the " "collection when paginating.", ) next: Optional[str] = Field( None, description="The API endpoint to use to retrieve the next items in the " "collection when paginating.", ) contents: List[_T] = Field(..., description="The contents of the collection.") class Config: json_encoders = {np.ndarray: lambda v: v.flatten().tolist()}