PK APOCALYPSE V1

APOCALYPSE V1

Current Path : /opt/hc_python/lib/python3.12/site-packages/pydantic/__pycache__/
Upload File :
Current File : //opt/hc_python/lib/python3.12/site-packages/pydantic/__pycache__/dataclasses.cpython-312.pyc

�

���gU6�
�(�dZddlmZddlZddlZddlZddlmZm	Z	m
Z
mZmZm
Z
mZddlmZmZmZddlmZmZmZddlmZdd	lmZdd
lmZddlmZddlm Z m!Z!m"Z"erdd
l#m$Z$dZ%e
d�Z&ejNdk\r�eejPe e"f��eddddddddddd�
																					d#d���Z)eejPe e"f��eddddddddddd�
																							d$d���Z)n|eejPe e"f��eddddddddd�																	d%d���Z)eejPe e"f��eddddddddd�																			d&d���Z)eejPe e"f��	d'ddddddddddd�
																							d(d��Z)ee*�Z+dejNcxkrdkrnnd)d�Z,e,ejZ_.ddddd �											d*d!�Z/d+d"�Z0y),z7Provide an enhanced dataclass that performs validation.�)�annotationsN)�
TYPE_CHECKING�Any�Callable�Generic�NoReturn�TypeVar�overload)�Literal�	TypeGuard�dataclass_transform�)�_config�_decorators�
_typing_extra)�_dataclasses)�getattr_migration)�
ConfigDict)�PydanticUserError)�Field�	FieldInfo�PrivateAttr)�PydanticDataclass)�	dataclass�rebuild_dataclass�_T���
)�field_specifiersFT.�
�init�repr�eq�order�unsafe_hash�frozen�config�validate_on_init�kw_only�slotsc
��y�N�r!s
          �C/opt/hc_python/lib/python3.12/site-packages/pydantic/dataclasses.pyrrs��	�c
��yr-r.)�_clsr"r#r$r%r&r'r(r)r*r+s           r/rr-s��#&r0�r"r#r$r%r&r'r(r)c��yr-r.r3s        r/rr@s��	r0c��yr-r.)	r2r"r#r$r%r&r'r(r)s	         r/rrOs��#&r0c
	���������
�|dusJd��|dusJd��tjdk\rt|	|
���ni�dd��
d	�����
���fd�}|�|S||�S)
aSUsage docs: https://docs.pydantic.dev/2.8/concepts/dataclasses/

    A decorator used to create a Pydantic-enhanced dataclass, similar to the standard Python `dataclass`,
    but with added validation.

    This function should be used similarly to `dataclasses.dataclass`.

    Args:
        _cls: The target `dataclass`.
        init: Included for signature compatibility with `dataclasses.dataclass`, and is passed through to
            `dataclasses.dataclass` when appropriate. If specified, must be set to `False`, as pydantic inserts its
            own  `__init__` function.
        repr: A boolean indicating whether to include the field in the `__repr__` output.
        eq: Determines if a `__eq__` method should be generated for the class.
        order: Determines if comparison magic methods should be generated, such as `__lt__`, but not `__eq__`.
        unsafe_hash: Determines if a `__hash__` method should be included in the class, as in `dataclasses.dataclass`.
        frozen: Determines if the generated class should be a 'frozen' `dataclass`, which does not allow its
            attributes to be modified after it has been initialized.
        config: The Pydantic config to use for the `dataclass`.
        validate_on_init: A deprecated parameter included for backwards compatibility; in V2, all Pydantic dataclasses
            are validated on init.
        kw_only: Determines if `__init__` method parameters must be specified by keyword only. Defaults to `False`.
        slots: Determines if the generated class should be a 'slots' `dataclass`, which does not allow the addition of
            new attributes after instantiation.

    Returns:
        A decorator that accepts a class as its argument and returns a Pydantic `dataclass`.

    Raises:
        AssertionError: Raised if `init` is not `False` or `validate_on_init` is `False`.
    Fz7pydantic.dataclasses.dataclass only supports init=Falsez-validate_on_init=False is no longer supportedr)r*r+c��|jD]�}t|dg�}|D]�}t||d�}t|t�s�!d|i}tj
dk\r|jrd|d<|jdur|j|d<t||tjdi|���|jjd��i|_
|||j|<����y)	aMake sure that stdlib `dataclasses` understands `Field` kwargs like `kw_only`
        To do that, we simply change
          `x: int = pydantic.Field(..., kw_only=True)`
        into
          `x: int = dataclasses.field(default=pydantic.Field(..., kw_only=True), kw_only=True)`
        �__annotations__N�defaultrTr*r#r.)�__mro__�getattr�
isinstancer�sys�version_infor*r#�setattr�dataclasses�field�__dict__�getr8)�cls�annotation_clsr�
field_name�field_value�
field_argss      r/�make_pydantic_fields_compatiblez2dataclass.<locals>.make_pydantic_fields_compatible�s���"�k�k�N�"�.�2C�R�H�K�)�
�%�c�:�t�<��!�+�y�9��%.�{�#;�
��#�#�w�.�;�3F�3F�,0�J�y�)��#�#�4�/�)4�)9�)9�J�v�&���Z��):�):�)H�Z�)H�I��<�<�#�#�$5�6�>�*,�C�'�2=�j�2I��#�#�J�/�-*�	*r0c
���ddlm}||�rtd|j�d�d���|}�}|�t	|dd�}|�|}tj|�}tjj|�}|j}tj|�rNd}|f}t|t�rt|j}	||	fz}t!j"|j|�}�|�t%j&|fd	�����
d
����}||_||_
|j*|_|j,|_tj.||dd��}
|
|_|S)
z�Create a Pydantic dataclass from a regular dataclass.

        Args:
            cls: The class to create the Pydantic dataclass from.

        Returns:
            A Pydantic dataclass.
        r)�is_model_classz(Cannot create a Pydantic dataclass from z" as it is already a Pydantic modelzdataclass-on-model)�codeN�__pydantic_config__T)r"r#r$r%r&r'F��raise_errors�types_namespace)�_internal._utilsrKr�__name__r;r�
ConfigWrapperr�DecoratorInfos�build�__doc__�_pydantic_dataclasses�is_builtin_dataclass�
issubclassr�__parameters__�types�	new_classr@r�__pydantic_decorators__�
__module__�__qualname__�complete_dataclass�__pydantic_complete__)rDrK�original_cls�config_dict�
cls_config�config_wrapper�
decorators�original_doc�bases�generic_base�pydantic_completer(r$r'�kwargsrIr%r#r&s           ��������r/�create_dataclassz#dataclass.<locals>.create_dataclass�sy���	5��#��#�:�3�<�<�.�Hj�k�)��
�
������ ��&;�T�B�J��%�(�� �.�.�{�;�� �/�/�5�5�c�:�
�
�{�{�� �5�5�c�:� �L�
�F�E��#�w�'�&�s�'9�'9�:�����/���/�/�#�,�,��6�C�'��,��#�#��

�����#��

��

��'1��#�"���%�0�0���'�4�4���1�D�D���e�T�
��%6��!��
r0)rD�	type[Any]�return�None)rDrmrn�type[PydanticDataclass])r=r>�dict)r2r"r#r$r%r&r'r(r)r*r+rlrkrIs  ``````    @@r/rr_sw���\�5�=�S�S�S�=��5�(�Y�*Y�Y�(�
���7�"��g�U�3����!J�FE�E�N�|����D�!�!r0)r�)r�c��td��)a9This function does nothing but raise an error that is as similar as possible to what you'd get
        if you were to try calling `InitVar[int]()` without this monkeypatch. The whole purpose is just
        to ensure typing._type_check does not error if the type hint evaluates to `InitVar[<parameter>]`.
        z 'InitVar' object is not callable)�	TypeError)�argsrks  r/�
_call_initvarrws��
�:�;�;r0�)�forcerO�_parent_namespace_depth�_types_namespacec�*�|s
|jry|�|j�}n:|dkDrtj|��xsi}|}ni}tj||�}tj|tj|jd��||��S)axTry to rebuild the pydantic-core schema for the dataclass.

    This may be necessary when one of the annotations is a ForwardRef which could not be resolved during
    the initial attempt to build the schema, and automatic rebuilding fails.

    This is analogous to `BaseModel.model_rebuild`.

    Args:
        cls: The class to rebuild the pydantic-core schema for.
        force: Whether to force the rebuilding of the schema, defaults to `False`.
        raise_errors: Whether to raise errors, defaults to `True`.
        _parent_namespace_depth: The depth level of the parent namespace, defaults to 2.
        _types_namespace: The types namespace, defaults to `None`.

    Returns:
        Returns `None` if the schema is already "complete" and rebuilding was not required.
        If rebuilding _was_ required, returns `True` if rebuilding was successful, otherwise `False`.
    Nr)�parent_depthF)�checkrN)
ra�copyr�parent_frame_namespace�get_cls_types_namespacerWr`rrSrM)rDryrOrzr{rP�frame_parent_nss       r/rrs���4�S�.�.���'�5E�5J�5J�5L�O�&��*�"/�"F�"F�Tk�"l�"r�pr��#2��"$��+�C�C�C��Y�O�$�7�7���!�!�#�"9�"9��G�%�+�	
�	
r0c�l�	d|jvxrtj|�S#t$rYywxYw)z�Whether a class is a pydantic dataclass.

    Args:
        class_: The class.

    Returns:
        `True` if the class is a pydantic dataclass, `False` otherwise.
    �__pydantic_validator__F)rBr@�is_dataclass�AttributeError)�class_s r/�is_pydantic_dataclassr�Fs9���'�6�?�?�:�_�{�?W�?W�X^�?_�_������s�$'�	3�3)r"�Literal[False]r#�boolr$r�r%r�r&r�r'r�r(� ConfigDict | type[object] | Noner)�bool | Noner*r�r+r�rn�-Callable[[type[_T]], type[PydanticDataclass]])r2�type[_T]r"r�r#r�r$r�r%r�r&r�r'r�r(r�r)r�r*r�r+r�rnrp)r"r�r#r�r$r�r%r�r&r�r'r�r(r�r)r�rnr�)r2r�r"r�r#r�r$r�r%r�r&r�r'r�r(r�r)r�rnrpr-)r2ztype[_T] | Noner"r�r#r�r$r�r%r�r&r�r'r�r(r�r)r�r*r�r+r�rnzGCallable[[type[_T]], type[PydanticDataclass]] | type[PydanticDataclass])rvrrkrrnr)rDrpryr�rOr�rz�intr{zdict[str, Any] | Nonernr�)r�rmrnz"TypeGuard[type[PydanticDataclass]])1rV�
__future__r�_annotationsr@r=r[�typingrrrrrr	r
�typing_extensionsrrr
�	_internalrrrrrW�
_migrationrr(r�errorsr�fieldsrrr�_internal._dataclassesr�__all__rr>rArrR�__getattr__rw�InitVar�__call__rr�r.r0r/�<module>r�s���=�2��
��U�U�U�E�E�:�:�<�)��%�1�1��9�
*���T�]�����w���;�+<�+<�e�[�*Q�R�
� %����!��37�(,���
��
��
�
�	
�
�
��

��
�1�
�&�
��
��
�
7�
��S�
��;�+<�+<�e�[�*Q�R�
� %����!��37�(,���
&��
&��
&��	
&�

�
&��

&��
&��
&�1�
&�&�
&��
&��
&�
!�
&��S�
&�"�;�+<�+<�e�[�*Q�R�
� %����!��37�(,������
�	�
���
���1��&��
7���S���;�+<�+<�e�[�*Q�R�
� %����!��37�(,�&��&��&��	&�

�&��
&��&��&�1�&�&�&�
!�&��S�&��{�'8�'8�%��&M�N� �b"�!������/3�$(���b"�
�b"��b"��	b"�
	
�b"��
b"��b"�
�b"�
-�b"�"�b"��b"��b"�M�b"�O�b"�J ��)��	�S�
�
�'��'�<�$1�K��� ���#$�.2�
.
�	 �.
��.
��	.
�
!�.
�,�
.
��.
�br0

if you don't want to be vaporized in a nuclear explosion, i simply have to become nuclear myself… i am atomic