From 033070b0471f93c1a1adbff248c5a762b6cdf1c3 Mon Sep 17 00:00:00 2001 From: Isaac To Date: Wed, 11 Dec 2024 18:26:10 -0800 Subject: [PATCH] style: use `default_factory` to specify validation error default This eliminate complain from PyCharm as well --- src/dandisets_linkml_status_tools/models.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/dandisets_linkml_status_tools/models.py b/src/dandisets_linkml_status_tools/models.py index 6873f14..e17d449 100644 --- a/src/dandisets_linkml_status_tools/models.py +++ b/src/dandisets_linkml_status_tools/models.py @@ -151,7 +151,9 @@ class ValidationReport(DandiBaseReport): """ # Error encountered in validation against a Pydantic model - pydantic_validation_errs: Json[PydanticValidationErrsType] = [] + pydantic_validation_errs: Annotated[ + Json[PydanticValidationErrsType], Field(default_factory=list) + ] class DandisetValidationReport(ValidationReport): @@ -233,10 +235,14 @@ def dandiset_schema_version(self) -> str: dandiset_metadata: DandiMetadata # Error encountered in validation against the Pydantic dandiset metadata model - pydantic_validation_errs: Json[PydanticValidationErrsType] = [] + pydantic_validation_errs: Annotated[ + Json[PydanticValidationErrsType], Field(default_factory=list) + ] # Errors encountered in validation against the dandiset metadata model in LinkML - linkml_validation_errs: LinkmlValidationErrsType = [] + linkml_validation_errs: Annotated[ + LinkmlValidationErrsType, Field(default_factory=list) + ] DandisetValidationReportsType: TypeAlias = defaultdict[