o
    ¨Ýj`®  ã                   @  s¢  U d Z ddlmZ ddlZddlm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 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,gdf ee,e.e gdf B Z/de*d< ed Z0G dd„ dedd�Z1ede.d�Z2eedƒd(dd „ƒƒZ3ed(d!d „ƒZ3ed)d#d „ƒZ3d*d+d'd „Z3ee4ƒZ5dS ),z"Configuration for Pydantic models.é    )ÚannotationsN)ÚCallable)ÚPattern)ÚTYPE_CHECKINGÚAnyÚLiteralÚ	TypeAliasÚTypeVarÚUnionÚcastÚoverload)Ú	TypedDictÚUnpackÚ
deprecatedé   )Úgetattr_migration)ÚAliasGenerator)ÚPydanticUserError)ÚPydanticDeprecatedSince211)ÚGenerateSchema)ÚComputedFieldInfoÚ	FieldInfo)Ú
ConfigDictÚwith_configÚ	JsonValueÚJsonDictr   ÚJsonSchemaExtraCallable)ZallowÚignoreZforbidc                   @  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+ed,< 	 d+ed-< 	 d.ed/< 	 ded0< 	 ded1< 	 d2ed3< 	 ded4< 	 ded5< 	 d6ed7< 	 d8ed9< 	 ded:< 	 d;ed<< 	 ded=< 	 d>ed?< 	 ded@< 	 dedA< 	 dBedC< 	 dedD< 	 dedE< 	 dedF< 	 dedG< 	 dedH< dIS )Jr   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['iso8601', 'seconds', 'milliseconds']Zser_json_temporalz+Literal['seconds', 'milliseconds', 'infer']Zval_temporal_unitz 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_aliasZurl_preserve_empty_pathZpolymorphic_serializationN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú__annotations__© r)   r)   úJ/var/www/html/chatgpt/venv/lib/python3.10/site-packages/pydantic/config.pyr   "   sÄ   
 s	&%36:
G		]+	)9%&($&!r   F)ÚtotalÚ_TypeT)ÚboundzePassing `config` as a keyword argument is deprecated. Pass `config` as a positional argument instead.ÚconfigÚreturnúCallable[[_TypeT], _TypeT]c                 C  ó   d S ©Nr)   ©r.   r)   r)   r*   r   Â  s   r   c                C  r1   r2   r)   r3   r)   r)   r*   r   Ç  ó   úUnpack[ConfigDict]c                  K  r1   r2   r)   r3   r)   r)   r*   r   Ë  r4   úConfigDict | NoneÚkwargsr   c                  sv   | dur
|r
t dƒ‚t|ƒdkr'| d¡ }dur'tjdtdd� tt|ƒ‰ n| dur-| ntt|ƒ‰ 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'}
        ```

    /// deprecated-removed | v2.11 v3
    Passing `config` as a keyword argument.
    ///

    /// version-changed | v2.11
    Keyword arguments can be provided directly instead of a config dictionary.
    ///
    Nz2Cannot specify both `config` and keyword argumentsr   r.   zdPassing `config` as a keyword argument is deprecated. Pass `config` as a positional argument insteadé   )ÚcategoryÚ
stacklevelÚclass_r,   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<   ©Zfinal_configr)   r*   Úinnerþ  s   þzwith_config.<locals>.inner)r;   r,   r/   r,   )Ú
ValueErrorÚlenÚgetÚwarningsÚwarnr   r   r   )r.   r7   Zkwargs_confr?   r)   r>   r*   r   Ï  s   "ý)r.   r   r/   r0   )r.   r5   r/   r0   r2   )r.   r6   r7   r   r/   r0   )6r'   Ú
__future__r   Z_annotationsrC   Úcollections.abcr   Úrer   Útypingr   r   r   r   r	   r
   r   r   Ztyping_extensionsr   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>   sP    ("*         &@