HEX
Server: LiteSpeed
System: Linux php-prod-1.spaceapp.ru 5.15.0-157-generic #167-Ubuntu SMP Wed Sep 17 21:35:53 UTC 2025 x86_64
User: xnsbb3110 (1041)
PHP: 8.1.33
Disabled: NONE
Upload Files
File: //usr/local/CyberCP/lib/python3.10/site-packages/pydantic/__pycache__/dataclasses.cpython-310.pyc
o

�hA�
@s`dZddlmZddlZddlZddlZddlmZm	Z	m
Z
mZmZm
Z
mZmZddlmZddlmZmZddlmZmZmZmZdd	lmZdd
lmZddlmZddl m!Z!dd
l"m#Z#m$Z$m%Z%errddl&m'Z'ddl(m)Z)dZ*ed�Z+ej,dkr�eej-e#e%fd�eddddddddddd�
dMd(d)���Z.eej-e#e%fd�eddddddddddd�
dNd-d)���Z.n4eej-e#e%fd�eddddddddd.�dOd/d)���Z.eej-e#e%fd�eddddddddd.�dPd0d)���Z.eej-e#e%fd�	dQddddddddddd�
dRd3d)��Z.dSd5d6�Z/ee0�Z1ej,d7k�rdTd<d=�Z2e2ej3_4ddd>dd?�dUdFdG�Z5dVdKdL�Z6dS)Wz7Provide an enhanced dataclass that performs validation.�)�annotationsN)�
TYPE_CHECKING�Any�Callable�Generic�Literal�NoReturn�TypeVar�overload)�warn)�	TypeGuard�dataclass_transform�)�_config�_decorators�_namespace_utils�
_typing_extra)�_dataclasses)�getattr_migration)�
ConfigDict)�PydanticUserError)�Field�	FieldInfo�PrivateAttr)�PydanticDataclass)�MappingNamespace)�	dataclass�rebuild_dataclass�_T���
)�field_specifiersFT.�
�init�repr�eq�order�unsafe_hash�frozen�config�validate_on_init�kw_only�slotsr$�Literal[False]r%�boolr&r'r(r)r*� ConfigDict | type[object] | Noner+�bool | Noner,r-�return�-Callable[[type[_T]], type[PydanticDataclass]]c

C�dS�N�r#r6r6�G/usr/local/CyberCP/lib/python3.10/site-packages/pydantic/dataclasses.pyr�r�_cls�type[_T]�type[PydanticDataclass]c
Cr4r5r6)r9r$r%r&r'r(r)r*r+r,r-r6r6r7r/r8�r$r%r&r'r(r)r*r+cCr4r5r6r<r6r6r7rB�
c	Cr4r5r6)	r9r$r%r&r'r(r)r*r+r6r6r7rQr=�type[_T] | None�GCallable[[type[_T]], type[PydanticDataclass]] | type[PydanticDataclass]c
	st|dusJd��|dusJd��tjdkr|	|
d��ni�dd
d��d��������fd
d�}|dur6|S||�S)a�!!! abstract "Usage Documentation"
        [`dataclasses`](../concepts/dataclasses.md)

    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. If not set, the value from the provided `config` argument will be used (and will default to `False` otherwise).
        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-�cls�	type[Any]r2�Nonec	Ss�|jD]Q}t|di�}|D]F}t||d�}t|t�sq
d|i}tjdkr+|jr+d|d<|jdur5|j|d<t||t	j
di|���|j�d�durLi|_
|||j
|<q
qdS)	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%r6)�__mro__�getattr�
isinstancer�sys�version_infor,r%�setattr�dataclasses�field�__dict__�getrC)r@�annotation_clsr�
field_name�field_value�
field_argsr6r6r7�make_pydantic_fields_compatible�s"



��z2dataclass.<locals>.make_pydantic_fields_compatibler;c	s�ddlm}||�rtd|j�d�dd��|}tdd�|jD��}|s8�d	ur8t|d
�r8td|j�d�td
d��d	ur>�nt	|d
d	�}t
�|�}tj
�|�}|j}t�|�rrd	}|f}t|t�rkt|j}	||	f}t�|j|�}�|��d	ur��}
|jr�td|j�d�td
d�n|jp�d}
tj|fd����|
d����}d|_||_||_|j|_|j|_tt�|_ d|_!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)�codecss�|]}t�|�VqdSr5)rK�is_dataclass)�.0�baser6r6r7�	<genexpr>�s�z6dataclass.<locals>.create_dataclass.<locals>.<genexpr>N�__pydantic_config__z[`config` is set via both the `dataclass` decorator and `__pydantic_config__` for dataclass zK. The `config` specification from `dataclass` decorator will take priority.�)�category�
stacklevelzN`frozen` is set via both the `dataclass` decorator and `config` for dataclass zW.This is not recommended. The `frozen` specification on `dataclass` will take priority.FT)r$r%r&r'r(r))�raise_errors)#�_internal._utilsrTr�__name__�any�	__bases__�hasattrr�UserWarningrFr�
ConfigWrapperr�DecoratorInfos�build�__doc__�_pydantic_dataclasses�is_builtin_dataclass�
issubclassr�__parameters__�types�	new_classr)rKr�__is_pydantic_dataclass__�__pydantic_decorators__�
__module__�__qualname__�classmethod�_pydantic_fields_complete�__pydantic_fields_complete__�__pydantic_complete__�complete_dataclass)r@rT�original_cls�has_dataclass_base�config_dict�config_wrapper�
decorators�original_doc�bases�generic_base�frozen_�r*r&r)�kwargsrSr'r%r(r6r7�create_dataclass�sr	��




��
��	�
z#dataclass.<locals>.create_dataclassN)r@rAr2rB)r@rAr2r;)rHrI)r9r$r%r&r'r(r)r*r+r,r-r�r6r�r7ras/

!br@cCstdd�|j��D��S)z�Return whether the fields where successfully collected (i.e. type hints were successfully resolves).

    This is a private property, not meant to be used outside Pydantic.
    css�|]}|jVqdSr5)�	_complete)rW�
field_infor6r6r7rY#s�z,_pydantic_fields_complete.<locals>.<genexpr>)�all�__pydantic_fields__�values)r@r6r6r7rtsrt)r ��argsrr�rcOstd��)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)r�r�r6r6r7�
_call_initvar,sr�r[)�forcer^�_parent_namespace_depth�_types_namespacer�r^r��intr��MappingNamespace | NonecCs�|s|jrdSdD]}||jvrt||�q	d|_|dur |}n|dkr.tj|dd�p,i}ni}tj|d�}tj|t	j
|jdd�||dd	�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`.
    N)�__pydantic_core_schema__�__pydantic_validator__�__pydantic_serializer__FrT)�parent_depthr�)�parent_namespace)�check)r^�ns_resolver�_force_build)rvrM�delattrr�parent_frame_namespacer�
NsResolverrirwrrerZ)r@r�r^r�r��attr�
rebuild_nsr�r6r6r7r6s,


���r�class_rA�"TypeGuard[type[PydanticDataclass]]cCs,zd|jvo
t�|�WStyYdSw)z�Whether a class is a pydantic dataclass.

    Args:
        class_: The class.

    Returns:
        `True` if the class is a pydantic dataclass, `False` otherwise.
    roF)rMrKrV�AttributeError)r�r6r6r7�is_pydantic_dataclassss
	�r�)r$r.r%r/r&r/r'r/r(r/r)r/r*r0r+r1r,r/r-r/r2r3)r9r:r$r.r%r/r&r/r'r/r(r/r)r1r*r0r+r1r,r/r-r/r2r;)r$r.r%r/r&r/r'r/r(r/r)r1r*r0r+r1r2r3)r9r:r$r.r%r/r&r/r'r/r(r/r)r1r*r0r+r1r2r;r5)r9r>r$r.r%r/r&r/r'r/r(r/r)r1r*r0r+r1r,r/r-r/r2r?)r@r;r2r/)r�rr�rr2r)r@r;r�r/r^r/r�r�r�r�r2r1)r�rAr2r�)7rh�
__future__r�_annotationsrKrHrm�typingrrrrrrr	r
�warningsr�typing_extensionsrr
�	_internalrrrrrri�
_migrationrr*r�errorsr�fieldsrrr�_internal._dataclassesr�_internal._namespace_utilsr�__all__rrIrLrrtr`�__getattr__r��InitVar�__call__rr�r6r6r6r7�<module>s�(
���
���
=
�=