U
    PÈÞf‹  ã                   @  sL  U d 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 ddlmZ ddlmZ ddlmZ er’d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�Z(ede)d�Z*dddœdd„Z+ee,ƒZ-dS )z"Configuration for Pydantic models.é    )Úannotations)ÚTYPE_CHECKINGÚAnyÚCallableÚDictÚListÚTypeÚTypeVarÚUnion)ÚLiteralÚ	TypeAliasÚ	TypedDicté   )Úgetattr_migration)ÚAliasGenerator)ÚPydanticUserError)ÚGenerateSchema)ÚComputedFieldInfoÚ	FieldInfo)Ú
ConfigDictÚwith_configNÚ	JsonValueÚJsonDictr   ÚJsonSchemaExtraCallable)ZallowÚignoreZforbidc                   @  sb  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< d6ed7< ded8< d9ed:< ded;< d<ed=< ded>< ded?< d@edA< dBS )Cr   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Ústrictz2Literal[('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, ...]Zprotected_namespacesZhide_input_in_errorsZdefer_buildz.tuple[Literal[('model', 'type_adapter')], ...]Zexperimental_defer_build_modez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_stringsN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú__annotations__© r&   r&   úI/var/www/html/chatgpt/venv/lib/python3.8/site-packages/pydantic/config.pyr   !   sX   
G
!(47;	


L,
'7&%&r   F)ÚtotalÚ_TypeT)ÚboundzCallable[[_TypeT], _TypeT])ÚconfigÚreturnc                   s   dddœ‡ fdd„}|S )a$  Usage docs: https://docs.pydantic.dev/2.9/concepts/config/#configuration-with-dataclass-from-the-standard-library-or-typeddict

    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"

        ```py
        from typing_extensions import TypedDict

        from pydantic import ConfigDict, TypeAdapter, with_config

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

        ta = TypeAdapter(Model)

        print(ta.validate_python({'x': 'ABC'}))
        #> {'x': 'abc'}
        ```
    r)   )Ú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._utilsr.   r   r!   Z__pydantic_config__)r-   r.   ©r+   r&   r'   Úinner  s    þzwith_config.<locals>.innerr&   )r+   r1   r&   r0   r'   r   û  s    r   ).r$   Ú
__future__r   Z_annotationsÚtypingr   r   r   r   r   r   r	   r
   Ztyping_extensionsr   r   r   Z
_migrationr   Úaliasesr   Úerrorsr   Z_internal._generate_schemar   Z_GenerateSchemaÚfieldsr   r   Ú__all__r   ÚfloatÚstrr   r   r%   r   ZJsonEncoderr   ZExtraValuesr   Útyper)   r   r!   Ú__getattr__r&   r&   r&   r'   Ú<module>   s<   ("ÿÿ       ^+