Skip to content

Commit 08ed432

Browse files
Fix pydantic model_fields deprecation warning
Access model_fields from class instead of instance: - self.model_fields -> type(self).model_fields Reduces test warnings from 3 to 1 (remaining is intentional user warning). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent a82128d commit 08ed432

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/datajoint/settings.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -827,10 +827,10 @@ def __setitem__(self, key: str, value: Any) -> None:
827827

828828
def __delitem__(self, key: str) -> None:
829829
"""Reset setting to default by dot-notation key."""
830-
# Get the default value from the model fields
830+
# Get the default value from the model fields (access from class, not instance)
831831
parts = key.split(".")
832832
if len(parts) == 1:
833-
field_info = self.model_fields.get(key)
833+
field_info = type(self).model_fields.get(key)
834834
if field_info is not None:
835835
default = field_info.default
836836
if default is not None:

0 commit comments

Comments
 (0)