Add versioning to the data point model
This commit is contained in:
parent
f455ba9843
commit
f71485ea2b
2 changed files with 10 additions and 0 deletions
1
.github/workflows/profiling.yaml
vendored
1
.github/workflows/profiling.yaml
vendored
|
|
@ -57,6 +57,7 @@ jobs:
|
|||
run: |
|
||||
poetry install --no-interaction --all-extras
|
||||
poetry run pip install pyinstrument
|
||||
poetry run pip install parso
|
||||
|
||||
|
||||
# Set environment variables for SHAs
|
||||
|
|
|
|||
|
|
@ -81,3 +81,12 @@ class DataPoint(BaseModel):
|
|||
"""Deserialize the instance from pickled bytes."""
|
||||
data = pickle.loads(pickled_data)
|
||||
return self(**data)
|
||||
|
||||
def to_dict(self, **kwargs) -> Dict[str, Any]:
|
||||
"""Serialize model to a dictionary."""
|
||||
return self.model_dump(**kwargs)
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, data: Dict[str, Any]) -> "DataPoint":
|
||||
"""Deserialize model from a dictionary."""
|
||||
return cls.model_validate(data)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue