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 | None
var allow_inf_nan : bool
var arbitrary_types_allowed : bool
var 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
/LazyType
added 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 addPartial
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.
-
var 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. var cache_strings : bool | Literal['all', 'keys', 'none']
var coerce_numbers_to_str : bool
var defer_build : bool
var extra : ExtraValues | None
var field_title_generator : Callable[[str, FieldInfo | ComputedFieldInfo], str] | None
var from_attributes : bool
var frozen : bool
var hide_input_in_errors : bool
var ignored_types : tuple[type, ...]
var json_encoders : dict[type[object], JsonEncoder] | None
var json_schema_extra : JsonDict | JsonSchemaExtraCallable | None
var json_schema_mode_override : Literal['validation', 'serialization', None]
var json_schema_serialization_defaults_required : bool
var loc_by_alias : bool
var model_title_generator : Callable[[type], str] | None
var plugin_settings : dict[str, object] | None
var populate_by_name : bool
var 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] | None
var 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 | None
var str_min_length : int
var str_strip_whitespace : bool
var str_to_lower : bool
var str_to_upper : bool
var strict : bool
var title : str | None
var use_attribute_docstrings : bool
var use_enum_values : bool
var val_json_bytes : Literal['utf8', 'base64', 'hex']
var validate_assignment : bool
var validate_default : bool
var validate_return : bool
var validation_error_cause : bool