§
    9ˆtj„3  ã                  óð  — U 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m	Z	 ddl
mZ ddlmZ ddl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mZ d
dl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& ddl'm(Z( ddl)m*Z*m+Z+ ddl,m-Z- ddl.m/Z/ ddl0m1Z1 ddl2m3Z3 ddl4m5Z5 erddl6m7Z8 d
dl9m:Z:  G d„ de8e¦  «        Z;	 d7d8d$„Z<d%dd&d'œd9d,„Z=d:d.„Z>d;d2„Z?e@eAejB        e         f         ZCd3eDd4<   ed<d6„¦   «         ZEdS )=z0Private logic for creating pydantic dataclasses.é    )ÚannotationsN)Ú	Generator)Úcontextmanager)Úpartial)ÚTYPE_CHECKINGÚAnyÚClassVarÚProtocolÚcast)Ú
ArgsKwargsÚSchemaSerializerÚSchemaValidatorÚcore_schema)Ú	TypeAliasÚTypeIsé   )ÚPydanticUndefinedAnnotation)Ú	FieldInfo)ÚPluggableSchemaValidatorÚcreate_schema_validator)ÚPydanticDeprecatedSince20é   )Ú_configÚ_decorators)Úcollect_dataclass_fields)ÚGenerateSchemaÚInvalidSchemaError)Úget_standard_typevars_map)Úset_dataclass_mocks)Ú
NsResolver)Úgenerate_pydantic_signature)ÚLazyClassAttribute)ÚDataclassInstance)Ú
ConfigDictc                  ór   — 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<   edd„¦   «         ZdS )ÚPydanticDataclassai  A protocol containing attributes only available once a class has been decorated as a Pydantic dataclass.

        Attributes:
            __pydantic_config__: Pydantic-specific configuration settings for the dataclass.
            __pydantic_complete__: Whether dataclass building is completed, or if there are still undefined fields.
            __pydantic_core_schema__: The pydantic-core schema used to build the SchemaValidator and SchemaSerializer.
            __pydantic_decorators__: Metadata containing the decorators defined on the dataclass.
            __pydantic_fields__: Metadata about the fields defined on the dataclass.
            __pydantic_serializer__: The pydantic-core SchemaSerializer used to dump instances of the dataclass.
            __pydantic_validator__: The pydantic-core SchemaValidator used to validate instances of the dataclass.
        zClassVar[ConfigDict]Ú__pydantic_config__zClassVar[bool]Ú__pydantic_complete__z ClassVar[core_schema.CoreSchema]Ú__pydantic_core_schema__z$ClassVar[_decorators.DecoratorInfos]Ú__pydantic_decorators__zClassVar[dict[str, FieldInfo]]Ú__pydantic_fields__zClassVar[SchemaSerializer]Ú__pydantic_serializer__z4ClassVar[SchemaValidator | PluggableSchemaValidator]Ú__pydantic_validator__ÚreturnÚboolc                ó   — d S ©N© ©Úclss    ú]/var/www/html/CA-Chatbot/venv/lib/python3.11/site-packages/pydantic/_internal/_dataclasses.pyÚ__pydantic_fields_complete__z.PydanticDataclass.__pydantic_fields_complete__=   s   € Ø7:°só    N)r.   r/   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú__annotations__Úclassmethodr6   r2   r7   r5   r&   r&   (   sˆ   € € € € € € ð
	ð 
	ð 	2Ð1Ð1Ñ1Ø-Ð-Ð-Ñ-ØBÐBÐBÑBØEÐEÐEÑEØ;Ð;Ð;Ñ;Ø;Ð;Ð;Ñ;ØTÐTÐTÑTà	Ø:Ð:Ð:ñ 
ŒØ:Ð:Ð:r7   r&   r4   útype[StandardDataclass]Úconfig_wrapperú_config.ConfigWrapperÚns_resolverúNsResolver | Noner.   ÚNonec                óX   — t          | ¦  «        }t          | |||¬¦  «        }|| _        dS )zÚCollect and set `cls.__pydantic_fields__`.

    Args:
        cls: The class.
        config_wrapper: The config wrapper instance.
        ns_resolver: Namespace resolver to use when getting dataclass annotations.
    )rA   Útypevars_mapr?   N)r   r   r+   )r4   r?   rA   rE   Úfieldss        r5   Úset_dataclass_fieldsrG   A   s?   € õ -¨SÑ1Ô1€LÝ%Ø˜°<ÐP^ðñ ô €Fð %€CÔÐÐr7   TF)Úraise_errorsrA   Ú_force_buildú	type[Any]rH   r/   rI   c               ó¸  — | j         }dd„}| j        › d	�|_        || _         |j        | _        t	          | ||¬
¦  «         |s|j        rt          | ¦  «         dS t          | d¦  «        rt          j	        dt          ¦  «         t          | ¦  «        }t          |||¬¦  «        }t          dt          t          || j        |j        |j        d¬¦  «        ¦  «        | _        	 |                     | ¦  «        }	n4# t*          $ r'}
|r‚ t          | d|
j        › d�¦  «         Y d}
~
dS d}
~
ww xY w|                     | j        ¬¦  «        }	 |                     |	¦  «        }	n # t4          $ r t          | ¦  «         Y dS w xY wt7          d| ¦  «        } |	| _        t;          |	| | j        | j        d||j        ¦  «        | _         tC          |	|¦  «        | _"        d| _#        dS )a†  Finish building a pydantic dataclass.

    This logic is called on a class which has already been wrapped in `dataclasses.dataclass()`.

    This is somewhat analogous to `pydantic._internal._model_construction.complete_model_class`.

    Args:
        cls: The class.
        config_wrapper: The config wrapper instance.
        raise_errors: Whether to raise errors, defaults to `True`.
        ns_resolver: The namespace resolver instance to use when collecting dataclass fields
            and during schema building.
        _force_build: Whether to force building the dataclass, no matter if
            [`defer_build`][pydantic.config.ConfigDict.defer_build] is set.

    Returns:
        `True` if building a pydantic dataclass is successfully completed, `False` otherwise.

    Raises:
        PydanticUndefinedAnnotation: If `raise_error` is `True` and there is an undefined annotations.
    Ú__dataclass_self__r&   Úargsr   Úkwargsr.   rC   c                ób   — d}| }|j                              t          ||¦  «        |¬¦  «         d S )NT)Úself_instance)r-   Úvalidate_pythonr   )rL   rM   rN   Ú__tracebackhide__Úss        r5   Ú__init__z$complete_dataclass.<locals>.__init__v   s:   € Ø ÐØˆØ	Ô ×0Ò0µ¸DÀ&Ñ1IÔ1IÐYZÐ0Ñ[Ô[Ð[Ð[Ð[r7   z	.__init__)r?   rA   FÚ__post_init_post_parse__zVSupport for `__post_init_post_parse__` has been dropped, the method will not be called)rA   rE   Ú__signature__T)ÚinitrF   Úvalidate_by_nameÚextraÚis_dataclassú`N)Útitleztype[PydanticDataclass]Ú	dataclass)rL   r&   rM   r   rN   r   r.   rC   )$rT   r:   Úconfig_dictr'   rG   Údefer_buildr   ÚhasattrÚwarningsÚwarnr   r   r   r"   r   r!   r+   rX   rY   rV   Úgenerate_schemar   ÚnameÚcore_configr8   Úclean_schemar   r   r)   r   r9   Úplugin_settingsr-   r   r,   r(   )r4   r?   rH   rA   rI   Úoriginal_initrT   rE   Ú
gen_schemaÚschemaÚere   s               r5   Úcomplete_dataclassrl   U   sX  € ð: ”L€Mð\ð \ð \ð \ð
  #Ô/Ð:Ð:Ð:€HÔà€C„LØ,Ô8€CÔå˜¨^ÈÐUÑUÔUÐUàð ˜NÔ6ð Ý˜CÑ Ô Ð ØˆuåˆsÐ.Ñ/Ô/ð 
ÝŒØdÝ%ñ	
ô 	
ð 	
õ
 -¨SÑ1Ô1€LÝØØØ!ðñ ô €Jõ +ØÝÝ'ð ØÔ*Ø+Ô<Ø Ô&Øð		
ñ 		
ô 		
ñô €CÔðØ×+Ò+¨CÑ0Ô0ˆˆøÝ&ð ð ð Øð 	ØÝ˜C  Q¤V   Ñ/Ô/Ð/Øˆuˆuˆuˆuˆuøøøøð	øøøð !×,Ò,°3´<Ð,Ñ@Ô@€KðØ×(Ò(¨Ñ0Ô0ˆˆøÝð ð ð Ý˜CÑ Ô Ð Øˆuˆuðøøøõ Ð(¨#Ñ
.Ô
.€Cà#)€CÔ Ý!8Ø��S”^ SÔ%5°{ÀKÐQ_ÔQoñ"ô "€CÔõ #3°6¸;Ñ"GÔ"G€CÔØ $€CÔØˆ4s*   Ã"C8 Ã8
D)ÄD$Ä$D)ÅE ÅE;Å:E;úTypeIs[type[StandardDataclass]]c               ó6   — d| j         v ot          | d¦  «         S )af  Returns `True` if the class is a stdlib dataclass and *not* a Pydantic dataclass.

    Unlike the stdlib `dataclasses.is_dataclass()` function, this does *not* include subclasses
    of a dataclass that are themselves not dataclasses.

    Args:
        cls: The class.

    Returns:
        `True` if the class is a stdlib dataclass, `False` otherwise.
    Ú__dataclass_fields__r-   )Ú__dict__r`   r3   s    r5   Úis_stdlib_dataclassrq   Á   s$   € ð " S¤\Ð1Ð`½'À#ÐG_Ñ:`Ô:`Ð6`Ð`r7   Úpydantic_fieldr   údataclasses.Field[Any]c                óÖ   — d| i}t           j        dk    r| j        �
| j        |d<   t           j        dk    r| j        �
| j        |d<   | j        dur
| j        |d<   t          j        di |¤ŽS )	NÚdefault)é   é   Údoc©rv   é
   Úkw_onlyTÚreprr2   )ÚsysÚversion_infoÚdescriptionr{   r|   ÚdataclassesÚfield)rr   Ú
field_argss     r5   Úas_dataclass_fieldrƒ   Ð   sŠ   € Ø"+¨^Ð!<€Jõ Ô˜7Ò"Ð" ~Ô'AÐ'MØ*Ô6ˆ
�5Ñõ Ô˜7Ò"Ð" ~Ô'=Ð'IØ .Ô 6ˆ
�9Ñð Ô $Ð&Ð&Ø+Ô0ˆ
�6ÑåÔÐ*Ð*˜zÐ*Ð*Ð*r7   r   ÚDcFieldsúGenerator[None]c              #  ó†  K  — g }| j         dd…         D ]Ô}|j                             di ¦  «        }d„ |                     ¦   «         D ¦   «         }|r—|                     ||f¦  «         |                     ¦   «         D ]k\  }}t          t          |j        ¦  «        }t          j        |¦  «        }t          j
        dk    r|j        rd|_        |j        dur|j        |_        |||<   ŒlŒÕ	 dV — |D ]$\  }	}
|
                     ¦   «         D ]
\  }}||	|<   ŒŒ%dS # |D ]$\  }	}
|
                     ¦   «         D ]
\  }}||	|<   ŒŒ%w xY w)a¨  Temporarily patch the stdlib dataclasses bases of `cls` if the Pydantic `Field()` function is used.

    When creating a Pydantic dataclass, it is possible to inherit from stdlib dataclasses, where
    the Pydantic `Field()` function is used. To create this Pydantic dataclass, we first apply
    the stdlib `@dataclass` decorator on it. During the construction of the stdlib dataclass,
    the `kw_only` and `repr` field arguments need to be understood by the stdlib *during* the
    dataclass construction. To do so, we temporarily patch the fields dictionary of the affected
    bases.

    For instance, with the following example:

    ```python {test="skip" lint="skip"}
    import dataclasses as stdlib_dc

    import pydantic
    import pydantic.dataclasses as pydantic_dc

    @stdlib_dc.dataclass
    class A:
        a: int = pydantic.Field(repr=False)

    # Notice that the `repr` attribute of the dataclass field is `True`:
    A.__dataclass_fields__['a']
    #> dataclass.Field(default=FieldInfo(repr=False), repr=True, ...)

    @pydantic_dc.dataclass
    class B(A):
        b: int = pydantic.Field(repr=False)
    ```

    When passing `B` to the stdlib `@dataclass` decorator, it will look for fields in the parent classes
    and reuse them directly. When this context manager is active, `A` will be temporarily patched to be
    equivalent to:

    ```python {test="skip" lint="skip"}
    @stdlib_dc.dataclass
    class A:
        a: int = stdlib_dc.field(default=Field(repr=False), repr=False)
    ```

    !!! note
        This is only applied to the bases of `cls`, and not `cls` itself. The reason is that the Pydantic
        dataclass decorator "owns" `cls` (in the previous example, `B`). As such, we instead modify the fields
        directly (in the previous example, we simply do `setattr(B, 'b', as_dataclass_field(pydantic_field))`).

    !!! note
        This approach is far from ideal, and can probably be the source of unwanted side effects/race conditions.
        The previous implemented approach was mutating the `__annotations__` dict of `cls`, which is no longer a
        safe operation in Python 3.14+, and resulted in unexpected behavior with field ordering anyway.
    r   Nro   c                óš   — i | ]H\  }}t          |j        t          ¦  «        r)|j        j        €|j        j        s|j        j        du¯E||“ŒIS )NT)Ú
isinstanceru   r   r   r{   r|   )Ú.0Ú
field_namer�   s      r5   ú
<dictcomp>z%patch_base_fields.<locals>.<dictcomp>   si   € ð 2
ð 2
ð 2
á!�
˜EÝ˜%œ-­Ñ3Ô3ð2
ð
 ”Ô*Ð6¸%¼-Ô:OÐ6ÐSXÔS`ÔSeÐmqÐSqÐSqð	 ˜ð TrÐSqÐSqr7   ry   T)Ú__mro__rp   ÚgetÚitemsÚappendr   r   ru   Úcopyr}   r~   r{   r|   )r4   Úoriginal_fields_listÚbaseÚ	dc_fieldsÚ&dc_fields_with_pydantic_field_defaultsrŠ   r�   ru   Únew_dc_fieldrF   Úoriginal_fieldsÚoriginal_fields               r5   Úpatch_base_fieldsr˜   å   sÁ  è è € ðn =?Ðà”˜A˜B˜B”ð 5ð 5ˆØ7;´}×7HÒ7HÐI_ÐacÑ7dÔ7dˆ	ð2
ð 2
à%.§_¢_Ñ%6Ô%6ð2
ñ 2
ô 2
Ð.ð 2ð 	5Ø ×'Ò'¨Ð4ZÐ([Ñ\Ô\Ð\Ø%K×%QÒ%QÑ%SÔ%Sð 5ð 5Ñ!�
˜EÝ�y¨%¬-Ñ8Ô8�õ  $œy¨Ñ/Ô/�õ Ô# wÒ.Ð.°7´?Ð.Ø+/�LÔ(Ø”< tÐ+Ð+Ø(/¬�LÔ%Ø(4�	˜*Ñ%Ð%øð4Øˆˆˆà';ð 	4ð 	4Ñ#ˆF�OØ.=×.CÒ.CÑ.EÔ.Eð 4ð 4Ñ*�
˜NØ%3��zÑ"Ð"ð4ð	4ð 	4øÐ';ð 	4ð 	4Ñ#ˆF�OØ.=×.CÒ.CÑ.EÔ.Eð 4ð 4Ñ*�
˜NØ%3��zÑ"Ð"ð4ð	4øøøs   Ã*D Ä)E r1   )r4   r>   r?   r@   rA   rB   r.   rC   )r4   rJ   r?   r@   rH   r/   rA   rB   rI   r/   r.   r/   )r4   rJ   r.   rm   )rr   r   r.   rs   )r4   rJ   r.   r…   )Fr;   Ú
__future__r   Ú_annotationsr�   r€   r}   ra   Úcollections.abcr   Ú
contextlibr   Ú	functoolsr   Útypingr   r   r	   r
   r   Úpydantic_corer   r   r   r   Útyping_extensionsr   r   Úerrorsr   rF   r   Úplugin._schema_validatorr   r   r   Ú r   r   Ú_fieldsr   Ú_generate_schemar   r   Ú	_genericsr   Ú_mock_val_serr   Ú_namespace_utilsr    Ú
_signaturer!   Ú_utilsr"   Ú	_typeshedr#   ÚStandardDataclassÚconfigr$   r&   rG   rl   rq   rƒ   ÚdictÚstrÚFieldr„   r<   r˜   r2   r7   r5   ú<module>r±      s  ðØ 6Ð 6Ð 6à 2Ð 2Ð 2Ð 2Ð 2Ð 2à €€€Ø Ð Ð Ð Ø 
€
€
€
Ø €€€Ø %Ð %Ð %Ð %Ð %Ð %Ø %Ð %Ð %Ð %Ð %Ð %Ø Ð Ð Ð Ð Ð Ø ?Ð ?Ð ?Ð ?Ð ?Ð ?Ð ?Ð ?Ð ?Ð ?Ð ?Ð ?Ð ?Ð ?ðð ð ð ð ð ð ð ð ð ð ð ð 0Ð /Ð /Ð /Ð /Ð /Ð /Ð /à 0Ð 0Ð 0Ð 0Ð 0Ð 0Ø Ð Ð Ð Ð Ð Ø XÐ XÐ XÐ XÐ XÐ XÐ XÐ XØ 0Ð 0Ð 0Ð 0Ð 0Ð 0Ø "Ð "Ð "Ð "Ð "Ð "Ð "Ð "Ø -Ð -Ð -Ð -Ð -Ð -Ø @Ð @Ð @Ð @Ð @Ð @Ð @Ð @Ø 0Ð 0Ð 0Ð 0Ð 0Ð 0Ø .Ð .Ð .Ð .Ð .Ð .Ø (Ð (Ð (Ð (Ð (Ð (Ø 3Ð 3Ð 3Ð 3Ð 3Ð 3Ø &Ð &Ð &Ð &Ð &Ð &àð ;Ø@Ð@Ð@Ð@Ð@Ð@à#Ð#Ð#Ð#Ð#Ð#ð;ð ;ð ;ð ;ð ;Ð-¨xñ ;ô ;ð ;ð8 &*ð%ð %ð %ð %ð %ð0 Ø%)Øðið ið ið ið ið iðXað að að að+ð +ð +ð +ð$ ˜3 Ô 1°#Ô 6Ð6Ô7€Ð 7Ð 7Ð 7Ñ 7ð ðU4ð U4ð U4ñ „ðU4ð U4ð U4r7   