o
    ¨Ýj7�  ã                   @  sÜ  d Z ddlmZ ddlZddlZddlZddlZddlZddl	m
Z
 ddlmZmZ ddlmZmZmZ ddlmZ ddlmZmZmZmZmZmZmZ dd	lmZmZ dd
lmZm Z m!Z! ddl"m#Z#m$Z$ ddl%m&Z& ddlm'Z'm(Z( ddl)m*Z* ddl+m,Z,m-Z-m.Z.m/Z/ ddl0m1Z1m2Z2m3Z3m4Z4m5Z5 ddl6m7Z7m8Z8 ddl9m:Z:m;Z; ddl<m=Z=m>Z> ddl?m@Z@ ddlAmBZB ddlCmDZD ddlEmFZF ddlGmHZHmIZI erïddlJmKZL ddlJmMZMmNZN ddlJmOZP ddlQmRZR ddl0mSZS neTƒ ZLeTƒ ZPeTjUZVG d d!„ d!eWƒZXd"d#œdid(d)„ZYed*ƒZZe d+eLePeYfd,�G d-d.„ d.e
ƒƒZ[djd3d4„Z\dkd:d;„Z]dldAdB„Z^dmdEdF„Z_dndGdH„Z`	dodpdOdP„Zad+d+dd"dQœdqdXdY„ZbdrdZd[„ZcG d\d]„ d]ƒZdG d^d_„ d_ƒZedsdcdd„Zfdtdedf„Zgedudgdh„ƒZhdS )vz"Private logic for creating models.é    )ÚannotationsN)ÚABCMeta)ÚCallableÚMutableMapping)ÚcacheÚpartialÚwraps)ÚFunctionType)ÚTYPE_CHECKINGÚAnyÚGenericÚLiteralÚNoReturnÚTypeVarÚcast)ÚPydanticUndefinedÚSchemaSerializer)ÚTypeAliasTypeÚdataclass_transformÚ
deprecatedé   )ÚPydanticUndefinedAnnotationÚPydanticUserError)Úcreate_schema_validator)ÚGenericBeforeBaseModelWarningÚPydanticDeprecatedSince20é   )ÚConfigWrapper)ÚDecoratorInfosÚPydanticDescriptorProxyÚget_attribute_from_basesÚunwrap_wrapped_function)ÚModelNamespaceInfoÚcollect_model_fieldsÚis_valid_field_nameÚis_valid_privateattr_nameÚrebuild_model_fields)ÚGenerateSchemaÚInvalidSchemaError)ÚPydanticGenericMetadataÚget_model_typevars_map)Úimport_cached_base_modelÚimport_cached_field_info)Úset_model_mocks)Ú
NsResolver)Úgenerate_pydantic_signature)Úparent_frame_namespace)ÚLazyClassAttributeÚSafeGetItemProxy)ÚField)Ú	FieldInfoÚModelPrivateAttr)ÚPrivateAttr)Ú	BaseModel)ÚPydanticExtraInfoc                      s"   e Zd ZdZd
‡ fdd	„Z‡  ZS )Ú_ModelNamespaceDictz{A dictionary subclass that intercepts attribute setting on model classes and
    warns about overriding of decorators.
    ÚkÚstrÚvÚobjectÚreturnÚNonec                   sP   |   |d ¡}|r!||ur!t|tƒr!tjd|› d|jj› d�dd� tƒ  ||¡S )Nú`z"` overrides an existing Pydantic `z` decoratorr   ©Ú
stacklevel)	ÚgetÚ
isinstancer   ÚwarningsÚwarnZdecorator_infoZdecorator_reprÚsuperÚ__setitem__)Úselfr:   r<   Úexisting©Ú	__class__© úa/var/www/html/chatgpt/venv/lib/python3.10/site-packages/pydantic/_internal/_model_construction.pyrH   >   s   þz_ModelNamespaceDict.__setitem__)r:   r;   r<   r=   r>   r?   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__rH   Ú__classcell__rM   rM   rK   rN   r9   9   s    r9   F©ÚinitrU   úLiteral[False]r>   r   c                 C  ó   dS )zÍOnly for typing purposes. Used as default value of `__pydantic_fields_set__`,
    `__pydantic_extra__`, `__pydantic_private__`, so they could be ignored when
    synthesizing the `__init__` signature.
    NrM   rT   rM   rM   rN   ÚNoInitFieldI   ó    rX   Ú_TT)Zkw_only_defaultZfield_specifiersc                      s    e Zd Z			d-d.‡ fdd„Zesd/dd„Zed0dd„ƒZd1‡ fdd„Ze	j
Z
e	jZed2d!d"„ƒZeed#dd$�d3d&d'„ƒƒZed4d(d)„ƒZd5‡ fd+d,„Z‡  ZS )6ÚModelMetaclassNTÚcls_namer;   Úbasesútuple[type[Any], ...]Ú	namespaceúdict[str, Any]Ú__pydantic_generic_metadata__úPydanticGenericMetadata | NoneÚ#__pydantic_reset_parent_namespace__ÚboolÚ_create_model_moduleú
str | NoneÚkwargsr   r>   Útypec                   s²  |�r¸|   |¡\}}	}
t |||¡}t||j||	d�}|j}|j|d< |	|d< i |
¥|¥|d< tdtƒ j	| |||fi |¤Žƒ}t
ƒ }|j}t|v r\| t¡| |¡k r\tjtdƒdd� t|jd	d
ƒ |_i |_tj|dd�|_|j |¡ |r|||_nžt|di ƒ dd¡‰t|ddƒp�ˆ‰ˆ�rˆ�rt‡fdd„ˆD ƒƒ�sddlm} t‡fdd„ˆD ƒƒ}|ˆv r×|ˆvr×d dd„ |D ƒ¡}|j › d|› d|j › d|› d�}t!|ƒ‚ˆ| }d dd„ |D ƒ¡}d|› d�}d |› d!�}t|v�rd d"d„ |D ƒ|g ¡}|d#|j › d$|› d%�7 }t!|ƒ‚ddˆd&œ|_d
|_"| #¡ D ]\}}| $||¡ �q!|�r6t%t&ƒ ƒ|_'t|d'dƒ}t(|t)ƒ�rFt*|ƒ}t+|d(�}t,||||d)� |j-�rst.||ƒ‰ ˆ du�rpt/ˆ ƒd9‡ fd0d1„ƒ}||_0nt1|_0|j0|j0u �r|dnd2|_2d3d4„ |jj3 #¡ D ƒ|_4|j5�r”t6|ƒ n	t7|||d
|d5� |j8�r«d6|v�r«t9||ƒ t||ƒj:di |¤Ž |S d7D ]	}| ;|d¡ �qº| d8i ¡ <¡  tƒ j	| |||fi |¤ŽS ):a…  Metaclass for creating Pydantic models.

        Args:
            cls_name: The name of the class to be created.
            bases: The base classes of the class to be created.
            namespace: The attribute dictionary of the class to be created.
            __pydantic_generic_metadata__: Metadata for generic models.
            __pydantic_reset_parent_namespace__: Reset parent namespace.
            _create_model_module: The module of the class to be created, if created by `create_model`.
            **kwargs: Catch-all for any other keyword arguments.

        Returns:
            The new class created by the metaclass.
        )Úbase_class_fieldsÚbase_class_varsÚmodel_configÚ__class_vars__Ú__private_attributes__útype[BaseModel]z�Classes should inherit from `BaseModel` before generic classes (e.g. `typing.Generic[T]`) for pydantic generics to work properly.r   rA   Z__pydantic_base_init__FT)Zreplace_wrapped_methodsra   Ú
parametersrM   Ú__parameters__Nc                 3  s   � | ]}|ˆ v V  qd S ©NrM   ©Ú.0Úx)ro   rM   rN   Ú	<genexpr>Ÿ   s   € z)ModelMetaclass.__new__.<locals>.<genexpr>)ÚRootModelRootTypec                 3  s   � | ]	}|ˆ vr|V  qd S rq   rM   rr   )Úparent_parametersrM   rN   ru   ¢   s   € z, c                 S  ó   g | ]}|j ‘qS rM   ©rO   rr   rM   rM   rN   Ú
<listcomp>«   ó    z*ModelMetaclass.__new__.<locals>.<listcomp>zS is a subclass of `RootModel`, but does not include the generic type identifier(s) zL in its parameters. You should parametrize RootModel directly, e.g., `class z(RootModel[z	]): ...`.c                 S  s   g | ]}t |ƒ‘qS rM   )r;   rr   rM   rM   rN   rz   ³   s    ztyping.Generic[ú]zJAll parameters must be present on typing.Generic; you should inherit from Ú.c                 S  rx   rM   ry   rr   rM   rM   rN   rz   ¾   r{   z- Note: `typing.Generic` must go last: `class ú(z): ...`))ÚoriginÚargsro   Ú__pydantic_parent_namespace__)Úparent_namespace)Úconfig_wrapperÚns_resolverÚnamespace_inforI   r7   Úcontextr   r>   r?   c                  s   t | |ƒ ˆ | |ƒ dS )z�We need to both initialize private attributes and call the user-defined model_post_init
                        method.
                        N)Úinit_private_attributes)rI   r†   )Úoriginal_model_post_initrM   rN   Úwrapped_model_post_initâ   s   
z7ModelMetaclass.__new__.<locals>.wrapped_model_post_initÚmodel_post_initc                 S  ó   i | ]\}}||j “qS rM   ©Úinfo©rs   r:   r<   rM   rM   rN   Ú
<dictcomp>ô   s    ÿz*ModelMetaclass.__new__.<locals>.<dictcomp>)Úraise_errorsÚcreate_model_moduleÚ__hash__)Z__pydantic_fields_set__Ú__pydantic_extra__Ú__pydantic_private__Ú__annotations__©rI   r7   r†   r   r>   r?   )=Ú_collect_bases_datar   Z	for_modelÚinspect_namespaceÚignored_typesÚprivate_attributesZconfig_dictr   rG   Ú__new__r+   Ú__mro__r   ÚindexrE   rF   r   ÚgetattrÚ__init__Z__pydantic_custom_init__Z__pydantic_setattr_handlers__r   ÚbuildÚ__pydantic_decorators__Zupdate_from_configra   rC   ÚallZ
root_modelrv   ÚtupleÚjoinrO   Ú	TypeErrorÚ__pydantic_complete__ÚitemsÚ__set_name__Úbuild_lenient_weakvaluedictr0   r�   rD   ÚdictÚunpack_lenient_weakvaluedictr.   Úset_model_fieldsrm   Úget_model_post_initr   rŠ   r‡   Z__pydantic_post_init__Úcomputed_fieldsÚ__pydantic_computed_fields__Zdefer_buildr-   Úcomplete_model_classÚfrozenÚset_default_hash_funcZ__pydantic_init_subclass__ÚpopÚclear)Úmcsr\   r]   r_   ra   rc   re   rg   Úbase_field_namesÚ
class_varsZbase_private_attributesrƒ   r…   rš   ÚclsZ
BaseModel_Úmrorv   Zmissing_parametersZparameters_strÚerror_messageZcombined_parametersZgeneric_type_labelZ	bases_strÚnameÚobjr‚   r„   r‰   Zinstance_slotrK   )rˆ   ro   rw   rN   r›   Y   sÐ   ü
 ÿû$ÿþþÿðÿÿ
ÿý


ÿ
ÿ
û
þzModelMetaclass.__new__Úitemc                 C  s(   | j  d¡}|r||v r|| S t|ƒ‚)zNThis is necessary to keep attribute access working for class attribute access.rm   )Ú__dict__rC   ÚAttributeError)rI   r½   rš   rM   rM   rN   Ú__getattr__  s   zModelMetaclass.__getattr__r€   údict[str, object]c                 O  s   t ƒ S rq   )r9   )r¸   r€   rg   rM   rM   rN   Ú__prepare__!  s   zModelMetaclass.__prepare__Úsubclassútype[_T]c                   s$   t jd| j› d�dd� tƒ  |¡S )Nz>For performance reasons, virtual subclasses registered using 'zK.register()' are not supported in 'isinstance()' and 'issubclass()' checks.r   rA   )rE   rF   rQ   rG   Úregister)rI   rÃ   rK   rM   rN   rÅ   )  s
   ýzModelMetaclass.registerú6tuple[set[str], set[str], dict[str, ModelPrivateAttr]]c                 C  sj   t ƒ }tƒ }tƒ }i }| D ]"}t||ƒr/||ur/| t|di ƒ ¡ ¡ | |j¡ | |j¡ q|||fS )NÚ__pydantic_fields__)r+   ÚsetÚ
issubclassÚupdaterž   Úkeysrl   rm   )r]   r7   Úfield_namesr·   rš   ÚbaserM   rM   rN   r—   4  s   €
z"ModelMetaclass._collect_bases_dataúXThe `__fields__` attribute is deprecated, use the `model_fields` class property instead.)Úcategoryúdict[str, FieldInfo]c                 C  s   t jdtdd� t| di ƒS )NrÎ   r   rA   rÇ   )rE   rF   r   rž   ©rI   rM   rM   rN   Ú
__fields__C  s   ýzModelMetaclass.__fields__c                 C  sT   d| j vrdS td| jƒ}td| jƒ}|dur|j}nd}tdd„ | ¡ D ƒƒo)|S )	z²Whether the fields were successfully collected (i.e. type hints were successfully resolved).

        This is a private attribute, not meant to be used outside Pydantic.
        rÇ   FrÐ   zPydanticExtraInfo | NoneNTc                 s  s   � | ]}|j V  qd S rq   )Z	_complete)rs   Ú
field_inforM   rM   rN   ru   `  s   € z>ModelMetaclass.__pydantic_fields_complete__.<locals>.<genexpr>)r¾   r   rÇ   Ú__pydantic_extra_info__Zcompleter¢   Úvalues)rI   Zfield_infosÚpydantic_extra_infoZextra_completerM   rM   rN   Ú__pydantic_fields_complete__O  s   
z+ModelMetaclass.__pydantic_fields_complete__ú	list[str]c                   s$   t tƒ  ¡ ƒ}d|v r| d¡ |S )NrÒ   )ÚlistrG   Ú__dir__Úremove)rI   Ú
attributesrK   rM   rN   rÚ   b  s   
zModelMetaclass.__dir__)NTN)r\   r;   r]   r^   r_   r`   ra   rb   rc   rd   re   rf   rg   r   r>   rh   )r½   r;   r>   r   )r€   r   rg   r   r>   rÁ   )rÃ   rÄ   r>   rÄ   )r]   r^   r>   rÆ   )r>   rÐ   )r>   rd   )r>   rØ   )rO   rP   rQ   r›   r
   rÀ   ÚclassmethodrÂ   rÅ   rh   Ú__instancecheck__Ú__subclasscheck__Ústaticmethodr—   Úpropertyr   rÒ   r×   rÚ   rS   rM   rM   rK   rN   r[   W   s.    ù ?
ÿr[   rI   r7   r†   r?   c                C  sx   t | ddƒdu r:i }| j ¡ D ]"\}}|jr#|jdi | j¥|¥d�}n|jdd�}|tur1|||< qt| d|ƒ dS dS )a  This function is meant to behave like a BaseModel method to initialize private attributes.

    It takes context as an argument since that's what pydantic-core passes when calling it.

    Args:
        self: The BaseModel instance.
        context: The context.
    r”   NT)Úcall_default_factoryZvalidated_data)râ   )rž   rm   r§   Z$default_factory_takes_validated_dataÚget_defaultr¾   r   Úobject_setattr)rI   r†   Zpydantic_privater»   Zprivate_attrÚdefaultrM   rM   rN   r‡   i  s   	ÿ€ôr‡   r_   r`   r]   r^   úCallable[..., Any] | Nonec                 C  s2   d| v r| d S t ƒ }t|dƒ}||jur|S dS )zaGet the `model_post_init` method from the namespace or the class bases, or `None` if not defined.rŠ   N)r+   r    rŠ   )r_   r]   r7   rŠ   rM   rM   rN   r­   �  s   

ÿr­   r™   rj   úset[str]ri   r"   c             
   C  s¶  ddl m} tƒ }|tƒ  }i }tƒ }g }	g }
d| v r!tddd�‚|  ¡ D ]�\}}|dks1|dkr2q%t|tƒrN|j	| d	 krNd
| v rN|j
 | d
 › d�¡rNq%t||ƒsY|jj	dkr_| |¡ q%t||ƒr‹| d¡rstd|›d�dd�‚t|ƒr†tdd| ›d|›d�dd�‚|||< q%t||ƒr¨t|ƒs¨| d¡pšd}td|›d|›d�dd�‚| d¡r®q%t|ƒr¸|	 |¡ q%||v r½q%|
 |¡ q%|D ]}| |= qÅt||||	|
||  d¡dud�S )a=  Inspect the namespace prior to class creation.

    Most of the collected information is then used by `collect_model_fields()` to perform checks.

    Args:
        namespace: The attribute dictionary of the class to be created.
        ignored_types: Tuple of ignore types.
        base_class_vars: The set of base class variables.
        base_class_fields: The set of base class fields.

    Returns:
        A `ModelNamespaceInfo` instance.

    Raises:
        PydanticUserError: If there is a `__root__` field in model, or if a private attribute name is invalid.
    r   )r5   Z__root__zUTo define root models, use `pydantic.RootModel` rather than a field called '__root__'N)Úcoderk   r“   rP   rQ   r}   Ú	functoolsÚ__zXPrivate attributes must not use dunder names; use a single underscore prefix instead of zJPrivate attributes must not use valid field names; use sunder names, e.g. Ú_z instead of Zmy_fieldz>Fields must not use names with leading underscores; e.g., use )rš   Úignored_namesr™   Úprivate_candidatesÚfield_candidatesr¶   Zmodel_config_assigned)Úfieldsr5   r,   Údefault_ignored_typesrÈ   r   r§   rD   rh   rP   rQ   Ú
startswithrL   Úaddr$   Úlstripr%   Úappendr"   rC   )r_   r™   rj   ri   r5   r4   Zall_ignored_typesrš   rì   rí   rî   Úvar_nameÚvalueZsuggested_namerM   rM   rN   r˜   �  sŒ   
ÿÿÿ


ÿýÿÿý
ÿÿý
ùr˜   r¸   rn   c                 C  s@   t |dƒ}t| ƒ}|d tjhv st|dd ƒ|jkr|| _d S d S )Nr’   Ú__code__)r    Úmake_hash_funcr=   r’   rž   r÷   )r¸   r]   Zbase_hash_funcZnew_hash_funcrM   rM   rN   r²   ó  s
   
 
ùr²   c                   s0   | j rtj| j  ¡ Ž ndd„ ‰ d	‡ fdd„}|S )
Nc                 S  rW   )Nr   rM   )rë   rM   rM   rN   Ú<lambda>  rY   z make_hash_func.<locals>.<lambda>rI   r   r>   Úintc                   s6   zt ˆ | jƒƒW S  ty   t ˆ t| jƒƒƒ Y S w rq   )Úhashr¾   ÚKeyErrorr2   rÑ   ©ÚgetterrM   rN   Ú	hash_func  s
   ûz!make_hash_func.<locals>.hash_func)rI   r   r>   rú   )rÇ   ÚoperatorÚ
itemgetterrË   )r¸   rÿ   rM   rý   rN   rø      s   
rø   rƒ   r   r„   r.   r…   úModelNamespaceInfo | Nonec                 C  s‚   t | ƒ}t| ||||d�\}}}}|| _|| _| j |¡ | j |¡ |D ]}	| j |	d¡}
|
dur>|
jt	ur>t
| |	|
jƒ q%dS )a}  Collect and set `cls.__pydantic_fields__`, `cls.__class_vars__` and `cls.__private_attributes__`.

    Args:
        cls: BaseModel or dataclass.
        config_wrapper: The config wrapper instance.
        ns_resolver: Namespace resolver to use when getting model annotations.
        namespace_info: The result of inspecting the class namespace before the class was created.
    )Útypevars_mapr…   N)r*   r#   rÇ   rÔ   rl   rÊ   rm   r³   rå   r   Úsetattr)r¸   rƒ   r„   r…   r  rï   rÖ   r·   rš   r:   rö   rM   rM   rN   r¬     s   
ÿ€úr¬   )r�   Úcall_on_complete_hookr‘   Úis_force_rebuildr�   rd   r  r‘   rf   r  c             
   C  sà  t | ƒ}| jsOzt| |||d�\| _| _W n- tyB } z!t |¡}	t| |	j	dur0d|	j	› d�ndƒ |r8|	|‚W Y d}~nd}~ww |sJ| jsJdS | jsOJ ‚t
|||ƒ}
z|
 | ¡}W n' tyƒ } z|rg‚ t| |j	durud|j	› d�ndƒ W Y d}~dS d}~ww |j| jd�}z|
 |¡}W n ty    t| ƒ Y dS w dd„ | jj ¡ D ƒ| _t| ƒ || _t|| |p»| j| j|rÁdnd	||j| d
�| _t||| d
�| _tdtt| j | j|j!|j"d�ƒ| _#d| _$|rî|  %¡  dS )aó  Finish building a model class.

    This logic must be called after class has been created since validation functions must be bound
    and `get_type_hints` requires a class object.

    Args:
        cls: BaseModel or dataclass.
        config_wrapper: The config wrapper instance.
        ns_resolver: The namespace resolver instance to use during schema building.
        raise_errors: Whether to raise errors.
        call_on_complete_hook: Whether to call the `__pydantic_on_complete__` hook.
        create_model_module: The module of the class to be created, if created by `create_model`.
        is_force_rebuild: Whether the model is being force-rebuilt (if True, pre-built serializers and
            validators are not used, to avoid stale references).

    Returns:
        `True` if the model is successfully completed, else `False`.

    Raises:
        PydanticUndefinedAnnotation: If `PydanticUndefinedAnnotation` occurs during core schema generation
            and `raise_errors` is True.
    )rƒ   r„   r  Nr@   F)Útitlec                 S  r‹   rM   rŒ   rŽ   rM   rM   rN   r�   …  s    z(complete_model_class.<locals>.<dictcomp>Zcreate_modelr7   )Z_use_prebuiltÚ__signature__)rU   rï   Úvalidate_by_aliasÚextraT)&r*   r×   r&   rÇ   rÔ   Ú	NameErrorr   Zfrom_name_errorr-   r»   r'   Zgenerate_schemaÚcore_configrO   Zclean_schemar(   r¡   r®   r§   r¯   Úset_deprecated_descriptorsZ__pydantic_core_schema__r   rP   rQ   Zplugin_settingsZ__pydantic_validator__r   Z__pydantic_serializer__r1   r   r/   rŸ   r	  r
  r  r¦   Z__pydantic_on_complete__)r¸   rƒ   r„   r�   r  r‘   r  r  ÚeÚexcZ
gen_schemaZschemar  rM   rM   rN   r°   1  sŠ    ü
"ÿ€ý

ý"€üþ
ø
ûþr°   c                 C  sœ   | j  ¡ D ]\}}|j }dur t|ƒ}| | |¡ t| ||ƒ q| j ¡ D ]%\}}|j }durKtt|j	ƒdƒsKt||j	ƒ}| | |¡ t| ||ƒ q&dS )z8Set data descriptors on the class for deprecated fields.NZ__deprecated__)
rÇ   r§   Zdeprecation_messageÚ_DeprecatedFieldDescriptorr¨   r  r¯   Úhasattrr!   Úwrapped_property)r¸   ÚfieldrÓ   ÚmsgÚdescZcomputed_field_inforM   rM   rN   r  ­  s   €ú€ôr  c                   @  sF   e Zd ZU dZded< ddd
d„Zddd„Zdddd„Zd dd„ZdS )!r  aW  Read-only data descriptor used to emit a runtime deprecation warning before accessing a deprecated field.

    Attributes:
        msg: The deprecation message to be emitted.
        wrapped_property: The property instance if the deprecated field is a computed field, or `None`.
        field_name: The name of the field being deprecated.
    r;   Ú
field_nameNr  r  úproperty | Noner>   r?   c                 C  s   || _ || _d S rq   )r  r  )rI   r  r  rM   rM   rN   rŸ   Ï  s   
z#_DeprecatedFieldDescriptor.__init__r¸   rn   r»   c                 C  s
   || _ d S rq   )r  )rI   r¸   r»   rM   rM   rN   r¨   Ó  ó   
z'_DeprecatedFieldDescriptor.__set_name__r¼   úBaseModel | NoneÚobj_typeútype[BaseModel] | Noner   c                 C  s`   |d u r| j d ur| j  d |¡S t| jƒ‚tj| jtdd� | j d ur*| j  ||¡S |j| j S )Nr   rA   )	r  Ú__get__r¿   r  rE   rF   r  ÚDeprecationWarningr¾   )rI   r¼   r  rM   rM   rN   r  Ö  s   


z"_DeprecatedFieldDescriptor.__get__rö   r   c                 C  s
   t | jƒ‚rq   )r¿   r  )rI   r¼   rö   rM   rM   rN   Ú__set__å  r  z"_DeprecatedFieldDescriptor.__set__rq   )r  r;   r  r  r>   r?   )r¸   rn   r»   r;   r>   r?   )r¼   r  r  r  r>   r   )r¼   r   rö   r   r>   r   )	rO   rP   rQ   rR   r•   rŸ   r¨   r  r  rM   rM   rM   rN   r  Ä  s   
 
r  c                   @  s.   e Zd ZdZddd„Zddd„Zdd
d„ZdS )Ú_PydanticWeakRefaë  Wrapper for `weakref.ref` that enables `pickle` serialization.

    Cloudpickle fails to serialize weakref.ref objects due to an arcane error related to
    to abstract base classes (`abc.ABC`). This class works around the issue by wrapping
    `weakref.ref` instead of subclassing it.

    See https://github.com/pydantic/pydantic/issues/6763 for context.

    Semantics:
        - If not pickled, behaves the same as a `weakref.ref`.
        - If pickled along with the referenced object, the same `weakref.ref` behavior
          will be maintained between them after unpickling.
        - If pickled without the referenced object, after unpickling the underlying
          reference will be cleared (`__call__` will always return `None`).
    r¼   r   c                 C  s"   |d u r	d | _ d S t |¡| _ d S rq   )Ú_wrÚweakrefÚref)rI   r¼   rM   rM   rN   rŸ   ú  s   
z_PydanticWeakRef.__init__r>   c                 C  s   | j d u rd S |   ¡ S rq   )r   rÑ   rM   rM   rN   Ú__call__  s   
z_PydanticWeakRef.__call__ú4tuple[Callable, tuple[weakref.ReferenceType | None]]c                 C  s   t | ƒ ffS rq   )r  rÑ   rM   rM   rN   Ú
__reduce__  s   z_PydanticWeakRef.__reduce__N)r¼   r   )r>   r   )r>   r$  )rO   rP   rQ   rR   rŸ   r#  r%  rM   rM   rM   rN   r  é  s
    

r  ÚdúMutableMapping[str, Any] | Noneúdict[str, Any] | Nonec              	   C  sR   | du rdS i }|   ¡ D ]\}}zt|ƒ}W n ty!   |}Y nw |||< q|S )aX  Takes an input dictionary, and produces a new value that (invertibly) replaces the values with weakrefs.

    We can't just use a WeakValueDictionary because many types (including int, str, etc.) can't be stored as values
    in a WeakValueDictionary.

    The `unpack_lenient_weakvaluedict` function can be used to reverse this operation.
    N)r§   r  r¥   )r&  Úresultr:   r<   ÚproxyrM   rM   rN   r©     s   ÿ
r©   c                 C  sP   | du rdS i }|   ¡ D ]\}}t|tƒr!|ƒ }|dur |||< q|||< q|S )zAInverts the transform performed by `build_lenient_weakvaluedict`.N)r§   rD   r  )r&  r)  r:   r<   rM   rM   rN   r«      s   
€
r«   c                  C  s<   ddl m}  ttttt| tg}tj	dkr| 
tj¡ t|ƒS )Nr   )ÚComputedFieldInfo)é   é   )rï   r+  r	   rá   rÝ   rà   r   r   ÚsysÚversion_inforô   Útypingr£   )r+  r™   rM   rM   rN   rð   0  s   ù

rð   )rU   rV   r>   r   r–   )r_   r`   r]   r^   r>   ræ   )
r_   r`   r™   r^   rj   rç   ri   rç   r>   r"   )r¸   rn   r]   r^   r>   r?   )r¸   rn   r>   r   rq   )
r¸   rn   rƒ   r   r„   r.   r…   r  r>   r?   )r¸   rn   rƒ   r   r„   r.   r�   rd   r  rd   r‘   rf   r  rd   r>   rd   )r¸   rn   r>   r?   )r&  r'  r>   r(  )r&  r(  r>   r(  )r>   r^   )irR   Ú
__future__r   Z_annotationsr   r.  r0  rE   r!  Úabcr   Úcollections.abcr   r   ré   r   r   r   Útypesr	   r
   r   r   r   r   r   r   Zpydantic_corer   r   Ztyping_extensionsr   r   r   Úerrorsr   r   Zplugin._schema_validatorr   r   r   Ú_configr   Z_decoratorsr   r   r    r!   Ú_fieldsr"   r#   r$   r%   r&   Z_generate_schemar'   r(   Z	_genericsr)   r*   Z_import_utilsr+   r,   Z_mock_val_serr-   Z_namespace_utilsr.   Ú
_signaturer/   Z_typing_extrar0   Z_utilsr1   r2   rï   r3   ZPydanticModelFieldr4   r5   r6   ZPydanticModelPrivateAttrÚmainr7   r8   r=   Ú__setattr__rä   rª   r9   rX   rZ   r[   r‡   r­   r˜   r²   rø   r¬   r°   r  r  r  r©   r«   rð   rM   rM   rM   rN   Ú<module>   s€    $þ  



f
ü&ø
|%
#
