
    ,h_Q                    &   d Z ddlmZ ddlZddl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 ddlmZ dd	lmZmZmZ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$m%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/m0Z0 ddl1m2Z2 erddl3m4Z4 ddl5m6Z6 ddl7m8Z8 ddl9m:Z: ddl;m<Z<  G d de0      Z=d,d Z>e
d-d!       Z?d.d/d"Z@dd#	 	 	 	 	 	 	 	 	 d0d$ZAd1d%ZB	 	 	 	 	 	 	 	 d2d&ZCdddd'	 	 	 	 	 	 	 	 	 d3d(ZDd4d)ZEd4d*ZF	 	 	 	 d5d+ZGy)6zmPrivate logic related to fields (the `Field()` function and `FieldInfo` class), and arguments to `Annotated`.    )annotationsN)Mapping)copy)cache)	Parameterismethoddescriptor	signature)Pattern)TYPE_CHECKINGAnyCallableTypeVar)PydanticUndefined)TypeIs
get_origin)typing_objects)AnnotationSource)PydanticDeprecatedSince211)PydanticUserError   )	_generics_typing_extra)ConfigWrapper)extract_docstrings_from_cls)import_cached_base_modelimport_cached_field_info)
NsResolver)Representation)can_be_positionalBaseMetadata   )	FieldInfo)	BaseModel)StandardDataclass)DecoratorInfosc                      e Zd ZdZdZy)PydanticMetadataz0Base class for annotation markers like `Strict`. N)__name__
__module____qualname____doc__	__slots__r)       \/var/www/html/Resume-Scraper/venv/lib/python3.12/site-packages/pydantic/_internal/_fields.pyr(   r(   '   s
    :Ir/   r(   c                 "     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)metadatas    r0   pydantic_general_metadatar4   -   s     # "8,,r/   c                 2    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y)7_general_metadata_cls.<locals>._PydanticGeneralMetadataz,Pydantic general metadata like `max_digits`.c                    || _         y )N)__dict__)selfr3   s     r0   __init__z@_general_metadata_cls.<locals>._PydanticGeneralMetadata.__init__A   s	    $DMr/   N)r3   r   )r*   r+   r,   r-   r;   r)   r/   r0   _PydanticGeneralMetadatar7   >   s
    :	%r/   r<   )annotated_typesr!   r(   )r!   r<   s     r0   r2   r2   9   s     -%#3\ % $#r/   c                    t        | |      }|j                         D ]!  \  }}|j                  ||v s||   |_        # y )Nuse_inspect)r   itemsdescription)clsfieldsr@   fields_docsann_name
field_infos         r0   _update_fields_from_docstringsrH   G   sH    -c{KK & ;*!!)h+.E%0%:J";r/   )typevars_mapc               $
   t               }t               }| j                  }i }t        |      D ]#  }t	        |dd      x}	s|j                  |	       % t        j                  | |      }
| j                  j                  di       }i }t               }|
j                         D ]  \  }\  }}|dk(  r|j                  D ].  }d}t        |t              r|j                  |      du}n!t        |t               r|j#                  |      }|sN|D ]I  }t%        ||      st'        ||      r|t	        |di       v r,t)        d| dt	        ||       d	| d
       d}|j                  D ]Q  }t        |t              r'|j                  |      r%|d|j*                   dfz  }:|j#                  |      rL||fz  }S t-        j.                  d| d| j0                   d| d| d	t2               1 t        j4                  |      r|j7                  |       vt	        | |t8              }t;        |      s| j<                  r|dk7  rt)        d|d      t	        | di       j                  d      }|D ]  }t?        j@                  |      rt?        jB                  |      ndD ch c]  }|jD                   }}t%        ||      sS||u rX||v r]||vrbt-        j.                  d| d| jF                   d|jF                   dt2                |t8        u rL||v s||vr4|jI                  |tJ        jL                        }|s'd|_'        ||_(        ntS        ||         }ntU        ||       t        ||      r6tW        |jX                        r!|jX                  j[                  d|       |_,        |st        ||      rtS        |      n|}|j]                  ||tJ        jL                        }|sd|_'        ||_(        ||_/        nWd|j`                  v rI|jc                         s9t-        j.                  d|d|d|d td        d!"       |j7                  |       	 tg        | |       | j                  d#   }||jj                  v rtm        d$|d%| j0                  d&      |||<   	 |r3|jo                         D ]   }|jN                  s|jq                  |       " |jr                  rtu        | |       ||fS c c}w # th        $ r Y w xY w)'a*  Collect the fields and class variables names of a nascent Pydantic model.

    The fields collection process is *lenient*, meaning it won't error if string annotations
    fail to evaluate. If this happens, the original annotation (and assigned value, if any)
    is stored on the created `FieldInfo` instance.

    The `rebuild_model_fields()` should be called at a later point (e.g. when rebuilding the model),
    and will make use of these stored attributes.

    Args:
        cls: BaseModel or dataclass.
        config_wrapper: The config wrapper instance.
        ns_resolver: Namespace resolver to use when getting model annotations.
        typevars_map: A dictionary mapping type variables to their concrete types.

    Returns:
        A two-tuple containing model fields and class variables names.

    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.
    __pydantic_fields__N)ns_resolver__annotations__model_configFzField "z" conflicts with member z of protected namespace "z".r)   zre.compile()z" in 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__originzField name "z" in "z"" shadows an attribute in parent ""_sourcefinalzAnnotation z= is marked as final and has a default value. Pydantic treats zz as a class variable, but it will be considered as a normal field in V3 to be aligned with dataclasses. If you still want zV to be considered as a class variable, annotate it as: `ClassVar[<type>] = <default>.`   )category
stacklevel__pydantic_decorators__zField z
 of class zf overrides symbol of same name in a parent class. This override with a computed_field is incompatible.);r   r   	__bases__reversedgetattrupdater   get_model_type_hintsr9   getsetrA   protected_namespaces
isinstancer
   matchstr
startswithhasattr
issubclass	NameErrorpatternwarningswarnr*   UserWarningis_classvar_annotationaddr   is_valid_field_name__pydantic_root_model__dataclassesis_dataclassrD   namer,   from_annotationr   CLASS	_complete_original_annotationr   #_warn_on_nested_alias_in_annotationr   default__get__from_annotated_attribute_original_assignment_qualifiersis_requiredr   delattrAttributeErrorcomputed_fields	TypeErrorvaluesapply_typevars_mapuse_attribute_docstringsrH   )rC   config_wrapperrL   rI   r$   
FieldInfo_basesparent_fields_lookupbasemodel_fields
type_hintsr   rD   
class_varsrF   ann_type	evaluatedprotected_namespacens_violationbvalid_namespacespnassigned_valuegeneric_originfielddataclass_fieldsrG   original_assignment
decoratorss                                r0   collect_model_fieldsr   N   s   > )*I)+JMME13 6"4)>EE<E ''56 33C[QJ ,,""#4b9K#%F5J+5+;+;+= R&''8Y~% #1#F#F 	!&L-w7288B$N/5'223FG Aq(+ *1i 8XQRTikmIn=n"+")(3KGTUW_L`Ka";<O;PPR!T#  (*$,AA :%b'2#%88H#5 0{2::,a5P4R R 0#+#6#6r#: 0RE 9 0: MM!(5>fgzf{ |DDTCUUWY $	3	> //9NN8$ h0AB"8,&&8v+=-h\9mn  !&ErJNNxX 	DEPE]E]^bEc););D)Aik $

    tX&>)// ;."8*F33C3C2D E))*!-%	0 ..;&(:N*N (77JZJ`J`7a
 +0J( 7?J3 ""6x"@A
 0(C.*5:L^McMc:d *8)?)?)G)Gc)R& -6*^U_:`^$ft   $<<X~_o_u_u<vJ',
$ 3;
/2E
/J222:;Q;Q;S!(-jksjv w""*  .DE 8  x(
X& &)\\2K%L
z111Js||.> ?G G  &xeR&h ]]_ 	7E((6	7 ..&sF3:I ` " s   &S> T	TTc                ,   t               }t        | dd       }|r{|D ]u  }t        j                  t	        |            s"t        j                  |      D ]<  }t        ||      s|j                  t        j                  d| dt                 y  w y y )N__args__z `alias` specification on field "z5" must be set on outermost annotation to take effect.)r   r]   r   is_annotatedr   r   get_argsrc   aliasrk   rl   rm   )r   rF   r#   argsanno_arganno_type_args         r0   ry   ry     s    (*I8Z.D 	H**:h+?@%2%;%;H%E M!-;@S@S@_ >xjH}~' 	 r/   c               f   t               }i }|j                  |       5  | j                  j                         D ]  \  }}|j                  r|||<   |j
                  }t        j                  |j                  g|j                   }t        j                  ||      }|j                  x}	t        u r"|j                  |t        j                         }
n"|j#                  ||	t        j                         }
|
j
                  |
j
                  n||
_        |
||<    	 ddd       |S # 1 sw Y   |S xY w)ah  Rebuild the (already present) model fields by trying to reevaluate annotations.

    This function should be called whenever a model with incomplete fields is encountered.

    Note:
        This function *doesn't* mutate the model fields in place, as it can be called during
        schema generation, where you don't want to mutate other model's fields.
    rT   N)r   pushrK   rA   rw   rB   r   	eval_typerx   types_namespacer   replace_typesr}   r   ru   r   rv   r|   )rC   rL   rI   r   rebuilt_fieldsf_namerG   existing_descannassign	new_fields              r0   rebuild_model_fieldsr   ,  s/    *+J+-N			#	 3"%"9"9"?"?"A 	3FJ##)3v& * 6 6#--33 00  --c<@(===FBSS * : :3HXH^H^ : _I * C CCYiYoYo C pIAJAVAVAb	(=(=hu	%)2v&#	33( )3( s   C=D&&D0)rL   rI   r   c          
        t               }i }|xs
 t               }| j                  }t        | j                        D ]  }t        j                  |      s|j                  |      5  |j                         D ]  \  }}	||j                  j                  di       vr&|j                  \  }
}t        j                  |	j                  |
|      \  }}t        j                  |      ro|	j                   s9|	j"                  t
        j$                  u r|	j&                  t
        j$                  u rt)        |	j"                  |      rn|	j"                  j*                  r+|	j"                  j                   du rt-        d| dd      |j/                  ||	j"                  t0        j2                        }n"|j/                  ||	t0        j2                        }|||<   |j"                  t4        usst)        t7        | ||      |      st9        | ||j"                          	 ddd        |r&|j;                         D ]  }|j=                  |        |%|j>                  rtA        | |tC        | d	       
       |S # 1 sw Y   IxY w)a|  Collect the fields of a dataclass.

    Args:
        cls: dataclass.
        ns_resolver: Namespace resolver to use when getting dataclass annotations.
            Defaults to an empty instance.
        typevars_map: A dictionary mapping type variables to their concrete types.
        config_wrapper: The config wrapper instance.

    Returns:
        The dataclass fields.
    rM   FzDataclass field zD has init=False and init_var=True, but these are mutually exclusive.zclashing-init-and-init-var)coderT   N__is_pydantic_dataclass__r?   )"r   r   __dataclass_fields__r\   __mro__rr   rs   r   rA   r9   r`   r   r   try_eval_typetypern   initrz   MISSINGdefault_factoryrc   init_varr   r|   r   	DATACLASSr   r]   setattrr   r   r   rH   rg   )rC   rL   rI   r   r   rD   r   r   rF   dataclass_fieldglobalnslocalnsr   _rG   r   s                   r0   collect_dataclass_fieldsr   T  s   & *+J#%F-K//
 % 2?''-d# .	?-=-C-C-E -?)/4==#4#45F#KK $/$?$?!'+99/:N:NPXZab! 77A (,,'//;3F3FF'77;;N;NN o55zB&..77*22775@"3"28*  =A  !B%A#  !!+!D!D /"9"9CSC]C] "E "J ",!D!D /;K;U;U "E "J $.x %%->>:C:6
D C:+=+=>[-?.	? .	?	2?h ]]_ 	3E $$\2		3 !n&M&M& $C)DEE	
 MA.	? .	?s   'FI;+I;I;;J	c                &    | j                  d       S )Nr   rf   rt   s    r0   rp   rp     s    s###r/   c                L    | j                  d      xr | j                  d       S )Nr   __r   r   s    r0   is_valid_privateattr_namer     s"    ??3=(=$==r/   c                   	 t        |       }t        |j                  j                               }t        |      dk(  xr/ t        |d         xr |d   j                  t        j                  u S # t        t        f$ r Y yw xY w)zMWhether the provided default factory callable has a validated data parameter.Fr   r   )r	   
ValueErrorr   list
parametersr   lenr   rz   r   empty)r   sigr   s      r0   takes_validated_data_argumentr     s    ( cnn++-.Jz?aq$5jm$DqTUI^I^bkbqbqIqq 	"  s   A/ /B B)r3   r   returnr!   )r   ztype[BaseMetadata])F)rC   	type[Any]rD   dict[str, FieldInfo]r@   boolr   None)
rC   type[BaseModel]r   r   rL   NsResolver | NonerI   zMapping[TypeVar, Any] | Noner   z%tuple[dict[str, FieldInfo], set[str]])r   r   rF   re   r   r   )rC   r   rL   r   rI   zMapping[TypeVar, Any]r   r   )
rC   ztype[StandardDataclass]rL   r   rI   zdict[Any, Any] | Noner   zConfigWrapper | Noner   r   )rt   re   r   r   )r   z3Callable[[], Any] | Callable[[dict[str, Any]], Any]r   z'TypeIs[Callable[[dict[str, Any]], Any]])Hr-   
__future__r   _annotationsrr   rk   collections.abcr   r   	functoolsr   inspectr   r   r	   rer
   typingr   r   r   r   pydantic_corer   typing_extensionsr   r   typing_inspectionr   typing_inspection.introspectionr   pydanticr   pydantic.errorsr    r   r   _configr   _docs_extractionr   _import_utilsr   r   _namespace_utilsr   _reprr   _utilsr   r=   r!   rD   r#   mainr$   _dataclassesr%   _decoratorsr&   r(   r4   r2   rH   r   ry   r   r   rp   r   r   r)   r/   r0   <module>r      se   s 2   #   < <  8 8 + 0 , < / - & " 9 M ( ! %," /+~ 	- 
$ 
$; 26K	K!K #K
 /K +K\ %	% % (	%
 %V &**.+/`	 ` #` (	`
 )` `F$>rHr,rr/   