B
    hnd!                 @  s   d Z ddlmZ ddlmZmZmZmZ ddl	m
Z
 ddlmZmZmZ ddlmZ ddlmZ dd	l	mZ esteZd
ZG dd deZG dd dZe Zed ZG dd deddZeeZdS )z"Configuration for Pydantic models.    )annotations)TYPE_CHECKINGAnyCallableoverload)warn)LiteralProtocol	TypedDict   )getattr_migration)
BaseConfig)PydanticDeprecatedSince20)r   
ConfigDictExtrac               @  s6   e Zd ZedddddZeddddddZd	S )
JsonSchemaExtraCallablezdict[str, Any]None)schemareturnc             C  s   d S )N )selfr   r   r   3/tmp/pip-unpacked-wheel-y3jxpnai/pydantic/config.py__call__   s    z JsonSchemaExtraCallable.__call__z	type[Any])r   model_classr   c             C  s   d S )Nr   )r   r   r   r   r   r   r      s    N)__name__
__module____qualname__r   r   r   r   r   r   r      s   r   c                  sJ   e Zd ZU dZded< dZded< dZded< ddd	 fd
dZ  ZS )_ExtraallowzLiteral['allow']ignorezLiteral['ignore']forbidzLiteral['forbid']strr   )_Extra__namer   c               s   t dtdd t |S )NzX`pydantic.config.Extra` is deprecated, use literal values instead (e.g. `extra='allow'`)   )
stacklevel)r   DeprecationWarningsuper__getattribute__)r   r"   )	__class__r   r   r'   $   s
    z_Extra.__getattribute__)	r   r   r   r   __annotations__r   r    r'   __classcell__r   r   )r(   r   r      s   
r   )r   r   r    c               @  s   e Zd ZU dZded< ded< ded< ded< ded	< d
ed< ded< ded< ded< ded< ded< ded< ded< ded< ded< ded< ded< ded< ded< ded< ded < d!ed"< ded#< ded$< d%ed&< ded'< d(S ))r   aa  A dictionary-like class for configuring Pydantic models.

    Attributes:
        title: The title for the generated JSON schema. Defaults to `None`.
        str_to_lower: Whether to convert all characters to lowercase for str & bytes types. Defaults to `False`.
        str_to_upper: Whether to convert all characters to uppercase for str & bytes types. Defaults to `False`.
        str_strip_whitespace: Whether to strip leading and trailing whitespace for str & bytes types.
            Defaults to `False`.
        str_min_length: The minimum length for str & bytes types. Defaults to `None`.
        str_max_length: The maximum length for str & bytes types. Defaults to `None`.
        extra: Whether to ignore, allow, or forbid extra attributes during model initialization.
            Accepts the string values of `'ignore'`, `'allow'`, or `'forbid'`. Defaults to `'ignore'`.

            - `'forbid'` will cause validation to fail if extra attributes are included.
            - `'ignore'` will silently ignore any extra attributes.
            - `'allow'` will assign the attributes to the model.

            See [Extra Attributes](../usage/model_config.md#extra-attributes) for details.
        frozen: Whether or not models are faux-immutable, i.e. whether `__setattr__` is allowed, and also generates
            a `__hash__()` method for the model. This makes instances of the model potentially hashable if all the
            attributes are hashable. Defaults to `False`.

            !!! note
                On V1, this setting was called `allow_mutation`, and was `True` by default.
        populate_by_name: Whether an aliased field may be populated by its name as given by the model
            attribute, as well as the alias. Defaults to `False`.

            !!! note
                The name of this configuration setting was changed in **v2.0** from
                `allow_population_by_alias` to `populate_by_name`.
        use_enum_values: Whether to populate models with the `value` property of enums, rather than the raw enum.
            This may be useful if you want to serialize `model.model_dump()` later. Defaults to `False`.
        validate_assignment: Whether to perform validation on *assignment* to attributes. Defaults to `False`.
        arbitrary_types_allowed: Whether to allow arbitrary user types for fields (they are validated simply by
            checking if the value is an instance of the type). If `False`, `RuntimeError` will be raised on model
            declaration. Defaults to `False`.

            See [Arbitrary Types Allowed](../usage/model_config.md#arbitrary-types-allowed) for details.
        from_attributes: Whether to allow model creation from object attributes. Defaults to `False`.

            !!! note
                The name of this configuration setting was changed in **v2.0** from `orm_mode` to `from_attributes`.
        loc_by_alias: Whether to use the alias for error `loc`s. Defaults to `True`.
        alias_generator: a callable that takes a field name and returns an alias for it.

            See [Alias Generator](../usage/model_config.md#alias-generator) for details.
        ignored_types: A tuple of types that may occur as values of class attributes without annotations. This is
            typically used for custom descriptors (classes that behave like `property`). If an attribute is set on a
            class without an annotation and has a type that is not in this tuple (or otherwise recognized by
            _pydantic_), an error will be raised. Defaults to `()`.
        allow_inf_nan: Whether to allow infinity (`+inf` an `-inf`) and NaN values to float fields. Defaults to `True`.
        json_schema_extra: A dict or callable to provide extra JSON schema properties. Defaults to `None`.
        strict: If `True`, strict validation is applied to all fields on the model.
            See [Strict Mode](../usage/strict_mode.md) for details.
        revalidate_instances: When and how to revalidate models and dataclasses during validation. Accepts the string
            values of `'never'`, `'always'` and `'subclass-instances'`. Defaults to `'never'`.

            - `'never'` will not revalidate models and dataclasses during validation
            - `'always'` will revalidate models and dataclasses during validation
            - `'subclass-instances'` will revalidate models and dataclasses during validation if the instance is a
                subclass of the model or dataclass

            See [Revalidate Instances](../usage/model_config.md#revalidate-instances) for details.
        ser_json_timedelta: The format of JSON serialized timedeltas. Accepts the string values of `'iso8601'` and
            `'float'`. Defaults to `'iso8601'`.

            - `'iso8601'` will serialize timedeltas to ISO 8601 durations.
            - `'float'` will serialize timedeltas to the total number of seconds.
        ser_json_bytes: The encoding of JSON serialized bytes. Accepts the string values of `'utf8'` and `'base64'`.
            Defaults to `'utf8'`.

            - `'utf8'` will serialize bytes to UTF-8 strings.
            - `'base64'` will serialize bytes to base64 strings.
        validate_default: Whether to validate default values during validation. Defaults to `False`.
        protected_namespaces: A `tuple` of strings that prevent model to have field which conflict with them.
            Defaults to `('model_', )`).

            See [Protected Namespaces](../usage/model_config.md#protected-namespaces) for details.
        hide_input_in_errors: Whether to hide inputs when printing errors. Defaults to `False`.

            See [Hide Input in Errors](../usage/model_config.md#hide-input-in-errors).
    z
str | NonetitleboolZstr_to_lowerZstr_to_upperZstr_strip_whitespaceintZstr_min_lengthz
int | NoneZstr_max_lengthzExtraValues | NoneextrafrozenZpopulate_by_nameZuse_enum_valuesZvalidate_assignmentZarbitrary_types_allowedZfrom_attributesZloc_by_aliaszCallable[[str], str] | NoneZalias_generatorztuple[type, ...]Zignored_typesZallow_inf_nanz2dict[str, object] | JsonSchemaExtraCallable | NoneZjson_schema_extrastrictz2Literal[('always', 'never', 'subclass-instances')]Zrevalidate_instanceszLiteral[('iso8601', 'float')]Zser_json_timedeltazLiteral[('utf8', 'base64')]Zser_json_bytesZvalidate_defaultZvalidate_returnztuple[str, ...]Zprotected_namespacesZhide_input_in_errorsN)r   r   r   __doc__r)   r   r   r   r   r   2   s6   
Rr   F)totalN)r1   
__future__r   Z_annotationstypingr   r   r   r   warningsr   typing_extensionsr   r	   r
   Z
_migrationr   Zdeprecated.configr   r   r%   __all__r   r   r   ZExtraValuesr   r   __getattr__r   r   r   r   <module>   s    
w