Module signals_notebook.entities.tables.cell

Expand source code
from enum import Enum
from typing import Annotated, Any, Generic, List, Literal, Optional, TypedDict, TypeVar, Union
from uuid import UUID

from pydantic import BaseModel, Field, PrivateAttr
from pydantic.generics import GenericModel

from signals_notebook.common_types import DateTime, EID, EntityType, MaterialType, MID, ObjectType
from signals_notebook.entities import Entity
from signals_notebook.entities.entity_store import EntityStore
from signals_notebook.exceptions import EIDError
from signals_notebook.materials import MaterialStore
from signals_notebook.materials.material import Material

CellContentType = TypeVar('CellContentType')


class ColumnDataType(str, Enum):
    NUMBER = 'number'
    INTEGER = 'integer'
    DATE_TIME = 'datetime'
    TEXT = 'text'
    LIST = 'list'
    MULTI_SELECT = 'multiSelect'
    ATTRIBUTE_LIST = 'attributeList'
    AUTOTEXT_LIST = 'autotextList'
    BOOLEAN = 'boolean'
    UNIT = 'unit'
    LINK = 'link'
    EXTERNAL_LINK = 'externalLink'


class ColumnDefinition(BaseModel):
    key: UUID
    title: str
    type: ColumnDataType
    is_external_key: Optional[bool] = Field(alias='isExternalKey', default=None)
    is_user_defined: Optional[bool] = Field(alias='isUserDefined', default=None)
    saved: Optional[bool] = Field(default=None)
    read_only: bool = Field(default=True, alias='readOnly')

    class Config:
        frozen = True


class AttributeListColumnDefinition(ColumnDefinition):
    type: Literal[ColumnDataType.ATTRIBUTE_LIST]
    options: List[str]
    attribute_list_eid: EID = Field(alias='attributeListEid')
    multi_select: bool = Field(alias='multiSelect')


class AutotextListColumnDefinition(ColumnDefinition):
    type: Literal[ColumnDataType.AUTOTEXT_LIST]
    options: List[str]
    autotext_list_eid: EID = Field(alias='autotextListEid')


class ListColumnDefinition(ColumnDefinition):
    type: Literal[ColumnDataType.LIST]
    options: List[str]


class MultiSelectColumnDefinition(ColumnDefinition):
    type: Literal[ColumnDataType.MULTI_SELECT]
    options: List[str]


class UnitColumnDefinition(ColumnDefinition):
    type: Literal[ColumnDataType.UNIT]
    measure: str
    default_unit: str = Field(alias='defaultUnit')


GenericColumnDefinition = Union[
    AttributeListColumnDefinition,
    AutotextListColumnDefinition,
    ListColumnDefinition,
    MultiSelectColumnDefinition,
    UnitColumnDefinition,
    ColumnDefinition,  # must be the last
]


class ColumnDefinitions(BaseModel):
    id: EID
    type: Literal[ObjectType.COLUMN_DEFINITIONS]
    columns: List[GenericColumnDefinition]

    class Config:
        frozen = True


class CellContent(GenericModel, Generic[CellContentType]):
    value: CellContentType
    values: Optional[List[CellContentType]] = None
    type: Optional[Union[EntityType, ObjectType, MaterialType]] = None
    display: Optional[str] = None

    class Config:
        validate_assignment = True


class CellContentDict(TypedDict):
    value: Any
    values: Optional[List[Any]]
    type: Optional[EntityType]
    display: Optional[str]


class UpdateCellRequest(GenericModel, Generic[CellContentType]):
    key: UUID
    content: CellContent[CellContentType]


class Cell(GenericModel, Generic[CellContentType]):
    id: UUID = Field(allow_mutation=False, alias='key')
    type: ColumnDataType = Field(allow_mutation=False)
    name: str = Field(allow_mutation=False)
    content: CellContent[CellContentType]
    _changed: bool = PrivateAttr(default=False)

    class Config:
        validate_assignment = True

    @property
    def value(self) -> Union[CellContentType, List[CellContentType]]:
        """Get content value

        Returns:
            Union[CellContentType, List[CellContentType]]
        """
        return self.content.values or self.content.value

    def _set_value(self, new_value: CellContentType, display: Optional[str] = None) -> None:
        self.content.value = new_value
        self.content.display = display

        self._changed = True

    @property
    def is_changed(self) -> bool:
        """Get is_changed value

        Returns:
            bool: True/False
        """
        return self._changed

    @property
    def display(self) -> str:
        """Get display field of content

        Returns:
            str
        """
        return self.content.display or ''

    @property
    def update_request(self) -> UpdateCellRequest[CellContentType]:
        """Get UpdateCellRequest

        Returns:
            UpdateCellRequest
        """
        return UpdateCellRequest[CellContentType](key=self.id, content=self.content)


class TextCell(Cell[str]):
    type: Literal[ColumnDataType.TEXT] = Field(allow_mutation=False)

    def set_value(self, new_value: str, display: Optional[str] = None) -> None:
        """Set new value to TextCell

        Args:
            new_value: new value of content value field
            display: new value of content display field

        Returns:

        """
        super()._set_value(new_value, display)


class NumberCell(Cell[float]):
    type: Literal[ColumnDataType.NUMBER] = Field(allow_mutation=False)

    def set_value(self, new_value: float, display: Optional[str] = None) -> None:
        """Set new value to NumberCell

        Args:
            new_value: new value of content value field
            display: new value of content display field

        Returns:

        """
        super()._set_value(new_value, display)


class IntegerCell(Cell[int]):
    type: Literal[ColumnDataType.INTEGER] = Field(allow_mutation=False)

    def set_value(self, new_value: int, display: Optional[str] = None) -> None:
        """Set new value to IntegerCell

        Args:
            new_value: new value of content value field
            display: new value of content display field

        Returns:

        """
        super()._set_value(new_value, display)


class BooleanCell(Cell[bool]):
    type: Literal[ColumnDataType.BOOLEAN] = Field(allow_mutation=False)

    def set_value(self, new_value: bool, display: Optional[str] = None) -> None:
        """Set new value to BooleanCell

        Args:
            new_value: new value of content value field
            display: new value of content display field

        Returns:

        """
        super()._set_value(new_value, display)


class DateTimeCell(Cell[DateTime]):
    type: Literal[ColumnDataType.DATE_TIME] = Field(allow_mutation=False)

    def set_value(self, new_value: DateTime, display: Optional[str] = None) -> None:
        """Set new value to DateTimeCell

        Args:
            new_value: new value of content value field
            display: new value of content display field

        Returns:

        """
        super()._set_value(new_value, display)


class ExternalLink(Cell[str]):
    type: Literal[ColumnDataType.EXTERNAL_LINK] = Field(allow_mutation=False)

    def set_value(self, new_value: str, display: Optional[str] = None) -> None:
        """Set new value to ExternalLink

        Args:
            new_value: new value of content value field
            display: new value of content display field

        Returns:

        """
        super()._set_value(new_value, display)


class LinkCell(Cell[Union[EID, MID]]):
    type: Literal[ColumnDataType.LINK] = Field(allow_mutation=False)

    @property
    def object(self) -> Union[Entity, Material]:
        """Get Material or Entity

        Returns:

        """
        object_id = self.content.value
        try:
            return MaterialStore.get(MID(object_id))
        except EIDError:
            pass

        return EntityStore.get(EID(object_id))

    def set_value(self, new_value: Union[EID, MID], display: str) -> None:
        """Set new value to LinkCell

        Args:
            new_value: new value of content value field
            display: new value of content display field

        Returns:

        """
        super()._set_value(new_value, display)


class UnitCell(Cell[float]):
    type: Literal[ColumnDataType.UNIT] = Field(allow_mutation=False)

    def set_value(self, new_value: float, display: Optional[str] = None) -> None:
        """Set new value to UnitCell

        Args:
            new_value: new value of content value field
            display: new value of content display field

        Returns:

        """
        super()._set_value(new_value, display)


class MultiSelectCell(Cell[str]):
    type: Literal[ColumnDataType.MULTI_SELECT] = Field(allow_mutation=False)

    def set_value(self, new_value: Union[str, List[str]], display: Optional[str] = None) -> None:
        """Set new value to MultiSelectCell

        Args:
            new_value: new value or list of values of content value field
            display: new value of content display field

        Returns:

        """
        if isinstance(new_value, List):
            value = ', '.join(new_value)
            self.content.values = new_value
        else:
            value = new_value
            self.content.values = [new_value]

        super()._set_value(value, display)


class AttributeListCell(Cell[str]):
    type: Literal[ColumnDataType.ATTRIBUTE_LIST] = Field(allow_mutation=False)

    def set_value(self, new_value: Union[str, List[str]], display: Optional[str] = None) -> None:
        """Set new value to AttributeListCell

        Args:
            new_value: new value or list of values of content value field
            display: new value of content display field

        Returns:

        """

        if isinstance(new_value, List):
            value = ', '.join(new_value)
            self.content.values = new_value
        else:
            value = new_value
            self.content.values = [new_value]

        super()._set_value(value, display)


class ListCell(Cell[str]):
    type: Literal[ColumnDataType.LIST] = Field(allow_mutation=False)

    def set_value(self, new_value: str, display: Optional[str] = None) -> None:
        """Set new value to ListCell

        Args:
            new_value: new value of content value field
            display: new value of content display field

        Returns:

        """
        super()._set_value(new_value, display)


class AutotextListCell(Cell[str]):
    type: Literal[ColumnDataType.AUTOTEXT_LIST] = Field(allow_mutation=False)

    def set_value(self, new_value: str, display: Optional[str] = None) -> None:
        """Set new value to ListCell

        Args:
            new_value: new value of content value field
            display: new value of content display field

        Returns:

        """
        super()._set_value(new_value, display)


GenericCell = Annotated[
    Union[
        AttributeListCell,
        AutotextListCell,
        BooleanCell,
        DateTimeCell,
        ExternalLink,
        IntegerCell,
        LinkCell,
        ListCell,
        MultiSelectCell,
        NumberCell,
        TextCell,
        UnitCell,
    ],
    Field(discriminator='type'),
]

Classes

class AttributeListCell (**data: Any)

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 AttributeListCell(Cell[str]):
    type: Literal[ColumnDataType.ATTRIBUTE_LIST] = Field(allow_mutation=False)

    def set_value(self, new_value: Union[str, List[str]], display: Optional[str] = None) -> None:
        """Set new value to AttributeListCell

        Args:
            new_value: new value or list of values of content value field
            display: new value of content display field

        Returns:

        """

        if isinstance(new_value, List):
            value = ', '.join(new_value)
            self.content.values = new_value
        else:
            value = new_value
            self.content.values = [new_value]

        super()._set_value(value, display)

Ancestors

  • Cell[str]
  • Cell
  • pydantic.generics.GenericModel
  • pydantic.main.BaseModel
  • pydantic.utils.Representation
  • typing.Generic

Class variables

var type : Literal[<ColumnDataType.ATTRIBUTE_LIST: 'attributeList'>]

Methods

def set_value(self, new_value: Union[str, List[str]], display: Optional[str] = None) ‑> None

Set new value to AttributeListCell

Args

new_value
new value or list of values of content value field
display
new value of content display field

Returns:

Expand source code
def set_value(self, new_value: Union[str, List[str]], display: Optional[str] = None) -> None:
    """Set new value to AttributeListCell

    Args:
        new_value: new value or list of values of content value field
        display: new value of content display field

    Returns:

    """

    if isinstance(new_value, List):
        value = ', '.join(new_value)
        self.content.values = new_value
    else:
        value = new_value
        self.content.values = [new_value]

    super()._set_value(value, display)

Inherited members

class AttributeListColumnDefinition (**data: Any)

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 AttributeListColumnDefinition(ColumnDefinition):
    type: Literal[ColumnDataType.ATTRIBUTE_LIST]
    options: List[str]
    attribute_list_eid: EID = Field(alias='attributeListEid')
    multi_select: bool = Field(alias='multiSelect')

Ancestors

Class variables

var attribute_list_eidEID
var multi_select : bool
var options : List[str]
var type : Literal[<ColumnDataType.ATTRIBUTE_LIST: 'attributeList'>]
class AutotextListCell (**data: Any)

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 AutotextListCell(Cell[str]):
    type: Literal[ColumnDataType.AUTOTEXT_LIST] = Field(allow_mutation=False)

    def set_value(self, new_value: str, display: Optional[str] = None) -> None:
        """Set new value to ListCell

        Args:
            new_value: new value of content value field
            display: new value of content display field

        Returns:

        """
        super()._set_value(new_value, display)

Ancestors

  • Cell[str]
  • Cell
  • pydantic.generics.GenericModel
  • pydantic.main.BaseModel
  • pydantic.utils.Representation
  • typing.Generic

Class variables

var type : Literal[<ColumnDataType.AUTOTEXT_LIST: 'autotextList'>]

Methods

def set_value(self, new_value: str, display: Optional[str] = None) ‑> None

Set new value to ListCell

Args

new_value
new value of content value field
display
new value of content display field

Returns:

Expand source code
def set_value(self, new_value: str, display: Optional[str] = None) -> None:
    """Set new value to ListCell

    Args:
        new_value: new value of content value field
        display: new value of content display field

    Returns:

    """
    super()._set_value(new_value, display)

Inherited members

class AutotextListColumnDefinition (**data: Any)

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 AutotextListColumnDefinition(ColumnDefinition):
    type: Literal[ColumnDataType.AUTOTEXT_LIST]
    options: List[str]
    autotext_list_eid: EID = Field(alias='autotextListEid')

Ancestors

Class variables

var autotext_list_eidEID
var options : List[str]
var type : Literal[<ColumnDataType.AUTOTEXT_LIST: 'autotextList'>]
class BooleanCell (**data: Any)

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 BooleanCell(Cell[bool]):
    type: Literal[ColumnDataType.BOOLEAN] = Field(allow_mutation=False)

    def set_value(self, new_value: bool, display: Optional[str] = None) -> None:
        """Set new value to BooleanCell

        Args:
            new_value: new value of content value field
            display: new value of content display field

        Returns:

        """
        super()._set_value(new_value, display)

Ancestors

  • Cell[bool]
  • Cell
  • pydantic.generics.GenericModel
  • pydantic.main.BaseModel
  • pydantic.utils.Representation
  • typing.Generic

Class variables

var type : Literal[<ColumnDataType.BOOLEAN: 'boolean'>]

Methods

def set_value(self, new_value: bool, display: Optional[str] = None) ‑> None

Set new value to BooleanCell

Args

new_value
new value of content value field
display
new value of content display field

Returns:

Expand source code
def set_value(self, new_value: bool, display: Optional[str] = None) -> None:
    """Set new value to BooleanCell

    Args:
        new_value: new value of content value field
        display: new value of content display field

    Returns:

    """
    super()._set_value(new_value, display)

Inherited members

class Cell (**data: Any)

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 Cell(GenericModel, Generic[CellContentType]):
    id: UUID = Field(allow_mutation=False, alias='key')
    type: ColumnDataType = Field(allow_mutation=False)
    name: str = Field(allow_mutation=False)
    content: CellContent[CellContentType]
    _changed: bool = PrivateAttr(default=False)

    class Config:
        validate_assignment = True

    @property
    def value(self) -> Union[CellContentType, List[CellContentType]]:
        """Get content value

        Returns:
            Union[CellContentType, List[CellContentType]]
        """
        return self.content.values or self.content.value

    def _set_value(self, new_value: CellContentType, display: Optional[str] = None) -> None:
        self.content.value = new_value
        self.content.display = display

        self._changed = True

    @property
    def is_changed(self) -> bool:
        """Get is_changed value

        Returns:
            bool: True/False
        """
        return self._changed

    @property
    def display(self) -> str:
        """Get display field of content

        Returns:
            str
        """
        return self.content.display or ''

    @property
    def update_request(self) -> UpdateCellRequest[CellContentType]:
        """Get UpdateCellRequest

        Returns:
            UpdateCellRequest
        """
        return UpdateCellRequest[CellContentType](key=self.id, content=self.content)

Ancestors

  • pydantic.generics.GenericModel
  • pydantic.main.BaseModel
  • pydantic.utils.Representation
  • typing.Generic

Subclasses

Class variables

var Config
var contentCellContent
var id : uuid.UUID
var name : str
var typeColumnDataType

Instance variables

var display : str

Get display field of content

Returns

str

Expand source code
@property
def display(self) -> str:
    """Get display field of content

    Returns:
        str
    """
    return self.content.display or ''
var is_changed : bool

Get is_changed value

Returns

bool
True/False
Expand source code
@property
def is_changed(self) -> bool:
    """Get is_changed value

    Returns:
        bool: True/False
    """
    return self._changed
var update_requestUpdateCellRequest

Get UpdateCellRequest

Returns

UpdateCellRequest

Expand source code
@property
def update_request(self) -> UpdateCellRequest[CellContentType]:
    """Get UpdateCellRequest

    Returns:
        UpdateCellRequest
    """
    return UpdateCellRequest[CellContentType](key=self.id, content=self.content)
var value : Union[~CellContentType, List[~CellContentType]]

Get content value

Returns

Union[CellContentType, List[CellContentType]]

Expand source code
@property
def value(self) -> Union[CellContentType, List[CellContentType]]:
    """Get content value

    Returns:
        Union[CellContentType, List[CellContentType]]
    """
    return self.content.values or self.content.value
class CellContent (**data: Any)

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 CellContent(GenericModel, Generic[CellContentType]):
    value: CellContentType
    values: Optional[List[CellContentType]] = None
    type: Optional[Union[EntityType, ObjectType, MaterialType]] = None
    display: Optional[str] = None

    class Config:
        validate_assignment = True

Ancestors

  • pydantic.generics.GenericModel
  • pydantic.main.BaseModel
  • pydantic.utils.Representation
  • typing.Generic

Subclasses

  • pydantic.generics.CellContent[DateTime]
  • pydantic.generics.CellContent[Union[EID, MID]]
  • pydantic.generics.CellContent[bool]
  • pydantic.generics.CellContent[float]
  • pydantic.generics.CellContent[int]
  • pydantic.generics.CellContent[str]

Class variables

var Config
var display : Optional[str]
var type : Union[EntityTypeObjectTypeMaterialType, ForwardRef(None)]
var value : ~CellContentType
var values : Optional[List[~CellContentType]]
class CellContentDict (*args, **kwargs)

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)

Expand source code
class CellContentDict(TypedDict):
    value: Any
    values: Optional[List[Any]]
    type: Optional[EntityType]
    display: Optional[str]

Ancestors

  • builtins.dict

Class variables

var display : Optional[str]
var type : Optional[EntityType]
var value : Any

Methods

def values(...) ‑> Optional[List[Any]]

D.values() -> an object providing a view on D's values

class Cell[DateTime] (**data: Any)

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.

Ancestors

  • Cell
  • pydantic.generics.GenericModel
  • pydantic.main.BaseModel
  • pydantic.utils.Representation
  • typing.Generic

Subclasses

Class variables

var Config
var content : pydantic.generics.CellContent[DateTime]
var id : uuid.UUID
var name : str
var typeColumnDataType

Inherited members

class Cell[Union[EID, MID]] (**data: Any)

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.

Ancestors

  • Cell
  • pydantic.generics.GenericModel
  • pydantic.main.BaseModel
  • pydantic.utils.Representation
  • typing.Generic

Subclasses

Class variables

var Config
var content : pydantic.generics.CellContent[Union[EID, MID]]
var id : uuid.UUID
var name : str
var typeColumnDataType

Inherited members

class Cell[bool] (**data: Any)

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.

Ancestors

  • Cell
  • pydantic.generics.GenericModel
  • pydantic.main.BaseModel
  • pydantic.utils.Representation
  • typing.Generic

Subclasses

Class variables

var Config
var content : pydantic.generics.CellContent[bool]
var id : uuid.UUID
var name : str
var typeColumnDataType

Inherited members

class Cell[float] (**data: Any)

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.

Ancestors

  • Cell
  • pydantic.generics.GenericModel
  • pydantic.main.BaseModel
  • pydantic.utils.Representation
  • typing.Generic

Subclasses

Class variables

var Config
var content : pydantic.generics.CellContent[float]
var id : uuid.UUID
var name : str
var typeColumnDataType

Inherited members

class Cell[int] (**data: Any)

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.

Ancestors

  • Cell
  • pydantic.generics.GenericModel
  • pydantic.main.BaseModel
  • pydantic.utils.Representation
  • typing.Generic

Subclasses

Class variables

var Config
var content : pydantic.generics.CellContent[int]
var id : uuid.UUID
var name : str
var typeColumnDataType

Inherited members

class Cell[str] (**data: Any)

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.

Ancestors

  • Cell
  • pydantic.generics.GenericModel
  • pydantic.main.BaseModel
  • pydantic.utils.Representation
  • typing.Generic

Subclasses

Class variables

var Config
var content : pydantic.generics.CellContent[str]
var id : uuid.UUID
var name : str
var typeColumnDataType

Inherited members

class ColumnDataType (value, names=None, *, module=None, qualname=None, type=None, start=1)

An enumeration.

Expand source code
class ColumnDataType(str, Enum):
    NUMBER = 'number'
    INTEGER = 'integer'
    DATE_TIME = 'datetime'
    TEXT = 'text'
    LIST = 'list'
    MULTI_SELECT = 'multiSelect'
    ATTRIBUTE_LIST = 'attributeList'
    AUTOTEXT_LIST = 'autotextList'
    BOOLEAN = 'boolean'
    UNIT = 'unit'
    LINK = 'link'
    EXTERNAL_LINK = 'externalLink'

Ancestors

  • builtins.str
  • enum.Enum

Class variables

var ATTRIBUTE_LIST
var AUTOTEXT_LIST
var BOOLEAN
var DATE_TIME
var INTEGER
var LIST
var MULTI_SELECT
var NUMBER
var TEXT
var UNIT
class ColumnDefinition (**data: Any)

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 ColumnDefinition(BaseModel):
    key: UUID
    title: str
    type: ColumnDataType
    is_external_key: Optional[bool] = Field(alias='isExternalKey', default=None)
    is_user_defined: Optional[bool] = Field(alias='isUserDefined', default=None)
    saved: Optional[bool] = Field(default=None)
    read_only: bool = Field(default=True, alias='readOnly')

    class Config:
        frozen = True

Ancestors

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

Subclasses

Class variables

var Config
var is_external_key : Optional[bool]
var is_user_defined : Optional[bool]
var key : uuid.UUID
var read_only : bool
var saved : Optional[bool]
var title : str
var typeColumnDataType
class ColumnDefinitions (**data: Any)

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 ColumnDefinitions(BaseModel):
    id: EID
    type: Literal[ObjectType.COLUMN_DEFINITIONS]
    columns: List[GenericColumnDefinition]

    class Config:
        frozen = True

Ancestors

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

Class variables

var Config
var columns : List[Union[AttributeListColumnDefinitionAutotextListColumnDefinitionListColumnDefinitionMultiSelectColumnDefinitionUnitColumnDefinitionColumnDefinition]]
var idEID
var type : Literal[]
class DateTimeCell (**data: Any)

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 DateTimeCell(Cell[DateTime]):
    type: Literal[ColumnDataType.DATE_TIME] = Field(allow_mutation=False)

    def set_value(self, new_value: DateTime, display: Optional[str] = None) -> None:
        """Set new value to DateTimeCell

        Args:
            new_value: new value of content value field
            display: new value of content display field

        Returns:

        """
        super()._set_value(new_value, display)

Ancestors

  • Cell[DateTime]
  • Cell
  • pydantic.generics.GenericModel
  • pydantic.main.BaseModel
  • pydantic.utils.Representation
  • typing.Generic

Class variables

var type : Literal[<ColumnDataType.DATE_TIME: 'datetime'>]

Methods

def set_value(self, new_value: DateTime, display: Optional[str] = None) ‑> None

Set new value to DateTimeCell

Args

new_value
new value of content value field
display
new value of content display field

Returns:

Expand source code
def set_value(self, new_value: DateTime, display: Optional[str] = None) -> None:
    """Set new value to DateTimeCell

    Args:
        new_value: new value of content value field
        display: new value of content display field

    Returns:

    """
    super()._set_value(new_value, display)

Inherited members

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 ExternalLink(Cell[str]):
    type: Literal[ColumnDataType.EXTERNAL_LINK] = Field(allow_mutation=False)

    def set_value(self, new_value: str, display: Optional[str] = None) -> None:
        """Set new value to ExternalLink

        Args:
            new_value: new value of content value field
            display: new value of content display field

        Returns:

        """
        super()._set_value(new_value, display)

Ancestors

  • Cell[str]
  • Cell
  • pydantic.generics.GenericModel
  • pydantic.main.BaseModel
  • pydantic.utils.Representation
  • typing.Generic

Class variables

var type : Literal[<ColumnDataType.EXTERNAL_LINK: 'externalLink'>]

Methods

def set_value(self, new_value: str, display: Optional[str] = None) ‑> None

Set new value to ExternalLink

Args

new_value
new value of content value field
display
new value of content display field

Returns:

Expand source code
def set_value(self, new_value: str, display: Optional[str] = None) -> None:
    """Set new value to ExternalLink

    Args:
        new_value: new value of content value field
        display: new value of content display field

    Returns:

    """
    super()._set_value(new_value, display)

Inherited members

class IntegerCell (**data: Any)

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 IntegerCell(Cell[int]):
    type: Literal[ColumnDataType.INTEGER] = Field(allow_mutation=False)

    def set_value(self, new_value: int, display: Optional[str] = None) -> None:
        """Set new value to IntegerCell

        Args:
            new_value: new value of content value field
            display: new value of content display field

        Returns:

        """
        super()._set_value(new_value, display)

Ancestors

  • Cell[int]
  • Cell
  • pydantic.generics.GenericModel
  • pydantic.main.BaseModel
  • pydantic.utils.Representation
  • typing.Generic

Class variables

var type : Literal[<ColumnDataType.INTEGER: 'integer'>]

Methods

def set_value(self, new_value: int, display: Optional[str] = None) ‑> None

Set new value to IntegerCell

Args

new_value
new value of content value field
display
new value of content display field

Returns:

Expand source code
def set_value(self, new_value: int, display: Optional[str] = None) -> None:
    """Set new value to IntegerCell

    Args:
        new_value: new value of content value field
        display: new value of content display field

    Returns:

    """
    super()._set_value(new_value, display)

Inherited members

class LinkCell (**data: Any)

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 LinkCell(Cell[Union[EID, MID]]):
    type: Literal[ColumnDataType.LINK] = Field(allow_mutation=False)

    @property
    def object(self) -> Union[Entity, Material]:
        """Get Material or Entity

        Returns:

        """
        object_id = self.content.value
        try:
            return MaterialStore.get(MID(object_id))
        except EIDError:
            pass

        return EntityStore.get(EID(object_id))

    def set_value(self, new_value: Union[EID, MID], display: str) -> None:
        """Set new value to LinkCell

        Args:
            new_value: new value of content value field
            display: new value of content display field

        Returns:

        """
        super()._set_value(new_value, display)

Ancestors

  • Cell[Union[EID, MID]]
  • Cell
  • pydantic.generics.GenericModel
  • pydantic.main.BaseModel
  • pydantic.utils.Representation
  • typing.Generic

Class variables

var type : Literal[<ColumnDataType.LINK: 'link'>]

Instance variables

var object : Union[EntityMaterial]

Get Material or Entity

Returns:

Expand source code
@property
def object(self) -> Union[Entity, Material]:
    """Get Material or Entity

    Returns:

    """
    object_id = self.content.value
    try:
        return MaterialStore.get(MID(object_id))
    except EIDError:
        pass

    return EntityStore.get(EID(object_id))

Methods

def set_value(self, new_value: Union[EIDMID], display: str) ‑> None

Set new value to LinkCell

Args

new_value
new value of content value field
display
new value of content display field

Returns:

Expand source code
def set_value(self, new_value: Union[EID, MID], display: str) -> None:
    """Set new value to LinkCell

    Args:
        new_value: new value of content value field
        display: new value of content display field

    Returns:

    """
    super()._set_value(new_value, display)

Inherited members

class ListCell (**data: Any)

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 ListCell(Cell[str]):
    type: Literal[ColumnDataType.LIST] = Field(allow_mutation=False)

    def set_value(self, new_value: str, display: Optional[str] = None) -> None:
        """Set new value to ListCell

        Args:
            new_value: new value of content value field
            display: new value of content display field

        Returns:

        """
        super()._set_value(new_value, display)

Ancestors

  • Cell[str]
  • Cell
  • pydantic.generics.GenericModel
  • pydantic.main.BaseModel
  • pydantic.utils.Representation
  • typing.Generic

Class variables

var type : Literal[<ColumnDataType.LIST: 'list'>]

Methods

def set_value(self, new_value: str, display: Optional[str] = None) ‑> None

Set new value to ListCell

Args

new_value
new value of content value field
display
new value of content display field

Returns:

Expand source code
def set_value(self, new_value: str, display: Optional[str] = None) -> None:
    """Set new value to ListCell

    Args:
        new_value: new value of content value field
        display: new value of content display field

    Returns:

    """
    super()._set_value(new_value, display)

Inherited members

class ListColumnDefinition (**data: Any)

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 ListColumnDefinition(ColumnDefinition):
    type: Literal[ColumnDataType.LIST]
    options: List[str]

Ancestors

Class variables

var options : List[str]
var type : Literal[<ColumnDataType.LIST: 'list'>]
class MultiSelectCell (**data: Any)

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 MultiSelectCell(Cell[str]):
    type: Literal[ColumnDataType.MULTI_SELECT] = Field(allow_mutation=False)

    def set_value(self, new_value: Union[str, List[str]], display: Optional[str] = None) -> None:
        """Set new value to MultiSelectCell

        Args:
            new_value: new value or list of values of content value field
            display: new value of content display field

        Returns:

        """
        if isinstance(new_value, List):
            value = ', '.join(new_value)
            self.content.values = new_value
        else:
            value = new_value
            self.content.values = [new_value]

        super()._set_value(value, display)

Ancestors

  • Cell[str]
  • Cell
  • pydantic.generics.GenericModel
  • pydantic.main.BaseModel
  • pydantic.utils.Representation
  • typing.Generic

Class variables

var type : Literal[<ColumnDataType.MULTI_SELECT: 'multiSelect'>]

Methods

def set_value(self, new_value: Union[str, List[str]], display: Optional[str] = None) ‑> None

Set new value to MultiSelectCell

Args

new_value
new value or list of values of content value field
display
new value of content display field

Returns:

Expand source code
def set_value(self, new_value: Union[str, List[str]], display: Optional[str] = None) -> None:
    """Set new value to MultiSelectCell

    Args:
        new_value: new value or list of values of content value field
        display: new value of content display field

    Returns:

    """
    if isinstance(new_value, List):
        value = ', '.join(new_value)
        self.content.values = new_value
    else:
        value = new_value
        self.content.values = [new_value]

    super()._set_value(value, display)

Inherited members

class MultiSelectColumnDefinition (**data: Any)

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 MultiSelectColumnDefinition(ColumnDefinition):
    type: Literal[ColumnDataType.MULTI_SELECT]
    options: List[str]

Ancestors

Class variables

var options : List[str]
var type : Literal[<ColumnDataType.MULTI_SELECT: 'multiSelect'>]
class NumberCell (**data: Any)

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 NumberCell(Cell[float]):
    type: Literal[ColumnDataType.NUMBER] = Field(allow_mutation=False)

    def set_value(self, new_value: float, display: Optional[str] = None) -> None:
        """Set new value to NumberCell

        Args:
            new_value: new value of content value field
            display: new value of content display field

        Returns:

        """
        super()._set_value(new_value, display)

Ancestors

  • Cell[float]
  • Cell
  • pydantic.generics.GenericModel
  • pydantic.main.BaseModel
  • pydantic.utils.Representation
  • typing.Generic

Class variables

var type : Literal[<ColumnDataType.NUMBER: 'number'>]

Methods

def set_value(self, new_value: float, display: Optional[str] = None) ‑> None

Set new value to NumberCell

Args

new_value
new value of content value field
display
new value of content display field

Returns:

Expand source code
def set_value(self, new_value: float, display: Optional[str] = None) -> None:
    """Set new value to NumberCell

    Args:
        new_value: new value of content value field
        display: new value of content display field

    Returns:

    """
    super()._set_value(new_value, display)

Inherited members

class TextCell (**data: Any)

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 TextCell(Cell[str]):
    type: Literal[ColumnDataType.TEXT] = Field(allow_mutation=False)

    def set_value(self, new_value: str, display: Optional[str] = None) -> None:
        """Set new value to TextCell

        Args:
            new_value: new value of content value field
            display: new value of content display field

        Returns:

        """
        super()._set_value(new_value, display)

Ancestors

  • Cell[str]
  • Cell
  • pydantic.generics.GenericModel
  • pydantic.main.BaseModel
  • pydantic.utils.Representation
  • typing.Generic

Class variables

var type : Literal[]

Methods

def set_value(self, new_value: str, display: Optional[str] = None) ‑> None

Set new value to TextCell

Args

new_value
new value of content value field
display
new value of content display field

Returns:

Expand source code
def set_value(self, new_value: str, display: Optional[str] = None) -> None:
    """Set new value to TextCell

    Args:
        new_value: new value of content value field
        display: new value of content display field

    Returns:

    """
    super()._set_value(new_value, display)

Inherited members

class UnitCell (**data: Any)

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 UnitCell(Cell[float]):
    type: Literal[ColumnDataType.UNIT] = Field(allow_mutation=False)

    def set_value(self, new_value: float, display: Optional[str] = None) -> None:
        """Set new value to UnitCell

        Args:
            new_value: new value of content value field
            display: new value of content display field

        Returns:

        """
        super()._set_value(new_value, display)

Ancestors

  • Cell[float]
  • Cell
  • pydantic.generics.GenericModel
  • pydantic.main.BaseModel
  • pydantic.utils.Representation
  • typing.Generic

Class variables

var type : Literal[<ColumnDataType.UNIT: 'unit'>]

Methods

def set_value(self, new_value: float, display: Optional[str] = None) ‑> None

Set new value to UnitCell

Args

new_value
new value of content value field
display
new value of content display field

Returns:

Expand source code
def set_value(self, new_value: float, display: Optional[str] = None) -> None:
    """Set new value to UnitCell

    Args:
        new_value: new value of content value field
        display: new value of content display field

    Returns:

    """
    super()._set_value(new_value, display)

Inherited members

class UnitColumnDefinition (**data: Any)

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 UnitColumnDefinition(ColumnDefinition):
    type: Literal[ColumnDataType.UNIT]
    measure: str
    default_unit: str = Field(alias='defaultUnit')

Ancestors

Class variables

var default_unit : str
var measure : str
var type : Literal[<ColumnDataType.UNIT: 'unit'>]
class UpdateCellRequest (**data: Any)

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 UpdateCellRequest(GenericModel, Generic[CellContentType]):
    key: UUID
    content: CellContent[CellContentType]

Ancestors

  • pydantic.generics.GenericModel
  • pydantic.main.BaseModel
  • pydantic.utils.Representation
  • typing.Generic

Class variables

var contentCellContent
var key : uuid.UUID