Viewing File: /opt/hc_python/lib/python3.12/site-packages/pydantic/__pycache__/root_model.cpython-312.pyc

�

e��g2��t�dZddlmZddlZddlmZmZddlmZddl	m
Z
ddlmZm
Z
dd	lmZmZej"rAdd
lmZddlmZmZmZddlmZdd
lmZedeef��Gd�dej8��Znej8ZdZej>d�Z Gd�deejBe e��Z"y)z%RootModel class and type definitions.�)�annotationsN)�copy�deepcopy)�PydanticUndefined�)�PydanticUserError)�_model_construction�_repr)�	BaseModel�_object_setattr)�Any)�Literal�Self�dataclass_transform)�Field)�PrivateAttrF)�kw_only_default�field_specifiersc��eZdZy)�_RootModelMetaclassN)�__name__�
__module__�__qualname__���B/opt/hc_python/lib/python3.12/site-packages/pydantic/root_model.pyrrs��CFrr)�	RootModel�RootModelRootTypec�
��eZdZUdZdZdZdZded<�fd�Ze	fdd�Z
de
_edd�fd�
�Z
dd	�Zdd
�Zdd�Zddd�Zej&r(d
ddddddddddd�																							dd�Zd�fd�Zdd�Z�xZS)ra�Usage docs: https://docs.pydantic.dev/2.8/concepts/models/#rootmodel-and-custom-root-types

    A Pydantic `BaseModel` for the root object of the model.

    Attributes:
        root: The root object of the model.
        __pydantic_root_model__: Whether the model is a RootModel.
        __pydantic_private__: Private fields in the model.
        __pydantic_extra__: Extra fields in the model.

    TNr�rootc�x��|jjd�}|�
tdd���t�|�di|��y)N�extraz<`RootModel` does not support setting `model_config['extra']`zroot-model-extra)�coder)�model_config�getr�super�__init_subclass__)�cls�kwargsr"�	__class__s   �rr'zRootModel.__init_subclass__6sD���� � �$�$�W�-����#�N�Ug��
�	��!�+�F�+rc�p�d}|r|turtd��|}|jj||��y)NTz_"RootModel.__init__" accepts either a single positional argument or arbitrary keyword arguments)�
self_instance)r�
ValueError�__pydantic_validator__�validate_python)�selfr �data�__tracebackhide__s    r�__init__zRootModel.__init__>sD�� ����,�,� �u����D��#�#�3�3�D��3�Mrc�&��t�|�||��S)aSCreate a new model using the provided root object and update fields set.

        Args:
            root: The root object of the model.
            _fields_set: The set of fields to be updated.

        Returns:
            The new model.

        Raises:
            NotImplemented: If the model is not a subclass of `RootModel`.
        )r �_fields_set)r&�model_construct)r(r r5r*s   �rr6zRootModel.model_constructJs����w�&�D�k�&�J�Jrc�4�|j|jd�S)N��__dict__�__pydantic_fields_set__r8�r0s r�__getstate__zRootModel.__getstate__Zs���
�
�'+�'C�'C�
�	
rc�D�t|d|d�t|d|d�y)Nr:r9)r)r0�states  r�__setstate__zRootModel.__setstate__`s&����7��?X�9Y�Z���j�%�
�*;�<rc��t|�}|j|�}t|dt|j��t|dt|j
��|S)z$Returns a shallow copy of the model.r9r:)�type�__new__rrr9r:)r0r(�ms   r�__copy__zRootModel.__copy__dsK���4�j���K�K������:�t�D�M�M�':�;���4�d�4�;W�;W�6X�Y��rc���t|�}|j|�}t|dt|j|���t|dt|j��|S)z!Returns a deep copy of the model.r9)�memor:)rArBrrr9rr:)r0rFr(rCs    r�__deepcopy__zRootModel.__deepcopy__lsO���4�j���K�K������:�x��
�
�D�'I�J�	��4�d�4�;W�;W�6X�Y��r�pythonF)�mode�include�exclude�context�by_alias�
exclude_unset�exclude_defaults�exclude_none�
round_trip�warnings�serialize_as_anyc��y)aThis method is included just to get a more accurate return type for type checkers.
            It is included in this `if TYPE_CHECKING:` block since no override is actually necessary.

            See the documentation of `BaseModel.model_dump` for more details about the arguments.

            Generally, this method will have a return type of `RootModelRootType`, assuming that `RootModelRootType` is
            not a `BaseModel` subclass. If `RootModelRootType` is a `BaseModel` subclass, then the return
            type will likely be `dict[str, Any]`, as `model_dump` calls are recursive. The return type could
            even be something different, in the case of a custom serializer.
            Thus, `Any` is used here to catch all of these cases.
            Nr)r0rIrJrKrLrMrNrOrPrQrRrSs            r�
model_dumpzRootModel.model_dumpxs��4
rc���t|t�stS|jdj|jdjk(xrt
�|�|�S�Nr )�
isinstancer�NotImplemented�model_fields�
annotationr&�__eq__)r0�otherr*s  �rr\zRootModel.__eq__�sR����%��+�!�!�� � ��(�3�3�u�7I�7I�&�7Q�7\�7\�\�v�af�ah�ao�pu�av�vrc#�,K�d|jf��y�wrW)r r;s r�
__repr_args__zRootModel.__repr_args__�s�����d�i�i���s�)r r�return�None)N)r rr5zset[str] | Noner`r)r`�dict[Any, Any])r>rbr`ra)r`r)rFzdict[int, Any] | Noner`r)rIzLiteral['json', 'python'] | strrJr
rKr
rLzdict[str, Any] | NonerM�boolrNrcrOrcrPrcrQrcrRz'bool | Literal['none', 'warn', 'error']rSrcr`r
)r]r
r`rc)r`z_repr.ReprArgs)rrr�__doc__�__pydantic_root_model__�__pydantic_private__�__pydantic_extra__�__annotations__r'rr3�__pydantic_base_init__�classmethodr6r<r?rDrG�typing�
TYPE_CHECKINGrUr\r_�
__classcell__)r*s@rrr#s���
�#������
��,�5F�N�'+�H�#��
K��
K�
�=������
5=���-1�"�"'�%*�!&�$�@D�%*�	�2�	��		�
�	�+�
	��	� �	�#�	��	��	�>�	�#�	��	�8w�
 rr)�	metaclass)#rd�
__future__r�_annotationsrkrr�
pydantic_corer�r�	_internalr	r
�mainrrrlr
�typing_extensionsrrr�fieldsr�PydanticModelFieldr�PydanticModelPrivateAttr�ModelMetaclassr�__all__�TypeVarr�Genericrrrr�<module>r}s���+�2�
��+��1�,�	����D�D�3�?�
��BT�Vn�Ao�p�F�1�@�@�F�q�F�-�<�<��
��"�F�N�N�#6�7��w �	�6�>�>�*;�<�H[�w r
Back to Directory File Manager