Module signals_notebook.entities.parallel_experiment.cell

Expand source code
from typing import Optional, Union

from pydantic import BaseModel, PrivateAttr


class SubExperimentSummaryCell(BaseModel):
    key: Optional[str]
    display: Optional[str]
    value: Optional[Union[str, int]]
    _changed: bool = PrivateAttr(default=False)

    def set_value(self, new_value: Optional[Union[str, int]]) -> None:
        self.value = new_value
        self._changed = True

    @property
    def is_changed(self) -> bool:
        return self._changed

    @property
    def representation_for_update(self):
        return {self.key: {'content': {'value': self.value}}}

Classes

class SubExperimentSummaryCell (**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 SubExperimentSummaryCell(BaseModel):
    key: Optional[str]
    display: Optional[str]
    value: Optional[Union[str, int]]
    _changed: bool = PrivateAttr(default=False)

    def set_value(self, new_value: Optional[Union[str, int]]) -> None:
        self.value = new_value
        self._changed = True

    @property
    def is_changed(self) -> bool:
        return self._changed

    @property
    def representation_for_update(self):
        return {self.key: {'content': {'value': self.value}}}

Ancestors

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

Class variables

var display : Optional[str]
var key : Optional[str]
var value : Union[str, int, ForwardRef(None)]

Instance variables

var is_changed : bool
Expand source code
@property
def is_changed(self) -> bool:
    return self._changed
var representation_for_update
Expand source code
@property
def representation_for_update(self):
    return {self.key: {'content': {'value': self.value}}}

Methods

def set_value(self, new_value: Union[str, int, ForwardRef(None)]) ‑> None
Expand source code
def set_value(self, new_value: Optional[Union[str, int]]) -> None:
    self.value = new_value
    self._changed = True