
    `i                       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"                  rLdd
lmZ ddlmZmZ ddlmZ  edef       G d dej2                               Z ej6                  dd      Znej2                  ZdZ ej6                  d      Z G d deej>                  e   e      Z y)z%RootModel class and type definitions.    )annotationsN)copydeepcopy)PydanticUndefined   )PydanticUserError)_model_construction_repr)	BaseModel_object_setattr)Any)Literaldataclass_transform)FieldF)kw_only_defaultfield_specifiersc                      e Zd Zy)_RootModelMetaclassN)__name__
__module____qualname__     X/var/www/html/ts-aiml.yecor.com/venv/lib/python3.12/site-packages/pydantic/root_model.pyr   r      s    r   r   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.6/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)coder   )model_configgetr   super__init_subclass__)clskwargsr"   	__class__s      r   r'   zRootModel.__init_subclass__9   sD      $$W-#NUg  	!+F+r   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)selfr    data__tracebackhide__s       r   __init__zRootModel.__init__A   sD     ,, u  D##33D3Mr   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    r5   r*   s      r   r6   zRootModel.model_constructM   s     w&Dk&JJr   c                4    | j                   | j                  dS )N__dict____pydantic_fields_set__r8   r0   s    r   __getstate__zRootModel.__getstate__]   s    '+'C'C
 	
r   c                D    t        | d|d          t        | d|d          y )Nr:   r9   )r   )r0   states     r   __setstate__zRootModel.__setstate__c   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.r9   r:   )type__new__r   r   r9   r:   )r0   r(   ms      r   __copy__zRootModel.__copy__g   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.r9   )memor:   )rA   rB   r   r   r9   r   r:   )r0   rF   r(   rC   s       r   __deepcopy__zRootModel.__deepcopy__o   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   )
r0   rI   rJ   rK   rL   rM   rN   rO   rP   rQ   s
             r   
model_dumpzRootModel.model_dump{   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__)r0   otherr*   s     r   rZ   zRootModel.__eq__   sR    %+!!  (33u7I7I&7Q7\7\\vafahaopuavvr   c              #  ,   K   d| j                   f y wrU   )r    r;   s    r   __repr_args__zRootModel.__repr_args__   s     diis   )r    r   returnNone)N)r(   ztype[Model]r    r   r5   zset[str] | Noner^   r   )r^   dict[Any, Any])r>   r`   r^   r_   )r0   r   r^   r   )r0   r   rF   zdict[int, Any] | Noner^   r   )rI   zLiteral['json', 'python'] | strrJ   r   rK   r   rL   boolrM   ra   rN   ra   rO   ra   rP   ra   rQ   ra   r^   r   )r[   r   r^   ra   )r^   z_repr.ReprArgs)r   r   r   __doc____pydantic_root_model____pydantic_private____pydantic_extra____annotations__r'   r   r3   __pydantic_base_init__classmethodr6   r<   r?   rD   rG   typingTYPE_CHECKINGrS   rZ   r]   __classcell__)r*   s   @r   r   r   &   s   
 #
, 5F N '+H#K K
= 
 5=""'%*!&$!	 2	 		
 	 	  	 #	 	 	 	 	(w
 r   r   )	metaclass)!rb   
__future__r   _annotationsri   r   r   pydantic_corer    r   	_internalr	   r
   mainr   r   rj   r   typing_extensionsr   r   fieldsr   PydanticModelFieldModelMetaclassr   TypeVarr   __all__r   Genericr   r   r   r   <module>rz      s    + 2   +  1 ,	>3
 BTAVW1@@  X FNN7+6E-<<
 #FNN#67 o 	6>>*;<H[ o r   