Skip to content

Commit

Permalink
Allow dict values in the info dictionary
Browse files Browse the repository at this point in the history
  • Loading branch information
tomjholland committed Oct 23, 2024
1 parent 7b63206 commit 73d3ec7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions pyprobe/cell.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import time
import warnings
import zipfile
from typing import Callable, Dict, List, Optional
from typing import Any, Callable, Dict, List, Optional

import distinctipy
import polars as pl
Expand All @@ -22,7 +22,7 @@
class Cell(BaseModel):
"""A class for a cell in a battery experiment."""

info: Dict[str, Optional[str | int | float]]
info: Dict[str, Optional[str | int | float | Dict[Any, Any]]]
"""Dictionary containing information about the cell.
The dictionary must contain a 'Name' field, other information may include
channel number or other rig information.
Expand All @@ -32,8 +32,8 @@ class Cell(BaseModel):

@field_validator("info")
def check_and_set_name(
cls, info: Dict[str, Optional[str | int | float]]
) -> Dict[str, Optional[str | int | float]]:
cls, info: Dict[str, Optional[str | int | float | Dict[Any, Any]]]
) -> Dict[str, Optional[str | int | float | Dict[Any, Any]]]:
"""Validate the `info` field.
Checks that a `Name` field is present in the `info` dictionary, if not it is
Expand Down Expand Up @@ -240,7 +240,7 @@ def _write_parquet(

@staticmethod
def _get_filename(
info: Dict[str, Optional[str | int | float]],
info: Dict[str, Optional[str | int | float | Dict[Any, Any]]],
filename_function: Callable[[str], str],
filename_inputs: List[str],
) -> str:
Expand Down
4 changes: 2 additions & 2 deletions pyprobe/result.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class Config:

base_dataframe: Union[pl.LazyFrame, pl.DataFrame]
"""The data as a polars DataFrame or LazyFrame."""
info: Dict[str, Optional[str | int | float]]
info: Dict[str, Optional[str | int | float | Dict[Any, Any]]]
"""Dictionary containing information about the cell."""
column_definitions: Dict[str, str] = Field(default_factory=dict)
"""A dictionary containing the definitions of the columns in the data."""
Expand Down Expand Up @@ -364,7 +364,7 @@ def build(
| Dict[str, NDArray[np.float64] | List[float]]
]
],
info: Dict[str, Optional[str | int | float]],
info: Dict[str, Optional[str | int | float | Dict[Any, Any]]],
) -> "Result":
"""Build a Result object from a list of dataframes.
Expand Down

0 comments on commit 73d3ec7

Please sign in to comment.