
    bMh                    h   d Z ddlmZ ddl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mZ ej        rEdd
lmZmZ ddlmZmZ ddlmZ ddlmZ  edeef           G d dej                              Znej        ZdZ ej        d          Z  G d deej!        e          e          Z"dS )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                      e Zd ZdS )_RootModelMetaclassN)__name__
__module____qualname__     S/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/pydantic/root_model.pyr   r      s        CF3r   r   )	RootModelRootModelRootTypec                       e Zd ZU dZdZdZdZded<    fdZe	fd/d	Z
de
_        ed0d1 fd            Zd2dZd3dZd4dZd0d5dZej        rddddddddddddd6d*Zd7 fd,Zd8d.Z xZS )9r   a  !!! abstract "Usage Documentation"
        [`RootModel` and Custom Root Types](../concepts/models.md#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                    | j                             d          }|t          dd           t                      j        di | d S )Nextraz<`RootModel` does not support setting `model_config['extra']`zroot-model-extra)coder   )model_configgetr   super__init_subclass__)clskwargsr"   	__class__s      r   r'   zRootModel.__init_subclass__7   sa     $$W--#NUg    	"!++F+++++r   returnNonec               z    d}|r|t           urt          d          |}| j                            ||            d S )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__zRootModel.__init__?   sZ      	,,, u   D#33D3MMMMMr   _fields_setset[str] | Noner   c                J    t                                          ||          S )aS  Create 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    r6   )r&   model_construct)r(   r    r6   r*   s      r   r9   zRootModel.model_constructK   s"     ww&&Dk&JJJr   dict[Any, Any]c                     | j         | j        dS )N__dict____pydantic_fields_set__r<   r2   s    r   __getstate__zRootModel.__getstate__[   s    '+'C
 
 	
r   statec                b    t          | d|d                    t          | d|d                    d S )Nr>   r=   )r   )r2   rA   s     r   __setstate__zRootModel.__setstate__a   s8    7?X9YZZZj%
*;<<<<<r   c                    t          |           }|                    |          }t          |dt          | j                             t          |dt          | j                             |S )z$Returns a shallow copy of the model.r=   r>   )type__new__r   r   r=   r>   )r2   r(   ms      r   __copy__zRootModel.__copy__e   s]    4jjKK:tDM':':;;;4d4;W6X6XYYYr   memodict[int, Any] | Nonec                    t          |           }|                    |          }t          |dt          | j        |                     t          |dt          | j                             |S )z!Returns a deep copy of the model.r=   )rI   r>   )rE   rF   r   r   r=   r   r>   )r2   rI   r(   rG   s       r   __deepcopy__zRootModel.__deepcopy__m   sd    4jjKK:xD'I'I'IJJJ 	4d4;W6X6XYYYr   pythonF)modeincludeexcludecontextby_aliasexclude_unsetexclude_defaultsexclude_none
round_tripwarningsserialize_as_anyrN   Literal['json', 'python'] | strrO   r   rP   rQ   dict[str, Any] | NonerR   bool | NonerS   boolrT   rU   rV   rW   'bool | Literal['none', 'warn', 'error']rX   c                   dS )a  This 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   )r2   rN   rO   rP   rQ   rR   rS   rT   rU   rV   rW   rX   s               r   
model_dumpzRootModel.model_dumpy   s	    4 Cr   otherc                    t          |t                    st          S | j        d         j        |j        d         j        k    o t                                          |          S Nr    )
isinstancer   NotImplemented__pydantic_fields__
annotationr&   __eq__)r2   r`   r*   s     r   rg   zRootModel.__eq__   s[    %++ 	"!!'/:e>W?

 /..	/r   _repr.ReprArgsc              #      K   d| j         fV  d S rb   )r    r?   s    r   __repr_args__zRootModel.__repr_args__   s      dir   )r    r   r+   r,   )N)r    r   r6   r7   r+   r   )r+   r:   )rA   r:   r+   r,   )r+   r   )rI   rJ   r+   r   )rN   rY   rO   r   rP   r   rQ   rZ   rR   r[   rS   r\   rT   r\   rU   r\   rV   r\   rW   r]   rX   r\   r+   r   )r`   r   r+   r\   )r+   rh   )r   r   r   __doc____pydantic_root_model____pydantic_private____pydantic_extra____annotations__r'   r   r5   __pydantic_base_init__classmethodr9   r@   rC   rH   rL   typingTYPE_CHECKINGr_   rg   rj   __classcell__)r*   s   @r   r   r   #   s          #, , , , , 5F N N N N N '+H#K K K K K K [K
 
 
 
= = = =         
 5=-1$("'%*!&$@D%*	 	 	 	 	 	8/ / / / / /               r   r   )	metaclass)#rk   
__future__r   _annotationsrr   r   r   pydantic_corer    r   	_internalr	   r
   mainr   r   rs   r   r   typing_extensionsr   r   fieldsr   PydanticModelFieldr   PydanticModelPrivateAttrModelMetaclassr   __all__TypeVarr   Genericr   r   r   r   <module>r      s   + + 2 2 2 2 2 2          + + + + + +       1 1 1 1 1 1 1 1 , , , , , , , ,	 =########;;;;;;;;333333??????
 BTVnAopppFFFFF1@FF qpFF-<
"FN#677 z  z  z  z  z 	6>*;<H[ z  z  z  z  z  z r   