From 693431284bb37092946761944860d950e240043c Mon Sep 17 00:00:00 2001 From: Tim Jenness Date: Mon, 3 Jul 2023 08:56:40 -0700 Subject: [PATCH] Provide None defaults for pydantic parameters --- python/lsst/daf/butler/core/datastoreCacheManager.py | 2 +- python/lsst/daf/butler/core/logging.py | 4 ++-- python/lsst/daf/butler/core/quantum.py | 4 ++-- python/lsst/daf/butler/tests/_examplePythonTypes.py | 6 +++--- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/python/lsst/daf/butler/core/datastoreCacheManager.py b/python/lsst/daf/butler/core/datastoreCacheManager.py index ae3cca7f1b..1a679945ee 100644 --- a/python/lsst/daf/butler/core/datastoreCacheManager.py +++ b/python/lsst/daf/butler/core/datastoreCacheManager.py @@ -135,7 +135,7 @@ class CacheEntry(BaseModel): ref: DatasetId """ID of this dataset.""" - component: str | None + component: str | None = None """Component for this disassembled composite (optional).""" @classmethod diff --git a/python/lsst/daf/butler/core/logging.py b/python/lsst/daf/butler/core/logging.py index b85f221364..2a752acc5f 100644 --- a/python/lsst/daf/butler/core/logging.py +++ b/python/lsst/daf/butler/core/logging.py @@ -175,10 +175,10 @@ class ButlerLogRecord(BaseModel): filename: str pathname: str lineno: int - funcName: str | None + funcName: str | None = None process: int processName: str - exc_info: str | None + exc_info: str | None = None MDC: dict[str, str] class Config: diff --git a/python/lsst/daf/butler/core/quantum.py b/python/lsst/daf/butler/core/quantum.py index d3cdb77e89..c93663142c 100644 --- a/python/lsst/daf/butler/core/quantum.py +++ b/python/lsst/daf/butler/core/quantum.py @@ -78,8 +78,8 @@ def _reconstructDatasetRef( class SerializedQuantum(BaseModel): """Simplified model of a `Quantum` suitable for serialization.""" - taskName: str | None - dataId: SerializedDataCoordinate | None + taskName: str | None = None + dataId: SerializedDataCoordinate | None = None datasetTypeMapping: Mapping[str, SerializedDatasetType] initInputs: Mapping[str, tuple[SerializedDatasetRef, list[int]]] inputs: Mapping[str, list[tuple[SerializedDatasetRef, list[int]]]] diff --git a/python/lsst/daf/butler/tests/_examplePythonTypes.py b/python/lsst/daf/butler/tests/_examplePythonTypes.py index d861f7ecad..3e8b61a678 100644 --- a/python/lsst/daf/butler/tests/_examplePythonTypes.py +++ b/python/lsst/daf/butler/tests/_examplePythonTypes.py @@ -266,9 +266,9 @@ def makeFromDict(cls, exportDict: dict[str, list | dict | None]) -> MetricsExamp class MetricsExampleModel(BaseModel): """A variant of `MetricsExample` based on model.""" - summary: dict[str, Any] | None - output: dict[str, Any] | None - data: list[Any] | None + summary: dict[str, Any] | None = None + output: dict[str, Any] | None = None + data: list[Any] | None = None @classmethod def from_metrics(cls, metrics: MetricsExample) -> MetricsExampleModel: