
    5jq                       S r SSKJr  SSKrSSKrSSKrSSKrSSKrSSK	r	SSK
Jr  SSKJrJr  SSKJr  SSKJrJrJrJrJr  SSKrSSKJrJr  SS	KJrJr  S
SKJrJr  S
SKJ r   S
SKJ!r!J"r"  SSK#J$r$  SSK%J&r&J'r'J(r(J)r)  SSK*J+r+J,r,J-r-  SSK.J/r/  SSK0J1r1J2r2  SSK3J4r4J5r5  SSK6J7r7  SSK8J9r9  SSK:J;r;  SSK<J=r=J>r>J?r?J@r@JArAJBrB  SSKCJDrDJErE  SSKFJGrG  \R                  (       a  S
SKIJJrK  S
SKIJLrLJMrM  S
SKIJNrO  S
SKPJQrQ  O\"rR\S" 5       rK\S" 5       rO\SR                  rU " S S \V5      rWS!S".   S9S# jjrX\" S$\K\O\X4S%9 " S& S'\5      5       rYS:S( jrZS;S) jr[          S<S* jr\S=S+ jr]S>S, jr^          S?S- jr_S$SS..             S@S/ jjr`SAS0 jra " S1 S25      rb " S3 S45      rcSBS5 jrdSBS6 jre\" SS79SCS8 j5       rfg)Dz"Private logic for creating models.    )annotationsN)ABCMeta)	lru_cachepartial)FunctionType)AnyCallableGenericLiteralNoReturn)PydanticUndefinedSchemaSerializer)dataclass_transform
deprecated   )PydanticUndefinedAnnotationPydanticUserError)create_schema_validator)GenericBeforeBaseModelWarningPydanticDeprecatedSince20   )ConfigWrapper)DecoratorInfosPydanticDescriptorProxyget_attribute_from_basesunwrap_wrapped_function)collect_model_fieldsis_valid_field_nameis_valid_privateattr_name)GenerateSchema)PydanticGenericMetadataget_model_typevars_map)import_cached_base_modelimport_cached_field_info)set_model_mocks)CallbackGetCoreSchemaHandler)generate_pydantic_signature)_make_forward_refeval_type_backportis_annotatedis_classvarmerge_cls_and_parent_nsparent_frame_namespace)ClassAttributeSafeGetItemProxy)ValidateCallWrapper)Field)	FieldInfoModelPrivateAttr)PrivateAttr)	BaseModelc                  0   ^  \ rS rSrSrSU 4S jjrSrU =r$ )_ModelNamespaceDict:   zsA dictionary subclass that intercepts attribute setting on model classes and
warns about overriding of decorators.
c                   > U R                  US 5      nU(       aJ  X#LaF  [        U[        5      (       a1  [        R                  " SU SUR
                  R                   S35        [        TU ]!  X5      $ )N`z"` overrides an existing Pydantic `z` decorator)	get
isinstancer   warningswarndecorator_infodecorator_reprsuper__setitem__)selfkvexisting	__class__s       e/root/lseg-credit/backend/venv/lib/python3.13/site-packages/pydantic/_internal/_model_construction.pyrB   _ModelNamespaceDict.__setitem__?   sb    D))jCZ.[.[MMAaS B8CZCZCiCiBjjuvww"1((     )rD   strrE   objectreturnNone)__name__
__module____qualname____firstlineno____doc__rB   __static_attributes____classcell__rG   s   @rH   r7   r7   :   s    ) )rJ   r7   Finitc                    g)zOnly for typing purposes. Used as default value of `__pydantic_fields_set__`,
`__pydantic_extra__`, `__pydantic_private__`, so they could be ignored when
synthesizing the `__init__` signature.
NrK   rX   s    rH   NoInitFieldr[   G   s    rJ   T)kw_only_defaultfield_specifiersc                     ^  \ rS rSr   S               SU 4S jjjr\R                  (       d  SS jr\SS j5       r	SU 4S jjr
\SS j5       r\\" SSS	9SS
 j5       5       rSU 4S jjrSrU =r$ )ModelMetaclassQ   Nc           	     	  >^ ^!^" U(       Ga  U R                  U5      u  pn
[        R                  " X#U5      nUR                  US'   [	        X;R
                  X5      nU(       d  U
(       a$  [        X25      m T b  S%U 4S jjnXS'   O	[        US'   XS'   0 U
EUEUS'   [        T#U ]$  " XX#40 UD6n[        5       nUR                  n[        U;   aF  UR                  [        5      UR                  U5      :  a  [        R                  " [!        S5      SS	9  [#        UR$                  S
S5      (       + Ul        UR(                  UR(                  L a  SOSUl        [,        R.                  " U5      Ul        U(       a  XNl        GOv[#        US0 5      R5                  SS5      m"[#        USS5      =(       d    T"m!T!(       Ga0  T"(       Ga(  [7        U!4S jT" 5       5      (       Gd  SSKJn  [=        U"4S jT! 5       5      nUT";   aU  UT!;  aO  SR?                  U Vs/ s H  nUR@                  PM     sn5      nUR@                   SU SUR@                   SU S3nOT"U-   nSR?                  U Vs/ s H  n[C        U5      PM     sn5      nSU S3nSU S3n[        U;  aF  SR?                  U Vs/ s H  nUR@                  PM     snU/-   5      nUSUR@                   SU S3-  n[E        U5      eSST!S.Ul        SUl#        URI                  5        H  u  nnURK                  UU5        M     U(       a  [M        [O        5       5      Ul(        [#        US S5      n[S        U[T        5      (       a  [W        U5      n[Y        UU5      n[[        XUU5        UR\                  (       a  S!U;  a  [_        X5        [a        UUUSUUS"9  UR0                  Rb                  RI                  5        VVs0 s H  u  nnUURd                  _M     snnUl3        [i        U5        [        X]  " S0 UD6  U$ S# H  nURm                  US5        M     UR5                  S$0 5      Ro                  5         [        T#U ]$  " XX#40 UD6$ s  snf s  snf s  snf s  snnf )&a-  Metaclass for creating Pydantic models.

Args:
    cls_name: The name of the class to be created.
    bases: The base classes of the class to be created.
    namespace: The attribute dictionary of the class to be created.
    __pydantic_generic_metadata__: Metadata for generic models.
    __pydantic_reset_parent_namespace__: Reset parent namespace.
    _create_model_module: The module of the class to be created, if created by `create_model`.
    **kwargs: Catch-all for any other keyword arguments.

Returns:
    The new class created by the metaclass.
model_configNc               ,   > [        X5        T" X5        g)z`We need to both initialize private attributes and call the user-defined model_post_init
method.
N)init_private_attributes)rC   contextoriginal_model_post_inits     rH   wrapped_model_post_init7ModelMetaclass.__new__.<locals>.wrapped_model_post_init{   s     0>0?rJ   model_post_init__class_vars____private_attributes__zClasses should inherit from `BaseModel` before generic classes (e.g. `typing.Generic[T]`) for pydantic generics to work properly.r   
stacklevel__pydantic_base_init__F__pydantic_generic_metadata__
parametersrK   __parameters__c              3  ,   >#    U  H	  oT;   v   M     g 7fNrK   ).0xrp   s     rH   	<genexpr>)ModelMetaclass.__new__.<locals>.<genexpr>   s     ?kYjTUZYjs   )RootModelRootTypec              3  6   >#    U  H  oT;  d  M
  Uv   M     g 7frs   rK   )rt   ru   parent_parameterss     rH   rv   rw      s     .c*QQbHbqq*s   		z, zS is a subclass of `RootModel`, but does not include the generic type identifier(s) zL in its parameters. You should parametrize RootModel directly, e.g., `class z(RootModel[z	]): ...`.ztyping.Generic[]zJAll parameters must be present on typing.Generic; you should inherit from .z- Note: `typing.Generic` must go last: `class (z): ...`))originargsrp   __pydantic_parent_namespace____hash__)raise_errorstypes_namespacecreate_model_module)__pydantic_fields_set____pydantic_extra____pydantic_private____annotations__rC   r5   re   r   rN   rO   )8_collect_bases_datar   	for_modelconfig_dictinspect_namespaceignored_typesget_model_post_initrd   rA   __new__r#   __mro__r
   indexr=   r>   r   getattr__init____pydantic_custom_init__ri   __pydantic_post_init__r   build__pydantic_decorators__ro   r;   all
root_modelrx   tuplejoinrP   rL   	TypeError__pydantic_complete__items__set_name__build_lenient_weakvaluedictr-   r   r<   dictunpack_lenient_weakvaluedictr,   set_model_fieldsfrozenset_default_hash_funccomplete_model_classcomputed_fieldsinfomodel_computed_fieldsset_deprecated_descriptors__pydantic_init_subclass__popclear)$mcscls_namebases	namespacero   #__pydantic_reset_parent_namespace___create_model_modulekwargsbase_field_names
class_varsbase_private_attributesconfig_wrapperprivate_attributesrg   clsr5   mrorx   missing_parametersru   parameters_strerror_messagecombined_parametersgeneric_type_label	bases_strnameobjparent_namespacer   rD   rE   instance_slotrf   rp   rz   rG   s$                                   @@@rH   r   ModelMetaclass.__new__S   s   6 DGD[D[\aDbA*A*44UvNN(6(B(BIn%!277" "%<+>y+P(+7@ 4K/03JI/0*4&'2c5L2cPb2cI./#(7?3%#]V\#]C02I++C#~#))G"4syy7K"K1B  ! 07s||E]_d/e+eC(141D1D	HaHa1agxC&*8*>*>s*CC' -4Q1$+C1PRT$U$Y$YZfhj$k!$S*:DAVEV
"3C?kYj?k<k<k>)..c*.c)c&(,==BS[eBe *.HZ3[HZ1AJJHZ3[)\"||n,-. /WWZWcWcVddop~o  @IJ & /@BT.T+)-DW3XDWqCFDW3X)Y/>~>Na-P*88J7K1N & #%/
 )-		u2Mu!1::u2MQcPd2d(eI)"OPSP\P\~]^_h^iiq rM $M22 #",51 ).C% 0557	c  d+ 8 34OPfPh4i1&s,KTR*D11#?@P#Q 5c;KLOSI$$9)D%c1 " /$8 @C?Z?Z?j?j?p?p?r(s?rtq!AFF?r(sC%&s+
 #6@@J "i! "i
 MM+R06687?3%MfMM] 4\ 4Y 3NT )ts   Q2)Q7*Q<&Rc                n    U R                   R                  S5      nU(       a	  X;   a  X!   $ [        U5      e)zNThis is necessary to keep attribute access working for class attribute access.rk   )__dict__r;   AttributeError)rC   itemr   s      rH   __getattr__ModelMetaclass.__getattr__  s4    !%!2!23K!L!d&@)// &&rJ   c                    [        5       $ rs   )r7   )r   r   r   s      rH   __prepare__ModelMetaclass.__prepare__  s    "$$rJ   c                H   > [        US5      =(       a    [        TU ]	  U5      $ )zcAvoid calling ABC _abc_subclasscheck unless we're pretty sure.

See #3829 and python/cpython#92810
__pydantic_validator__)hasattrrA   __instancecheck__)rC   instancerG   s     rH   r    ModelMetaclass.__instancecheck__  s#    
 x!9:buw?XYa?bbrJ   c                L   [        5       n[        5       n[        5       n0 nU  H{  n[        XQ5      (       d  M  XQLd  M  UR                  [	        US0 5      R                  5       5        UR                  UR                  5        UR                  UR                  5        M}     X#U4$ )Nmodel_fields)r#   set
issubclassupdater   keysrj   rk   )r   r5   field_namesr   r   bases         rH   r   "ModelMetaclass._collect_bases_data  s    ,.	 #"u
:<D$**t/D""74#D#I#I#KL!!$"5"56"))$*E*EF  (:::rJ   EThe `__fields__` attribute is deprecated, use `model_fields` instead.)categoryc                P    [         R                  " S[        5        U R                  $ )Nr   )r=   r>   r   r   rC   s    rH   
__fields__ModelMetaclass.__fields__"  s$     	SUn	
    rJ   c                d   > [        [        TU ]	  5       5      nSU;   a  UR                  S5        U$ )Nr   )listrA   __dir__remove)rC   
attributesrG   s     rH   r   ModelMetaclass.__dir__*  s0    %'/+,
:%l+rJ   rK   )NTN)r   rL   r   tuple[type[Any], ...]r   dict[str, Any]ro   zPydanticGenericMetadata | Noner   boolr   
str | Noner   r   rN   type)r   rL   rN   r   )r   r   r   r   rN   zdict[str, object])r   r   rN   r   )r   r   rN   z6tuple[set[str], set[str], dict[str, ModelPrivateAttr]])rN   zdict[str, FieldInfo])rN   z	list[str])rP   rQ   rR   rS   r   typingTYPE_CHECKINGr   classmethodr   r   staticmethodr   propertyr   r   r   rU   rV   rW   s   @rH   r_   r_   Q   s     IM48+/iNiN %iN "	iN
 (FiN .2iN )iN iN 
iN iNV 	' % %c ; ; Wbfg! h ! rJ   r_   c                   [        U SS5      cR  0 nU R                  R                  5        H$  u  p4UR                  5       nU[        Ld  M   XRU'   M&     [        U SU5        gg)zThis function is meant to behave like a BaseModel method to initialise private attributes.

It takes context as an argument since that's what pydantic-core passes when calling it.

Args:
    self: The BaseModel instance.
    context: The context.
r   N)r   rk   r   get_defaultr   object_setattr)rC   re   pydantic_privater   private_attrdefaults         rH   rd   rd   1  sk     t+T2:"&"="="C"C"ED"..0G//)0& #F 	t35EF ;rJ   c                f    SU ;   a  U S   $ [        5       n[        US5      nX2R                  La  U$ g)zaGet the `model_post_init` method from the namespace or the class bases, or `None` if not defined.ri   N)r#   r   ri   )r   r   r5   ri   s       rH   r   r   C  sB    I%*++(*I.u6GHO777 8rJ   c           
     ,  ^ SSK JmJn  [        5       nU[	        5       -   n0 nU R                  S0 5      nSU;   d  SU ;   a  [        S5      e[        5       n	[        U R                  5       5       GH  u  pU
S:X  d  U
S:X  a  M  [        U[        5      (       a>  UR                  U S   :X  a+  S	U ;   a%  UR                  R                  U S	   5      (       a  Mg  [        X5      (       d  UR                  R                  S
:X  a  U	R!                  U
5        M  [        UT5      (       aV  U
R                  S5      (       a  [#        SU
< S35      e[%        U
5      (       a  [#        SSU
-   < SU
< S35      eXU
'   X
	 GM  [        X5      (       a>  [%        U
5      (       d.  U
R'                  S5      =(       d    Sn[#        SU< SU
< S35      eU
R                  S5      (       a  GMr  [)        U
5      (       a'  X;  d  [+        X   5      (       d  U" US9Xz'   X
	 GM  GM  X;   a  GM  X;  d  GM  X;   a  [-        SU
< S3SS9e[        X5      (       a  [-        SU
< S3SS9e[-        SU
 SU< SU
 S3SS9e   UR                  5        H  u  p[)        U5      (       d  M  X;  d  M  X;  d  M%  [+        U5      (       a  M7  X;  d  M>  [/        USS5      S
:w  d  MQ  [        U[0        5      (       aB  [2        R4                  " S5      nUb)   [7        [9        USS S!9UR:                  UR<                  S"9n[?        U5      (       a7  [@        RB                  " U5      tnn[E        U4S# jU 5       S5      nUb  UX}'   M  U" 5       X}'   M     U$ ! ["        [        4 a     Nhf = f)$a  Iterate over the namespace and:
* gather private attributes
* check for items which look like fields but are not (e.g. have no annotation) and warn.

Args:
    namespace: The attribute dictionary of the class to be created.
    ignored_types: A tuple of ignore types.
    base_class_vars: A set of base class class variables.
    base_class_fields: A set of base class fields.

Returns:
    A dict contains private attributes info.

Raises:
    TypeError: If there is a `__root__` field in model.
    NameError: If private attribute name is invalid.
    PydanticUserError:
        - If a field does not have a type annotation.
        - If a field on base class was overridden by a non-annotated attribute.
r   )r3   r4   r   __root__zUTo define root models, use `pydantic.RootModel` rather than a field called '__root__'rb   r   rQ   rR   	functools__zXPrivate attributes must not use dunder names; use a single underscore prefix instead of r|   zJPrivate attributes must not use valid field names; use sunder names, e.g. _z instead of my_fieldz>Fields must not use names with leading underscores; e.g., use )r   zField z defined on a base class was overridden by a non-annotated attribute. All field definitions, including overrides, require a type annotation.zmodel-field-overridden)codez requires a type annotationzmodel-field-missing-annotationz)A non-annotated attribute was detected: `z = z3`. All model fields require a type annotation; if `z` is not meant to be a field, you may be able to resolve this error by annotating it as a `ClassVar` or updating `model_config['ignored_types']`.NFT)is_argumentis_class)globalnslocalnsc              3  N   >#    U  H  n[        UT5      (       d  M  Uv   M     g 7frs   )r<   )rt   rE   r3   s     rH   rv   $inspect_namespace.<locals>.<genexpr>  s     $\1JqJZ<[QQs   %	%)#fieldsr3   r4   r$   default_ignored_typesr;   r   r   r   r   r<   r   rQ   rR   
startswithrG   add	NameErrorr   lstripr   r+   r   r   rL   sys	_getframer)   r(   	f_globalsf_localsr*   typing_extensionsget_argsnext)r   r   base_class_varsbase_class_fieldsr4   r2   all_ignored_typesr   raw_annotationsignored_namesvar_namevaluesuggested_nameann_nameann_typeframer  metadatar   r3   s                      @rH   r   r   O  s   4 7(*I%(=(??68mm$5r:O_$
i(?opp!eM	 12~%5I)Iud##  Il$;;)+""--i.GHH 11U__5O5OS^5^h'/00""4((BBJQP  %X..//2X~.@XLXY[  ,1x(#))2Eh2O2O%__S1?ZN,/|H<qJ 
   &&&x00.k/B[6\6\/:5/I",' 7] (,,'XL )] ^1 
 E--'XL(CDKk  (?zUI V,,4: 6jk :	 m 3z .335%h//2-  ))1,5D(C(( a($#5-hETXY%*__$)NN$ H%%099(CH#$\$\^bc+3?&0+6=(? 6B  &y1 s   (N  NNc                    [        US5      n[        U 5      nUS [        R                  1;   d  [	        USS 5      UR
                  :X  a  X0l        g g )Nr   __code__)r   make_hash_funcrM   r   r   r$  )r   r   base_hash_funcnew_hash_funcs       rH   r   r     sN    -eZ@N"3'M$00GNJX\4]anawaw4w % 5xrJ   c                   ^ U R                   (       a+  [        R                  " U R                   R                  5       6 OS mSU4S jjnU$ )Nc                    g)Nr   rK   )r  s    rH   <lambda> make_hash_func.<locals>.<lambda>  s    ^_rJ   c                   >  [        T" U R                  5      5      $ ! [         a'    [        T" [        U R                  5      5      5      s $ f = frs   )hashr   KeyErrorr/   )rC   getters    rH   	hash_func!make_hash_func.<locals>.hash_func  sJ    	At}}-.. 	A
 />?@@	As    .AA)rC   r   rN   int)r   operator
itemgetterr   )r   r0  r/  s     @rH   r%  r%    s;    >A>N>NX  #"2"2"7"7"9:T_FA rJ   c                    [        U 5      n[        XX#US9u  pVXPl        U R                  R	                  U5        U HO  nU R
                  R                  US5      nUc  M$  UR                  [        Ld  M9  [        XUR                  5        MQ     g)a  Collect and set `cls.model_fields` and `cls.__class_vars__`.

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_mapN)
r"   r   r   rj   r   rk   r   r   r   setattr)	r   r   r   r   r6  r
  r   rD   r  s	            rH   r   r     s~     *#.L-c.htuFj) **..q$76G!GCEMM* rJ   )r   r   c          	        [        U 5      n[        UUU5      n[        [        UR                  SS9USS9nUR
                  (       a  SUR                  ;   a  [        X5        g U R                  X5      n	UR                  U 5      n UR                  U	5      n	Xl        [        U	U U=(       d    U R                   U R"                  U(       a  SOS	UUR$                  5      U l        [)        X5      U l        S
U l        [/        S[1        U R2                  U R4                  US95      U l        g
! [         a,  n
U(       a  e [        XSU
R                   S35         Sn
A
gSn
A
ff = f! UR                   a    [        X5         gf = f)a  Finish building a model class.

This logic must be called after class has been created since validation functions must be bound
and `get_type_hints` requires a class object.

Args:
    cls: BaseModel or dataclass.
    cls_name: The model or dataclass name.
    config_wrapper: The config wrapper instance.
    raise_errors: Whether to raise errors.
    types_namespace: Optional extra namespace to look for types in.
    create_model_module: The module of the class to be created, if created by `create_model`.

Returns:
    `True` if the model is successfully completed, else `False`.

Raises:
    PydanticUndefinedAnnotation: If `PydanticUndefinedAnnotation` occurs in`__get_pydantic_core_schema__`
        and `raise_errors=True`.
F)from_dunder_get_core_schemaunpack)ref_modemodelr:   Ncreate_modelr5   T__signature__)rY   r
  r   )r"   r    r&   r   generate_schemadefer_buildexperimental_defer_build_moder%   __get_pydantic_core_schema__r   r   core_configclean_schemaCollectedInvalid__pydantic_core_schema__r   rQ   rR   plugin_settingsr   r   __pydantic_serializer__r   r.   r'   r   r   r>  )r   r   r   r   r   r   r6  
gen_schemahandlerschemaerC  s               rH   r   r     s}   : *#.LJ +
**NG !!g1]1]&]&11#? !,,S1K((0 $* !8-s~~-;&&"C #36"GC $C '#c>N>N_mnC E ' 166(!}5	 && &s*   $D* E# *
E 4"EE #F Fc                   U R                   R                  5        H>  u  pUR                  =nc  M  [        U5      nUR	                  X5        [        XU5        M@     U R                  R                  5        Hn  u  pUR                  =nc  M  [        [        UR                  5      S5      (       a  M<  [        X5R                  5      nUR	                  X5        [        XU5        Mp     g)z8Set data descriptors on the class for deprecated fields.N__deprecated__)
r   r   deprecation_message_DeprecatedFieldDescriptorr   r7  r   r   r   wrapped_property)r   field
field_infomsgdesccomputed_field_infos         rH   r   r   g  s     --335111C>-c2Dc)C%	 6 '*&?&?&E&E&G"';;;SH34G4X4XY[kll-c3W3WXDc)C% 'HrJ   c                  T    \ rS rSr% SrS\S'   SSS jjrSS jrSSS jjrSS	 jr	S
r
g)rP  iz  a9  Data descriptor used to emit a runtime deprecation warning before accessing a deprecated field.

Attributes:
    msg: The deprecation message to be emitted.
    wrapped_property: The property instance if the deprecated field is a computed field, or `None`.
    field_name: The name of the field being deprecated.
rL   
field_nameNc                    Xl         X l        g rs   )rT  rQ  )rC   rT  rQ  s      rH   r   #_DeprecatedFieldDescriptor.__init__  s     0rJ   c                    X l         g rs   )rX  )rC   r   r   s      rH   r   '_DeprecatedFieldDescriptor.__set_name__  s    rJ   c                   Uc  [        U R                  5      e[        R                  " U R                  [
        R                  SS9  U R                  b  U R                  R                  X5      $ UR                  U R                     $ )Nr   rl   )
r   rX  r=   r>   rT  builtinsDeprecationWarningrQ  __get__r   )rC   r   obj_types      rH   r`  "_DeprecatedFieldDescriptor.__get__  sf    ; 11dhh ; ;J  ,((00??||DOO,,rJ   c                ,    [        U R                  5      ers   )r   rX  )rC   r   r  s      rH   __set__"_DeprecatedFieldDescriptor.__set__  s    T__--rJ   )rX  rT  rQ  rs   )rT  rL   rQ  zproperty | NonerN   rO   )r   type[BaseModel]r   rL   rN   rO   )r   zBaseModel | Nonera  ztype[BaseModel] | NonerN   r   )r   r   r  r   rN   r   )rP   rQ   rR   rS   rT   r   r   r   r`  rd  rU   rK   rJ   rH   rP  rP  z  s"     O1-.rJ   rP  c                  6    \ rS rSrSrSS jrS	S jrS
S jrSrg)_PydanticWeakRefi  a  Wrapper for `weakref.ref` that enables `pickle` serialization.

Cloudpickle fails to serialize `weakref.ref` objects due to an arcane error related
to abstract base classes (`abc.ABC`). This class works around the issue by wrapping
`weakref.ref` instead of subclassing it.

See https://github.com/pydantic/pydantic/issues/6763 for context.

Semantics:
    - If not pickled, behaves the same as a `weakref.ref`.
    - If pickled along with the referenced object, the same `weakref.ref` behavior
      will be maintained between them after unpickling.
    - If pickled without the referenced object, after unpickling the underlying
      reference will be cleared (`__call__` will always return `None`).
c                P    Uc  S U l         g [        R                  " U5      U l         g rs   )_wrweakrefref)rC   r   s     rH   r   _PydanticWeakRef.__init__  s     ; DH{{3'DHrJ   c                >    U R                   c  g U R                  5       $ rs   rj  r   s    rH   __call___PydanticWeakRef.__call__  s    8888:rJ   c                    [         U " 5       44$ rs   )rh  r   s    rH   
__reduce___PydanticWeakRef.__reduce__  s    $&**rJ   ro  N)r   r   )rN   r   )rN   z4tuple[Callable, tuple[weakref.ReferenceType | None]])	rP   rQ   rR   rS   rT   r   rp  rs  rU   rK   rJ   rH   rh  rh    s     (+rJ   rh  c                    U c  g0 nU R                  5        H  u  p# [        U5      nXAU'   M     U$ ! [         a    Un Nf = f)aH  Takes an input dictionary, and produces a new value that (invertibly) replaces the values with weakrefs.

We can't just use a WeakValueDictionary because many types (including int, str, etc.) can't be stored as values
in a WeakValueDictionary.

The `unpack_lenient_weakvaluedict` function can be used to reverse this operation.
N)r   rh  r   )dresultrD   rE   proxys        rH   r   r     sX     	yF		$Q'E q	  M  	E	s   2A Ac                    U c  g0 nU R                  5        H0  u  p#[        U[        5      (       a  U" 5       nUb  X1U'   M*  M,  X1U'   M2     U$ )zAInverts the transform performed by `build_lenient_weakvaluedict`.N)r   r<   rh  )rv  rw  rD   rE   s       rH   r   r     sW    yF	a)**A}q	  1I  MrJ   )maxsizec                 P    SSK Jn   [        [        [        [
        [        U [        4$ )Nr   ComputedFieldInfo)r
  r}  r   r   r   r   r   r0   r|  s    rH   r  r    s&    * 	 rJ   )rY   zLiteral[False]rN   r   r   )r   r   r   r   rN   zCallable[..., Any] | None)
r   r   r   r   r  set[str]r  r~  rN   zdict[str, ModelPrivateAttr])r   rf  r   r   rN   rO   )r   rf  rN   r   )
r   rf  r   r   r   r   r   r   rN   rO   )r   rf  r   rL   r   r   r   r   r   dict[str, Any] | Noner   r   rN   r   )r   rf  rN   rO   )rv  r  rN   r  )rN   r   )grT   
__future__r   _annotationsr^  r3  r  r   r=   rk  abcr   r   r   r   typesr   r   r	   r
   r   r   r  pydantic_corer   r   r   r   errorsr   r   plugin._schema_validatorr   r   r   _configr   _decoratorsr   r   r   r   _fieldsr   r   r   _generate_schemar    	_genericsr!   r"   _import_utilsr#   r$   _mock_val_serr%   _schema_generation_sharedr&   
_signaturer'   _typing_extrar(   r)   r*   r+   r,   r-   _utilsr.   r/   _validate_callr0   r   r
  r1   PydanticModelFieldr2   r3   r4   PydanticModelPrivateAttrmainr5   r_  rM   __setattr__r   r   r7   r[   r_   rd   r   r   r   r%  r   r   r   rP  rh  r   r   r  rK   rJ   rH   <module>r     s   ( 2   
     (  < <  = = C > O " s s Y Y , F M * C 3  5 /	44@  3%x##
)$ 
) !
 	 T=OQikv<wx\W \ y\~G$	EE(E E  	E
 !EP
% +	+!6+HU+hv+	+F &*R	RR "R
 R +R $R 
Rj&& .  .F +  +F(  4 rJ   