MCPcopy
hub / github.com/pydantic/pydantic / setdefault

Method setdefault

pydantic/mypy.py:1245–1248  ·  view source on GitHub ↗

Set default value for Pydantic model config if config value is `None`.

(self, key: str, value: Any)

Source from the content-addressed store, hash-verified

1243 setattr(self, k, v)
1244
1245 def setdefault(self, key: str, value: Any) -> None:
1246 """Set default value for Pydantic model config if config value is `None`."""
1247 if getattr(self, key) is None:
1248 setattr(self, key, value)
1249
1250
1251def is_root_model(info: TypeInfo) -> bool:

Callers 4

collect_configMethod · 0.95
_update_class_schemaMethod · 0.45
arguments_v3_schemaMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected