
    ]fU6                    \   d Z ddlmZ ddlZddlZddlZddlmZm	Z	m
Z
mZmZmZmZ ddlmZmZmZ ddlmZmZmZ ddlmZ dd	lmZ dd
lmZ ddlmZ ddlm Z m!Z!m"Z" erddl#m$Z$ dZ% ed          Z&ej'        dk    re eej(        e e"f          eddddddddddd
dFd&                        Z) eej(        e e"f          eddddddddddd
dGd*                        Z)n` eej(        e e"f          eddddddddd+dHd,                        Z) eej(        e e"f          eddddddddd+dId-                        Z) eej(        e e"f          	 dJddddddddddd
dKd0            Z) ee*          Z+d1ej'        cxk    rd2k     rn ndLd7Z,e,ej-        _.        ddd8dd9dMdAZ/dNdEZ0dS )Oz7Provide an enhanced dataclass that performs validation.    )annotationsN)TYPE_CHECKINGAnyCallableGenericNoReturnTypeVaroverload)Literal	TypeGuarddataclass_transform   )_config_decorators_typing_extra)_dataclasses)getattr_migration)
ConfigDict)PydanticUserError)Field	FieldInfoPrivateAttr)PydanticDataclass)	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        
            d S N r!   s
             F/var/www/html/env/lib/python3.11/site-packages/pydantic/dataclasses.pyr   r      s	     	    _clstype[_T]type[PydanticDataclass]c       
            d S r3   r4   )r7   r"   r#   r$   r%   r&   r'   r(   r)   r*   r+   s              r5   r   r   -   s	     #&#r6   r"   r#   r$   r%   r&   r'   r(   r)   c                    d S r3   r4   r;   s           r5   r   r   @   s	     	r6   c                   d S r3   r4   )	r7   r"   r#   r$   r%   r&   r'   r(   r)   s	            r5   r   r   O   s	     #&#r6   type[_T] | NoneGCallable[[type[_T]], type[PydanticDataclass]] | type[PydanticDataclass]c       
   	         |du s
J d            |dus
J d            t           j        dk    rt          |	|
          ni dd
dfd}| |S  ||           S )aS  Usage docs: https://docs.pydantic.dev/2.8/concepts/dataclasses/

    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.
        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]r0   Nonec                   | j         D ]}t          |dg           }|D ]}t          | |d          }t          |t                    s)d|i}t          j        dk    r|j        rd|d<   |j        dur
|j        |d<   t          | |t          j
        di |           | j                            d          i | _        ||         | j        |<   dS )	a  Make 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defaultr   Tr*   r#   r4   )__mro__getattr
isinstancer   sysversion_infor*   r#   setattrdataclassesfield__dict__getrE   )rA   annotation_clsr   
field_namefield_value
field_argss         r5   make_pydantic_fields_compatiblez2dataclass.<locals>.make_pydantic_fields_compatible   s    "k 	J 	JN ".2CRHHK) J J
%c:t<<!+y99  %.{#;
 #w..;3F.,0Jy) #4//)4)9Jv&Z):)H)HZ)H)HIII <##$566>*,C'2=j2I#J//-J		J 	Jr6   r9   c           
        ddl m}  ||           rt          d| j         dd          | }}|t	          | dd          }||}t          j        |          }t          j        	                    |           }| j
        }t          j        |           rLd}| f}t          | t                    rt          | j                 }	||	fz   }t!          j        | j        |          }  |            t%          j        | fd	d
} || _        || _
        |j        | _        |j        | _        t          j        | |dd          }
|
| _        | S )zCreate 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 modelzdataclass-on-model)codeN__pydantic_config__T)r"   r#   r$   r%   r&   r'   Fraise_errorstypes_namespace)_internal._utilsrW   r   __name__rH   r   ConfigWrapperr   DecoratorInfosbuild__doc___pydantic_dataclassesis_builtin_dataclass
issubclassr   __parameters__types	new_classrM   r   __pydantic_decorators__
__module____qualname__complete_dataclass__pydantic_complete__)rA   rW   original_clsconfig_dict
cls_configconfig_wrapper
decoratorsoriginal_docbasesgeneric_basepydantic_completer(   r$   r'   kwargsrU   r%   r#   r&   s              r5   create_dataclassz#dataclass.<locals>.create_dataclass   s    	544444># 	#k3<kkk)   
  &;TBBJ%( .{;; /55c::

 { 5c:: 	7  L
 FE#w'' 0&s'9://#,66C'',,,#

 #

 

 

 

 '1#"%0'41DeT
 
 
 %6!
r6   N)rA   rB   r0   rC   )rA   rB   r0   r9   )rJ   rK   dict)r7   r"   r#   r$   r%   r&   r'   r(   r)   r*   r+   rx   rw   rU   s     ``````    @@r5   r   r   _   s    \ 5===S===5(((*Y(((
7""gU333!J !J !J !JFE E E E E E E E E E E E EN |D!!!r6   )r      )r      argsr   rw   r   c                      t          d          )a9  This 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|   rw   s     r5   _call_initvarr     s    
 :;;;r6      )forcer[   _parent_namespace_depth_types_namespacerA   r   r[   r   intr   dict[str, Any] | Nonec                  |s	| j         rdS ||                                }n7|dk    rt          j        |          pi }|}ni }t          j        | |          }t          j        | t          j        | j	        d          ||          S )ax  Try 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`.
    Nr   )parent_depthF)checkrZ   )
rm   copyr   parent_frame_namespaceget_cls_types_namespacerc   rl   r   r_   rY   )rA   r   r[   r   r   r\   frame_parent_nss          r5   r   r     s    4  
S. 
t'5E5J5J5L5LOO&**"/"FTk"l"l"l"rpr #2"$+CCYYO$7!#"9GGG%+	
 
 
 	
r6   class_rB   "TypeGuard[type[PydanticDataclass]]c               `    	 d| j         v ot          j        |           S # t          $ r Y dS w xY w)zWhether a class is a pydantic dataclass.

    Args:
        class_: The class.

    Returns:
        `True` if the class is a pydantic dataclass, `False` otherwise.
    __pydantic_validator__F)rO   rM   is_dataclassAttributeError)r   s    r5   is_pydantic_dataclassr   F  sG    '6?:_{?WX^?_?__   uus    
--)r"   r,   r#   r-   r$   r-   r%   r-   r&   r-   r'   r-   r(   r.   r)   r/   r*   r-   r+   r-   r0   r1   )r7   r8   r"   r,   r#   r-   r$   r-   r%   r-   r&   r-   r'   r-   r(   r.   r)   r/   r*   r-   r+   r-   r0   r9   )r"   r,   r#   r-   r$   r-   r%   r-   r&   r-   r'   r-   r(   r.   r)   r/   r0   r1   )r7   r8   r"   r,   r#   r-   r$   r-   r%   r-   r&   r-   r'   r-   r(   r.   r)   r/   r0   r9   r3   )r7   r>   r"   r,   r#   r-   r$   r-   r%   r-   r&   r-   r'   r-   r(   r.   r)   r/   r*   r-   r+   r-   r0   r?   )r|   r   rw   r   r0   r   )rA   r9   r   r-   r[   r-   r   r   r   r   r0   r/   )r   rB   r0   r   )1rb   
__future__r   _annotationsrM   rJ   rg   typingr   r   r   r   r   r	   r
   typing_extensionsr   r   r   	_internalr   r   r   r   rc   
_migrationr   r(   r   errorsr   fieldsr   r   r   _internal._dataclassesr   __all__r   rK   rN   r   r^   __getattr__r   InitVar__call__r   r   r4   r6   r5   <module>r      s   = = 2 2 2 2 2 2     



  U U U U U U U U U U U U U U U U U U E E E E E E E E E E : : : : : : : : : : < < < < < < ) ) ) ) ) )       % % % % % % 1 1 1 1 1 1 1 1 1 1 :999999
*WT]]w;+<e[*QRRR  %!37(,     X SR ;+<e[*QRRR  %!37(,& & & & & X SR& &" ;+<e[*QRRR  %!37(,     X SR ;+<e[*QRRR  %!37(,& & & & & X SR& {'8%&MNNN b" !/3$(b" b" b" b" b" ONb"J  ))	S'''''''''< < < < $1K  #$.2.
 .
 .
 .
 .
 .
b     r6   