Skip to content

Commit

Permalink
Provide None defaults for pydantic parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
timj committed Jul 3, 2023
1 parent 6618b21 commit 6934312
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion python/lsst/daf/butler/core/datastoreCacheManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions python/lsst/daf/butler/core/logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions python/lsst/daf/butler/core/quantum.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]]]]
Expand Down
6 changes: 3 additions & 3 deletions python/lsst/daf/butler/tests/_examplePythonTypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 6934312

Please sign in to comment.