Skip to content

Commit f732780

Browse files
authored
Ensure default supported_versions is a tuple, as in type (#4348)
1 parent 0adfa25 commit f732780

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

src/spikeinterface/curation/curation_model.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from pydantic import BaseModel, Field, model_validator, field_validator
1+
from pydantic import BaseModel, Field, model_validator, field_validator, field_serializer
22
from typing import List, Dict, Union, Optional, Literal, Tuple
33
from itertools import chain, combinations
44
import numpy as np
@@ -77,7 +77,7 @@ def get_full_spike_indices(self, sorting: BaseSorting):
7777

7878
class CurationModel(BaseModel):
7979
supported_versions: Tuple[Literal["1"], Literal["2"]] = Field(
80-
default=["1", "2"], description="Supported versions of the curation format"
80+
default=("1", "2"), description="Supported versions of the curation format"
8181
)
8282
format_version: str = Field(description="Version of the curation format")
8383
unit_ids: List[Union[int, str]] = Field(description="List of unit IDs")
@@ -238,11 +238,11 @@ def check_splits(cls, values):
238238
for i, split in enumerate(splits):
239239
if isinstance(split, dict):
240240
split = dict(split)
241-
if "indices" in split:
241+
if "indices" in split and split["indices"] is not None:
242242
split["indices"] = [list(indices) for indices in split["indices"]]
243-
if "labels" in split:
243+
if "labels" in split and split["labels"] is not None:
244244
split["labels"] = list(split["labels"])
245-
if "new_unit_ids" in split:
245+
if "new_unit_ids" in split and split["new_unit_ids"] is not None:
246246
split["new_unit_ids"] = list(split["new_unit_ids"])
247247
splits[i] = Split(**split)
248248

0 commit comments

Comments
 (0)