a
    h@                     @  s  U d Z ddlmZ ddlZddlmZ ddlmZm	Z	m
Z
mZmZmZmZmZ ddlmZmZmZmZ ddlmZ dd	lmZ dd
lmZ ddlmZ erddlmZ ddlm Z m!Z! dZ"ee#e$e%e&de'd df Z(de)d< e*e%e(f Z+de)d< e
e	ge	f Z,ee
e+gdf e
e+e-e	 gdf f Z.de)d< ed Z/G dd deddZ0ede-dZ1eeddddddZ2edddddZ2ed ddd!dZ2d&d"d#dd$d%dZ2ee3Z4dS )'z"Configuration for Pydantic models.    )annotationsN)Pattern)TYPE_CHECKINGAnyCallableLiteralTypeVarUnioncastoverload)	TypeAlias	TypedDictUnpack
deprecated   )getattr_migration)AliasGenerator)PydanticUserError)PydanticDeprecatedSince211)GenerateSchema)ComputedFieldInfo	FieldInfo)
ConfigDictwith_config	JsonValueJsonDictr   JsonSchemaExtraCallable)ZallowignoreZforbidc                   @  sr  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*ed+< ded,< ded-< d.ed/< ded0< ded1< d2ed3< d4ed5< ded6< d7ed8< ded9< d:ed;< ded<< ded=< d>ed?< ded@< dedA< dedB< dCS )Dr   z/A TypedDict for configuring Pydantic behaviour.z
str | NonetitlezCallable[[type], str] | NoneZmodel_title_generatorz:Callable[[str, FieldInfo | ComputedFieldInfo], str] | NoneZfield_title_generator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] | AliasGenerator | NoneZalias_generatorztuple[type, ...]Zignored_typesZallow_inf_nanz)JsonDict | JsonSchemaExtraCallable | NoneZjson_schema_extraz&dict[type[object], JsonEncoder] | NoneZjson_encodersstrictz0Literal['always', 'never', 'subclass-instances']Zrevalidate_instanceszLiteral['iso8601', 'float']Zser_json_timedeltaz Literal['utf8', 'base64', 'hex']Zser_json_bytesZval_json_bytesz'Literal['null', 'constants', 'strings']Zser_json_inf_nanZvalidate_defaultZvalidate_returnztuple[str | Pattern[str], ...]Zprotected_namespacesZhide_input_in_errorsZdefer_buildzdict[str, object] | NoneZplugin_settingsztype[_GenerateSchema] | NoneZschema_generatorZ+json_schema_serialization_defaults_requiredz,Literal['validation', 'serialization', None]Zjson_schema_mode_overrideZcoerce_numbers_to_strz"Literal['rust-regex', 'python-re']Zregex_engineZvalidation_error_causeZuse_attribute_docstringsz%bool | Literal['all', 'keys', 'none']Zcache_stringsZvalidate_by_aliasZvalidate_by_nameZserialize_by_aliasN)__name__
__module____qualname____doc____annotations__ r)   r)   K/var/www/html/assistant/venv/lib/python3.9/site-packages/pydantic/config.pyr   $   s\   
_
''47;y	


^,
'7&%($(r   F)total_TypeT)boundzePassing `config` as a keyword argument is deprecated. Pass `config` as a positional argument instead.zCallable[[_TypeT], _TypeT])configreturnc                 C  s   d S Nr)   r.   r)   r)   r*   r   x  s    r   c                C  s   d S r0   r)   r1   r)   r)   r*   r   }  s    zUnpack[ConfigDict]c                  K  s   d S r0   r)   r1   r)   r)   r*   r     s    zConfigDict | Noner   )r.   kwargsr/   c                  s|   | dur|rt dt|dkrN|d }durNtjdtdd tt| n| durZ| ntt| ddd	 fd
d}|S )a-  !!! abstract "Usage Documentation"
        [Configuration with other types](../concepts/config.md#configuration-on-other-supported-types)

    A convenience decorator to set a [Pydantic configuration](config.md) on a `TypedDict` or a `dataclass` from the standard library.

    Although the configuration can be set using the `__pydantic_config__` attribute, it does not play well with type checkers,
    especially with `TypedDict`.

    !!! example "Usage"

        ```python
        from typing_extensions import TypedDict

        from pydantic import ConfigDict, TypeAdapter, with_config

        @with_config(ConfigDict(str_to_lower=True))
        class TD(TypedDict):
            x: str

        ta = TypeAdapter(TD)

        print(ta.validate_python({'x': 'ABC'}))
        #> {'x': 'abc'}
        ```
    Nz2Cannot specify both `config` and keyword argumentsr   r.   zdPassing `config` as a keyword argument is deprecated. Pass `config` as a positional argument instead   )category
stacklevelr,   )class_r/   c                  s4   ddl m} || r*td| j ddd | _| S )Nr   )is_model_classzCannot use `with_config` on z as it is a Pydantic modelzwith-config-on-model)code)Z_internal._utilsr7   r   r$   Z__pydantic_config__)r6   r7   Zfinal_configr)   r*   inner  s    zwith_config.<locals>.inner)
ValueErrorlengetwarningswarnr   r
   r   )r.   r2   Zkwargs_confr:   r)   r9   r*   r     s    )N)5r'   
__future__r   Z_annotationsr>   rer   typingr   r   r   r   r   r	   r
   r   Ztyping_extensionsr   r   r   r   Z
_migrationr   aliasesr   errorsr   r   Z_internal._generate_schemar   Z_GenerateSchemafieldsr   r   __all__r    floatstrr   listr   r(   dictr   ZJsonEncodertyper   ZExtraValuesr   r,   r   r$   __getattr__r)   r)   r)   r*   <module>   sR   ("        Y8