-
Notifications
You must be signed in to change notification settings - Fork 41
Let a serialized model name the class it holds #891
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
c525607
303f844
a8ae188
b979fc3
4d76211
fded303
63fbcc9
cd87ce9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,13 +11,13 @@ | |
|
|
||
| import numpy as np | ||
| import pandas as pd | ||
| from pydantic import ConfigDict, Field, model_validator | ||
| from pydantic import ConfigDict, Field, SerializeAsAny, model_validator | ||
|
|
||
| import dascore as dc | ||
| from dascore.constants import path_types | ||
| from dascore.core.attrs import PatchAttrs | ||
| from dascore.core.coords import CoordSummary | ||
| from dascore.utils.models import DascoreBaseModel | ||
| from dascore.models import DascoreBaseModel | ||
| from dascore.utils.paths import coerce_to_upath, is_pathlike | ||
|
|
||
|
|
||
|
|
@@ -202,7 +202,7 @@ class PatchSummary(DascoreBaseModel): | |
|
|
||
| model_config = ConfigDict(title="Patch Summary", extra="ignore", frozen=True) | ||
|
|
||
| attrs: PatchAttrs = Field(default_factory=PatchAttrs) | ||
| attrs: SerializeAsAny[PatchAttrs] = Field(default_factory=PatchAttrs) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When Useful? React with 👍 / 👎. |
||
| coords: dict[str, CoordSummary] = Field(default_factory=dict) | ||
| dims: tuple[str, ...] = () | ||
| shape: tuple[int, ...] = () | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typediscriminatorExisting inventory directories written for schema version 1 declare every object with
type, but_declared_typenow checks onlyobject_type; consequentlydc.inventory(path)treats those files as untyped and fails with “declares no object_type.” Since this commit neither bumps the inventory schema version nor provides a migration path, accepttypeas a legacy alias while emittingobject_typefor new documents.Useful? React with 👍 / 👎.