Module signals_notebook.materials.base_entity

Expand source code
from datetime import datetime
from typing import Optional

from pydantic import Field

from signals_notebook.base import PatchedModel
from signals_notebook.common_types import MID


class BaseMaterialEntity(PatchedModel):
    asset_type_id: str = Field(alias='assetTypeId', allow_mutation=False)
    eid: MID = Field(allow_mutation=False)
    library_name: str = Field(allow_mutation=False, alias='library')
    digest: Optional[str] = Field(allow_mutation=False, default=None)
    name: str = Field(title='Name', allow_mutation=False)
    created_at: datetime = Field(alias='createdAt', allow_mutation=False)
    edited_at: datetime = Field(alias='editedAt', allow_mutation=False)

    class Config:
        validate_assignment = True
        allow_population_by_field_name = True

    def __str__(self) -> str:
        return f'<{self.__class__.__name__} eid={self.eid}>'

    @classmethod
    def _get_endpoint(cls) -> str:
        return 'materials'

Classes

class BaseMaterialEntity (**data: Any)

https://github.com/samuelcolvin/pydantic/issues/1577 Adds ability to use properties with setters

Create a new model by parsing and validating input data from keyword arguments.

Raises ValidationError if the input data cannot be parsed to form a valid model.

Expand source code
class BaseMaterialEntity(PatchedModel):
    asset_type_id: str = Field(alias='assetTypeId', allow_mutation=False)
    eid: MID = Field(allow_mutation=False)
    library_name: str = Field(allow_mutation=False, alias='library')
    digest: Optional[str] = Field(allow_mutation=False, default=None)
    name: str = Field(title='Name', allow_mutation=False)
    created_at: datetime = Field(alias='createdAt', allow_mutation=False)
    edited_at: datetime = Field(alias='editedAt', allow_mutation=False)

    class Config:
        validate_assignment = True
        allow_population_by_field_name = True

    def __str__(self) -> str:
        return f'<{self.__class__.__name__} eid={self.eid}>'

    @classmethod
    def _get_endpoint(cls) -> str:
        return 'materials'

Ancestors

  • PatchedModel
  • pydantic.main.BaseModel
  • pydantic.utils.Representation

Subclasses

Class variables

var Config
var asset_type_id : str
var created_at : datetime.datetime
var digest : Optional[str]
var edited_at : datetime.datetime
var eidMID
var library_name : str
var name : str