MCPcopy
hub / github.com/pydantic/pydantic / update

Method update

pydantic/mypy.py:1238–1243  ·  view source on GitHub ↗

Update Pydantic model config values.

(self, config: ModelConfigData | None)

Source from the content-addressed store, hash-verified

1236 return {k: v for k, v in self.__dict__.items() if v is not None}
1237
1238 def update(self, config: ModelConfigData | None) -> None:
1239 """Update Pydantic model config values."""
1240 if config is None:
1241 return
1242 for k, v in config.get_values_dict().items():
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`."""

Calls 2

get_values_dictMethod · 0.80
itemsMethod · 0.45

Tested by 15

test_list_union_dictFunction · 0.36
test_date_typesFunction · 0.36
test_str_basic_typesFunction · 0.36
test_patternFunction · 0.36
test_special_int_typesFunction · 0.36
test_special_float_typesFunction · 0.36