Module pydantic_partials.config
Classes
class PartialConfigDict (*args, **kwargs)-
Expand source code
class PartialConfigDict(ConfigDict, total=False): auto_partials: bool """ Defaults to `True`. - If `True` (default): When class is created, all required attributes will be made `Partial`, and their default set to `Missing`. This means that all attributes that don't have any default or default_factory defined will automatically have `MissingType`/`LazyType` added to their annotation and field default set to `Missing`/`Lazy`. Default value will only be modified if it was not already set to something by the user. It needs to be modified if nothing is defined to ensure the field is not required. This allows Pydantic to create an instance of the model without a value defined for partial fields. - If `False`: Class won't automatically add `Partial` fields. Instead adding them to individual fields will be up to the user. The default value of any fields set by user to be `Partial` will still be adjusted unless the user already a default value defined by user for field. This ensures that Pydantic won't require the field be assigned a value. """ auto_partials_exclude: set[str] """ A set of field names to exclude from the `auto_partials` functionality. All parent classes `partials_exclude` string sets will be combined together for a final exclusion list. Any partials set manually/directly via the fields annotation will still be a partial field regardless if it's referenced in this `auto_partials_exclude` set or not. This only effects the way automatic partials are applied. You can also use `pydantic_partials.partial.AutoPartialExclude` to more easily mark fields as excluded. """dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)
Ancestors
- builtins.dict
Class variables
var alias_generator : Callable[[str], str] | AliasGenerator | Nonevar allow_inf_nan : boolvar arbitrary_types_allowed : boolvar auto_partials : bool-
Defaults to
True.-
If
True(default): When class is created, all required attributes will be madePartial, and their default set toMissing. This means that all attributes that don't have any default or default_factory defined will automatically haveMissingType/LazyTypeadded to their annotation and field default set toMissing/Lazy.Default value will only be modified if it was not already set to something by the user. It needs to be modified if nothing is defined to ensure the field is not required. This allows Pydantic to create an instance of the model without a value defined for partial fields.
-
If
False: Class won't automatically addPartialfields. Instead adding them to individual fields will be up to the user.The default value of any fields set by user to be
Partialwill still be adjusted unless the user already a default value defined by user for field. This ensures that Pydantic won't require the field be assigned a value.
-
var auto_partials_exclude : set[str]-
A set of field names to exclude from the
auto_partialsfunctionality.All parent classes
partials_excludestring sets will be combined together for a final exclusion list.Any partials set manually/directly via the fields annotation will still be a partial field regardless if it's referenced in this
auto_partials_excludeset or not. This only effects the way automatic partials are applied.You can also use
pydantic_partials.partial.AutoPartialExcludeto more easily mark fields as excluded. var cache_strings : bool | Literal['all', 'keys', 'none']var coerce_numbers_to_str : boolvar defer_build : boolvar extra : ExtraValues | Nonevar field_title_generator : Callable[[str, FieldInfo | ComputedFieldInfo], str] | Nonevar from_attributes : boolvar frozen : boolvar hide_input_in_errors : boolvar ignored_types : tuple[type, ...]var json_encoders : dict[type[object], JsonEncoder] | Nonevar json_schema_extra : JsonDict | JsonSchemaExtraCallable | Nonevar json_schema_mode_override : Literal['validation', 'serialization', None]var json_schema_serialization_defaults_required : boolvar loc_by_alias : boolvar model_title_generator : Callable[[type], str] | Nonevar plugin_settings : dict[str, object] | Nonevar populate_by_name : boolvar protected_namespaces : tuple[str | Pattern[str], ...]var regex_engine : Literal['rust-regex', 'python-re']var revalidate_instances : Literal['always', 'never', 'subclass-instances']var schema_generator : type[_GenerateSchema] | Nonevar ser_json_bytes : Literal['utf8', 'base64', 'hex']var ser_json_inf_nan : Literal['null', 'constants', 'strings']var ser_json_timedelta : Literal['iso8601', 'float']var str_max_length : int | Nonevar str_min_length : intvar str_strip_whitespace : boolvar str_to_lower : boolvar str_to_upper : boolvar strict : boolvar title : str | Nonevar use_attribute_docstrings : boolvar use_enum_values : boolvar val_json_bytes : Literal['utf8', 'base64', 'hex']var validate_assignment : boolvar validate_default : boolvar validate_return : boolvar validation_error_cause : bool