o
    í6Wjõ­  ã                   @  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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�Z0ede-d�Z1eedƒd'dd„ƒƒZ2ed'd d„ƒZ2ed(d"d„ƒZ2d)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)ÚallowÚignoreÚ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] | NoneÚmodel_title_generatorz:Callable[[str, FieldInfo | ComputedFieldInfo], str] | NoneÚfield_title_generatorÚboolÚstr_to_lowerÚstr_to_upperÚstr_strip_whitespaceÚintÚstr_min_lengthz
int | NoneÚstr_max_lengthzExtraValues | NoneÚextraÚfrozenÚpopulate_by_nameÚuse_enum_valuesÚvalidate_assignmentÚarbitrary_types_allowedÚfrom_attributesÚloc_by_aliasz,Callable[[str], str] | AliasGenerator | NoneÚalias_generatorztuple[type, ...]Úignored_typesÚallow_inf_nanz)JsonDict | JsonSchemaExtraCallable | NoneÚjson_schema_extraz&dict[type[object], JsonEncoder] | NoneÚjson_encodersÚstrictz0Literal['always', 'never', 'subclass-instances']Úrevalidate_instanceszLiteral['iso8601', 'float']Úser_json_timedeltaz-Literal['iso8601', 'seconds', 'milliseconds']Úser_json_temporalz+Literal['seconds', 'milliseconds', 'infer']Úval_temporal_unitz Literal['utf8', 'base64', 'hex']Úser_json_bytesÚval_json_bytesz'Literal['null', 'constants', 'strings']Úser_json_inf_nanÚvalidate_defaultÚvalidate_returnztuple[str | Pattern[str], ...]Úprotected_namespacesÚhide_input_in_errorsÚdefer_buildzdict[str, object] | NoneÚplugin_settingsztype[_GenerateSchema] | NoneÚschema_generatorÚ+json_schema_serialization_defaults_requiredz,Literal['validation', 'serialization', None]Újson_schema_mode_overrideÚcoerce_numbers_to_strz"Literal['rust-regex', 'python-re']Úregex_engineÚvalidation_error_causeÚuse_attribute_docstringsz%bool | Literal['all', 'keys', 'none']Úcache_stringsÚvalidate_by_aliasÚvalidate_by_nameÚserialize_by_aliasÚurl_preserve_empty_pathÚpolymorphic_serializationN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú__annotations__© rW   rW   ú^/home/esfera/Documents/content_generation/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 ©NrW   ©r\   rW   rW   rX   r   Ã  s   r   c                C  r_   r`   rW   ra   rW   rW   rX   r   È  ó   úUnpack[ConfigDict]c                  K  r_   r`   rW   ra   rW   rW   rX   r   Ì  rb   ú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_rZ   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)Ú_internal._utilsrj   r   rR   Ú__pydantic_config__)ri   rj   ©Úfinal_configrW   rX   Úinnerÿ  s   þzwith_config.<locals>.inner)ri   rZ   r]   rZ   )Ú
ValueErrorÚlenÚgetÚwarningsÚwarnr   r
   r   )r\   re   Úkwargs_confrp   rW   rn   rX   r   Ð  s   "ý)r\   r   r]   r^   )r\   rc   r]   r^   r`   )r\   rd   re   r   r]   r^   )5rU   Ú
__future__r   Ú_annotationsrt   Úrer   Útypingr   r   r   r   r   r	   r
   r   Útyping_extensionsr   r   r   r   Ú
_migrationr   Úaliasesr   Úerrorsr   r   Ú_internal._generate_schemar   Ú_GenerateSchemaÚfieldsr   r   Ú__all__r'   ÚfloatÚstrr#   Úlistr   rV   Údictr   ÚJsonEncoderÚtyper   ÚExtraValuesr   rZ   r   rR   Ú__getattr__rW   rW   rW   rX   Ú<module>   sV    ("ÿÿ         %@