
    dfU                       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 dd	lmZmZ ej                   r dd
lmZ ddlmZ  ej(                  dd      ZdZ ej(                  d      Z G d deej0                  e         Zy)z%RootModel class and type definitions.    )annotationsN)copydeepcopy)PydanticUndefined   )PydanticUserError)_repr)	BaseModel_object_setattr)Any)LiteralModelr
   )bound)	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dd fd       Zdd	Zdd
ZddZdddZej&                  r"dddddddddd		 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 ddZd fdZddZ xZS )r   a  Usage docs: https://docs.pydantic.dev/2.4/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    | j                   j                  d      }|t        dd      t        |   di | y )Nextraz<`RootModel` does not support setting `model_config['extra']`zroot-model-extra)code )model_configgetr   super__init_subclass__)clskwargsr   	__class__s      L/home/api-vastappli/venv/lib/python3.12/site-packages/pydantic/root_model.pyr   zRootModel.__init_subclass__/   sD      $$W-#NUg  	!+F+    c                p    d}|r|t         urt        d      |}| j                  j                  ||        y )NTz_"RootModel.__init__" accepts either a single positional argument or arbitrary keyword arguments)self_instance)r   
ValueError__pydantic_validator__validate_python)__pydantic_self__r   data__tracebackhide__s       r   __init__zRootModel.__init__7   sE     ,, u  D00@@Uf@gr    c                &    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   _fields_set)r   model_construct)r   r   r+   r   s      r   r,   zRootModel.model_constructC   s     w&Dk&JJr    c                4    | j                   | j                  dS )N__dict____pydantic_fields_set__r.   selfs    r   __getstate__zRootModel.__getstate__S   s    '+'C'C
 	
r    c                D    t        | d|d          t        | d|d          y )Nr0   r/   )r   )r2   states     r   __setstate__zRootModel.__setstate__Y   s&    7?X9YZj%
*;<r    c                    t        |       }|j                  |      }t        |dt        | j                               t        |dt        | j
                               |S )z$Returns a shallow copy of the model.r/   r0   )type__new__r   r   r/   r0   )r2   r   ms      r   __copy__zRootModel.__copy__]   sK    4jKK:tDMM':;4d4;W;W6XYr    c                    t        |       }|j                  |      }t        |dt        | j                  |             t        |dt        | j                               |S )z!Returns a deep copy of the model.r/   )memor0   )r8   r9   r   r   r/   r   r0   )r2   r=   r   r:   s       r   __deepcopy__zRootModel.__deepcopy__e   sO    4jKK:xD'IJ 	4d4;W;W6XYr    pythonF)	modeincludeexcludeby_aliasexclude_unsetexclude_defaultsexclude_none
round_tripwarningsc       	             y)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.
            Nr   )
r2   r@   rA   rB   rC   rD   rE   rF   rG   rH   s
             r   
model_dumpzRootModel.model_dumpq   s    $ r    c                    t        |t              st        S | j                  d   j                  |j                  d   j                  k(  xr t
        |   |      S Nr   )
isinstancer   NotImplementedmodel_fields
annotationr   __eq__)r2   otherr   s     r   rQ   zRootModel.__eq__   sR    %+!!  (33u7I7I&7Q7\7\\vafahaopuavvr    c              #  ,   K   d| j                   f y wrL   )r   r1   s    r   __repr_args__zRootModel.__repr_args__   s     diis   )r   r   returnNone)N)r   ztype[Model]r   r   r+   zset[str] | NonerU   r   )rU   dict[Any, Any])r5   rW   rU   rV   )r2   r   rU   r   )r2   r   r=   zdict[int, Any] | NonerU   r   )r@   zLiteral['json', 'python'] | strrA   r   rB   r   rC   boolrD   rX   rE   rX   rF   rX   rG   rX   rH   rX   rU   r   )rR   r   rU   rX   )rU   z_repr.ReprArgs)__name__
__module____qualname____doc____pydantic_root_model____pydantic_private____pydantic_extra____annotations__r   r   r)   __pydantic_base_init__classmethodr,   r3   r6   r;   r>   typingTYPE_CHECKINGrJ   rQ   rT   __classcell__)r   s   @r   r   r      s   
 #
, ?P h '+H#K K
= 
 5=""'%*!&$!	 2	 		
 	 	  	 #	 	 	 	 	(w
 r    r   )r\   
__future__r   _annotationsrc   r   r   pydantic_corer    r   	_internalr	   mainr
   r   rd   r   typing_extensionsr   TypeVarr   __all__r   Genericr   r   r    r   <module>rp      ss    + 2   +   ,	)FNN7+6E  #FNN#67 o 	6>>*;< o r    