
    ]fV:                       d Z ddlmZ ddlZddlZddlZddlmZ ddlm	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 d	dlmZ d	dlmZ d	dlmZmZmZmZ er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& 	 	 dFdGdZ' G d d e          Z(dHd#Z) e	d$          dId&            Z*dJd.Z+dd/dKd7Z,dLd;Z-dMd>Z.ddd?dNdBZ/dOdDZ0dOdEZ1dS )PzmPrivate logic related to fields (the `Field()` function and `FieldInfo` class), and arguments to `Annotated`.    )annotationsN)copy)	lru_cache)TYPE_CHECKINGAny)PydanticUndefined)PydanticUserError   )_typing_extra)ConfigWrapper)extract_docstrings_from_cls)Representation)get_cls_type_hints_lenientget_type_hintsis_classvaris_finalvarBaseMetadata   	FieldInfo	BaseModel)StandardDataclass)DecoratorInfosFobjr   localnsdict[str, Any] | Noneinclude_extrasboolreturndict[str, Any]c                    t          | dd          }d}|r)	 t          j        |         j        }n# t          $ r Y nw xY wt          | |||          S )a  Gets type hints for an object by inferring the global namespace.

    It uses the `typing.get_type_hints`, The only thing that we do here is fetching
    global namespace from `obj.__module__` if it is not `None`.

    Args:
        obj: The object to get its type hints.
        localns: The local namespaces.
        include_extras: Whether to recursively include annotation metadata.

    Returns:
        The object type hints.
    
__module__N)globalnsr   r   )getattrsysmodules__dict__KeyErrorr   )r   r   r   module_namer%   s        L/var/www/html/env/lib/python3.11/site-packages/pydantic/_internal/_fields.pyget_type_hints_infer_globalnsr-      sr    $ #|T22K&*H 	{;/8HH 	 	 	D	 #'R`aaaas   / 
<<c                      e Zd ZdZdZdS )PydanticMetadataz0Base class for annotation markers like `Strict`. N)__name__r$   __qualname____doc__	__slots__r0       r,   r/   r/   <   s        ::IIIr5   r/   metadatar   c                 0     t                      |           S )zCreate a new `_PydanticGeneralMetadata` class with the given metadata.

    Args:
        **metadata: The metadata to add.

    Returns:
        The new `_PydanticGeneralMetadata` class.
    )_general_metadata_cls)r6   s    r,   pydantic_general_metadatar9   B   s     # ""8,,,r5   )maxsizetype[BaseMetadata]c                 :    ddl m}   G d dt          |           }|S )zCDo it this way to avoid importing `annotated_types` at import time.r   r   c                      e Zd ZdZddZdS )7_general_metadata_cls.<locals>._PydanticGeneralMetadataz,Pydantic general metadata like `max_digits`.r6   r   c                    || _         d S N)r)   )selfr6   s     r,   __init__z@_general_metadata_cls.<locals>._PydanticGeneralMetadata.__init__V   s    $DMMMr5   N)r6   r   )r1   r$   r2   r3   rB   r0   r5   r,   _PydanticGeneralMetadatar>   S   s.        ::	% 	% 	% 	% 	% 	%r5   rC   )annotated_typesr   r/   )r   rC   s     r,   r8   r8   N   sK     -,,,,,% % % % %#3\ % % % $#r5   cls	type[Any]fieldsdict[str, FieldInfo]config_wrapperr   Nonec                    |j         rAt          |           }|                                D ]\  }}|j        ||v r||         |_        d S d S r@   )use_attribute_docstringsr   itemsdescription)rE   rG   rI   fields_docsann_name
field_infos         r,   _update_fields_from_docstringsrR   \   sk    . ?1#66$*LLNN 	? 	? Hj%-(k2I2I)4X)>
&	? ?	? 	?r5   )typevars_maptype[BaseModel]basestuple[type[Any], ...]types_namespacerS   dict[Any, Any] | None%tuple[dict[str, FieldInfo], set[str]]c                  ddl m} t          | |          }| j                            di           }i }t                      }	|                                D ]#\  }
dk    r|j        D ]}                    |          r|D ]X}t          |          rFddl
m} t          ||          r	|j        v s't          d dt          |           d| d	          Yt!          fd
|j        D                       }t#          j        d d| d| dt&                     t)          |
          r|	                               t-          |
t          | t.                              r|	                               +t1                    s<| j        rdk    rt          dd          t          | di                               d          }|D ]}d t5          j        |          rt5          j         |          ndD             }t          |          r=||u rK|v rP|vrUt#          j        d d| j         d|j         dt&                     	 t          | t.                    }|t.          u rt:          	 t=          |
            |j        |
|          }	 tA          |            n# t:          $ r Y nw xY w# t:          $ r{ |v r |j!        |
          }nci }| j"        ddd         D ]&}|#                    t          |di                      '|v rtI          |                   }n |j!        |
          }Y nw xY w| j        d         }|j%        v rtM          d          ||<   %|r-|'                                D ]}|(                    ||           tS          | ||           ||	fS )a[  Collect the fields of a nascent pydantic model.

    Also collect the names of any ClassVars present in the type hints.

    The returned value is a tuple of two items: the fields dict, and the set of ClassVar names.

    Args:
        cls: BaseModel or dataclass.
        bases: Parents of the class, generally `cls.__bases__`.
        config_wrapper: The config wrapper instance.
        types_namespace: Optional extra namespace to look for types in.
        typevars_map: A dictionary mapping type variables to their concrete types.

    Returns:
        A tuple contains fields and class variables.

    Raises:
        NameError:
            - If there is a conflict between a field name and protected namespaces.
            - If there is a field other than `root` in `RootModel`.
            - If a field shadows an attribute in the parent model.
    r   r   __annotations__model_configr   zField "z" conflicts with member z of protected namespace "z".c              3  F   K   | ]}                     |          |V  d S r@   
startswith).0xrP   s     r,   	<genexpr>z'collect_model_fields.<locals>.<genexpr>   sK       - -hNaNabcNdNd-- - - - - -r5   z)" has conflict with protected namespace "z_".

You may be able to resolve this warning by setting `model_config['protected_namespaces'] = z`.rootzUnexpected field with name z4; only 'root' is allowed as a field of a `RootModel`__pydantic_generic_metadata__originc                    h | ]	}|j         
S r0   name)r`   fields     r,   	<setcomp>z'collect_model_fields.<locals>.<setcomp>   s'          $
     r5   r0   zField name "z" in "z"" shadows an attribute in parent ""Nmodel_fields__pydantic_decorators__z0you can't override a field with a computed field)*rG   r   r   r)   getsetrM   protected_namespacesr_   hasattrmainr   
issubclassrm   	NameErrorr&   tuplewarningswarnUserWarningr   add_is_finalvar_with_default_valr   is_valid_field_name__pydantic_root_model__dataclassesis_dataclassr2   AttributeError#_warn_on_nested_alias_in_annotationfrom_annotated_attributedelattrfrom_annotation	__bases__updater   computed_fields
ValueErrorvaluesapply_typevars_maprR   )rE   rU   rI   rW   rS   r   
type_hintsr   rG   
class_varsann_typeprotected_namespacebr   valid_namespacesgeneric_originbasedataclass_fieldsdefaultrQ   model_fields_lookupra   
decoratorsri   rP   s                           @r,   collect_model_fieldsr   d   sb   < #"""""+CAAJ ,""#4b99K#%F55J(..00 i& i&(~%% #1#F 	 	""#677   Aq(++ 444444 *1i 8 8 X=W=W"+!T( !T !TGTUW_L`L` !T !T<O!T !T !T# # 
 (- - - - -#1#F- - - ( ($ MY( Y YUh Y YDTY Y Y $	   x   	NN8$$$(73J[3\3\]] 	NN8$$$"8,, 	& 	8v+=+=nhnnn   !&ErJJNNxXX 	 	D   EPE]^bEcEc)k);D)A)A)Aik      tX&& >))/// ;..-8 - -33C - -)- - -  	c8->??G+++$$ ,* 0(CCC;;HgNNJX&&&&!   5  	E 	E 	E;&&6Y6x@@

 =?#ttt, O OA'..wq."/M/MNNNN222 "&&9(&C!D!DJJ
 ";!:8!D!DJ#	E> &)\2K%L
z111OPPP%x D]]__ 	D 	DE$$\?CCCC"3???:s%   &K'J88
KKBMMr   rP   strc                   ddl m} t          | d          rl| j        D ]f}t	          j        |          rNt	          j        |          D ]9}t          ||          r'|j         t          j
        d| dt                      n:ed S d S )Nr   r   __args__z `alias` specification on field "z5" must be set on outermost annotation to take effect.)rG   r   rr   r   r   is_annotatedget_args
isinstancealiasrw   rx   ry   )r   rP   r   anno_arganno_type_args        r,   r   r      s    """"""x$$ 	 ) 	 	H)(33 %2%;H%E%E  M!-;; @S@_ ~x~~~'   	 		 	r5   type_valc                    ddl m} t          |           sdS |t          u rdS t	          ||          r|j        t          u r	|j        dS dS )Nr   r   FT)rG   r   r   r   r   r   default_factory)r   r   r   s      r,   r{   r{     sk    """"""u u	!	!	!u	C	#	# 8I)I)IcNaNiutr5   )rS   rI   type[StandardDataclass]ConfigWrapper | Nonec                  ddl m} i }| j        }t          t	          |                     }t
          j                            | j                  }|i |j	        |pi }|
                                D ]\  }	}
t          j        |
j        ||          }t          |          r1|
j        s+|
j        t"          j        k    r|
j        t"          j        k    rct)          |
j        |          rG|
j        j        r$|
j        j        du rt-          d|	 dd           |j        ||
j                  }n |j        ||
          }|||	<   |j        t0          ur5t)          t3          | |	|          |          rt5          | |	|j                   |r-|                                D ]}|                    ||           |t;          | ||           |S )	aF  Collect the fields of a dataclass.

    Args:
        cls: dataclass.
        types_namespace: Optional extra namespace to look for types in.
        typevars_map: A dictionary mapping type variables to their concrete types.
        config_wrapper: The config wrapper instance.

    Returns:
        The dataclass fields.
    r   r   NFzDataclass field zD has init=False and init_var=True, but these are mutually exclusive.zclashing-init-and-init-var)code)rG   r   __dataclass_fields__dictvarsr'   r(   ro   r$   r)   rM   r   eval_type_lenienttyper   initr   r~   MISSINGr   r   init_varr	   r   r   r&   setattrr   r   rR   )rE   rW   rS   rI   r   rG   r   cls_localnssource_modulerP   dataclass_fieldr   rQ   ri   s                 r,   collect_dataclass_fieldsr     s   $ #"""""#%F585MtCyy//KKOOCN33M O]3O8M2O%5%;%;%=%=  7  7!/ 2?3GZeffx   	  $	';+>>>/;3FFF o-y99 	W&/ "*/588+y8yyy9    ;;HoF]^^JJ;;HoVVJ%x%666:gcS[]gFhFhjs;t;t6C:#5666 D]]__ 	D 	DE$$\?CCCC!&sFNCCCMr5   rh   c                .    |                      d           S )N_r^   rg   s    r,   r|   r|   d  s    s####r5   c                X    |                      d          o|                      d           S )Nr   __r^   rg   s    r,   is_valid_privateattr_namer   h  s(    ??3=(=(=$==r5   )NF)r   r   r   r   r   r    r!   r"   )r6   r   r!   r   )r!   r;   )rE   rF   rG   rH   rI   r   r!   rJ   )rE   rT   rU   rV   rI   r   rW   r   rS   rX   r!   rY   )r   rF   rP   r   )r   rF   r   r   r!   r    )
rE   r   rW   r   rS   rX   rI   r   r!   rH   )rh   r   r!   r    )2r3   
__future__r   _annotationsr~   r'   rw   r   	functoolsr   typingr   r   pydantic_corer   pydantic.errorsr	    r   _configr   _docs_extractionr   _reprr   r   r   r   r   rD   r   rG   r   rs   r   _dataclassesr   _decoratorsr   r-   r/   r9   r8   rR   r   r   r{   r   r|   r   r0   r5   r,   <module>r      s   s s 2 2 2 2 2 2     



              % % % % % % % % + + + + + + - - - - - -       " " " " " " 9 9 9 9 9 9 ! ! ! ! ! ! _ _ _ _ _ _ _ _ _ _ _ _ ,,,,,,,""""""      //////++++++
 &* b b b b b:    ~   	- 	- 	- 	- 4
$ 
$ 
$ 
$? ? ? ? +/Y Y Y Y Y Yx   
 
 
 
" +/+/E E E E E EP$ $ $ $> > > > > >r5   