MCPcopy
hub / github.com/pydantic/pydantic / update_field_from_config

Function update_field_from_config

pydantic/_internal/_fields.py:191–205  ·  view source on GitHub ↗

Update the `FieldInfo` instance from the configuration set on the model it belongs to. This will apply the title and alias generators from the configuration. Args: config_wrapper: The configuration from the model. field_name: The field name the `FieldInfo` instance is attac

(config_wrapper: ConfigWrapper, field_name: str, field_info: FieldInfo)

Source from the content-addressed store, hash-verified

189
190
191def update_field_from_config(config_wrapper: ConfigWrapper, field_name: str, field_info: FieldInfo) -> None:
192 """Update the `FieldInfo` instance from the configuration set on the model it belongs to.
193
194 This will apply the title and alias generators from the configuration.
195
196 Args:
197 config_wrapper: The configuration from the model.
198 field_name: The field name the `FieldInfo` instance is attached to.
199 field_info: The `FieldInfo` instance to update.
200 """
201 field_title_generator = field_info.field_title_generator or config_wrapper.field_title_generator
202 if field_title_generator is not None:
203 _apply_field_title_generator_to_field_info(field_title_generator, field_name, field_info)
204 if config_wrapper.alias_generator is not None:
205 _apply_alias_generator_to_field_info(config_wrapper.alias_generator, field_name, field_info)
206
207
208_deprecated_method_names = {'dict', 'json', 'copy', '_iter', '_copy_and_set_values', '_calculate_keys'}

Callers 7

_typed_dict_schemaMethod · 0.85
collect_model_fieldsFunction · 0.85
rebuild_model_fieldsFunction · 0.85
collect_dataclass_fieldsFunction · 0.85
rebuild_dataclass_fieldsFunction · 0.85

Tested by

no test coverage detected