+
    ig                     x  a  R7 t50 t R t^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RI	t	^ RI
t
^ RI
HtHtHtHtHtHtHt ^ RIt^ RIt^ RIt^ RIHt ^ RIHt ]P0                  ! R4      t]]]3,          t] ^ k  ! R R]4      tR R	 ltR
R/R R llt R R lt!R R lt"R8R R llt#R9R R llt$R R lt%R R lt&]
PN                  ! RRR7      t(R^ R^R^dR^R ^R!R/R" R# llt)R$ R% lt* ! R& R]PV                  4      t+ ! R' R(]]PX                  4      t-R) R* lt.R+ R, lt/R- R. lt0R/ R0 lt1R1 R2 lt2R3 R4 lt3R5 R6 lt4R# ):zCommon utilities for the SDK.N)AnyCallable	FrozenSetOptionalUnionget_args
get_origin)alias_generators)	TypeAliaszgoogle_genai._commonc                       ] tR t^&tRtRtR# )ExperimentalWarningz"Warning for experimental features. N)__name__
__module____qualname____firstlineno____doc____static_attributes__r       g/Users/igloo/.openclaw/workspace/scratch/fb_ad_env/lib/python3.14/site-packages/google/genai/_common.pyr   r   &   s    *r   r   c                    V ^8  d   QhR\         \        \        \        3,          ,          R\        \        ,          R\        RR/# )   datakeysvaluereturnN)r   dictr   liststr)formats   "r   __annotate__r    *   sC     G G
4S>
"G*.s)G<?G	Gr   c           	        Vf   R# \        VRR 4       EFg  w  r4VP                  R4      '       d   VRR pV eU   WP9  dO   \        V\        4      '       d(   \	        \        V4      4       Uu. uF  p/ NK  	  upW&   M\        RV RV 24      h\        V\        4      '       d>   V e:   \        W,          4       F!  w  rx\        WV^,           R W',          4       K#  	   R# V e&   W,           F  p\        WV^,           R V4       K  	   R# VP                  R4      '       d?   VRR pV e   WP9  d   / .W&   V e$   \        W,          ^ ,          W^,           R V4        R# V f   EKU  V P                  V/ 4      p EKj  	  V e   V P                  VR,          4      p	V	en   V'       g   R# W)8X  d   R# \        V	\        4      '       d*   \        V\        4      '       d   V	P                  V4       R# \        RVR,           RV	 RV R	24      hVR,          R
8X  d@   \        V \        4      '       d*   \        V\        4      '       d   V P                  V4       R# W VR,          &   R# R# u upi )a+  Examples:

set_value_by_path({}, ['a', 'b'], v)
  -> {'a': {'b': v}}
set_value_by_path({}, ['a', 'b[]', c], [v1, v2])
  -> {'a': {'b': [{'c': v1}, {'c': v2}]}}
set_value_by_path({'a': {'b': [{'c': v1}, {'c': v2}]}}, ['a', 'b[]', 'd'], v3)
  -> {'a': {'b': [{'c': v1, 'd': v3}, {'c': v2, 'd': v3}]}}
N[]zvalue z$ must be a list given an array path [0]z+Cannot set value for an existing key. Key: z; Existing value: z; New value: ._self)	enumerateendswith
isinstancer   rangelen
ValueErrorset_value_by_path
setdefaultgetr   update)
r   r   r   ikeykey_name_jdexisting_datas
   &&&       r   r/   r/   *   s?    ]
$s)$fa
||DSbh		h2eT""(-c%j(9:(91B(9:$.ugA#G  
E4	 	 T%5dn-DA
AAEG}eh
7 .  >>aaa!eg6 "	e		Sbh		h2		$.+Ta%']EB__S"%d5 %8 
HHT"X&M  ! mT**z%/F/FU#9$r( D  -mE7!E
 	
 r(g
t$$%%ET"X; / ;s   -I*default_valuec                ^    V ^8  d   QhR\         R\        \        ,          R\         R\         /# )r   r   r   r:   r   )r   r   r   )r   s   "r   r    r    t   s0     ' '
'#Y'25''r   c          
     R   VR.8X  d   V # \        V4       EF  w  r4V '       g   Vu # VP                  R4      '       d?   VRR pWP9   d0   W,           Uu. uF  p\        WaV^,           R VR7      NK  	  upu # Vu # VP                  R4      '       dD   VRR pWP9   d5   W,          '       d'   \        W,          ^ ,          W^,           R VR7      u # Vu # W@9   d   W,          p K  \        V \        4      '       d    \        W4      '       d   \        W4      p EK  Vu # 	  V # u upi )zExamples:

get_value_by_path({'a': {'b': v}}, ['a', 'b'])
  -> v
get_value_by_path({'a': {'b': [{'c': v1}, {'c': v2}]}}, ['a', 'b[]', 'c'])
  -> [v1, v2]
r%   r"   N)r:   r#   r'   r(   )r)   r*   get_value_by_pathr+   	BaseModelhasattrgetattr)r   r   r:   r3   r4   r5   r8   s   &&$    r   r=   r=   t   s    
gYK$fa
||DSbh		 ^
# aa!egmL#
 	

 	e		Sbh		dnn N1tEG}M
 	
 	ydI&&74+=+=t!5  6 
++
s    D$c                V    V ^8  d   QhR\         R\        \        \        3,          RR/# )r   r   pathsr   N)r   r   r   )r   s   "r   r    r       s.     !I !IS !Ic3h !ID !Ir   c                   VP                  4        F  w  r#VP                  R4      pVP                  R4      p\        4       pRp\        V4       F  w  rV	R8X  g   K  Tp M	  VR8w  d   \	        V4      V8  dq   \        V\	        V4      4       FW  pWX,          p	V	R8w  g   K  V	P                  R4      '       d   K-  V	P                  R4      '       d   KF  VP                  V	4       KY  	  \        WV^ V4       K  	  R# )a  Moves values from source paths to destination paths.

Examples:
  move_value_by_path(
    {'requests': [{'content': v1}, {'content': v2}]},
    {'requests[].*': 'requests[].request.*'}
  )
    -> {'requests': [{'request': {'content': v1}}, {'request': {'content':
    v2}}]}
r$   *r"   r#   Nr&   )	itemssplitsetr)   r-   r,   r*   add_move_value_recursive)
r   rB   source_path	dest_pathsource_keys	dest_keysexclude_keyswildcard_idxr3   r4   s
   &&        r   move_value_by_pathrP      s     !&k##C(K$I 5LLK(	 )
 rc)n|; \3y>2!l#:cll400e9L9L


3
 3 $Y<H- !.r   c                    V ^8  d   QhR\         R\        \        ,          R\        \        ,          R\        R\        \        ,          RR/# )r   r   rL   rM   key_idxrN   r   N)r   r   r   intrG   )r   s   "r   r    r       sP     5 5
5c5 Cy5 	5
 c(5 
5r   c                4   V\        V4      8  d   R# W,          pVP                  R4      '       dQ   VRR pW`9   dD   \        W,          \        4      '       d&   W,           F  p\	        WqW#^,           V4       K  	  R# R# R# VR8X  d   \        V \
        4      '       d   \        V P                  4       4       Uu. uF&  pVP                  R4      '       d   K  W9  g   K$  VNK(  	  p	pV	 Uu/ uF  qW,          bK  	  p
pV
P                  4        FI  w  r. pW#R  F.  pVR8X  d   VP                  V4       K  VP                  V4       K0  	  \        WV4       KK  	  V	 F  pW K  	  R# R# WP9   d   \	        W,          WV^,           V4       R# R# u upi u upi )z>Recursively moves values from source path to destination path.Nr"   rD   r6   r'   )r-   r*   r+   r   rI   r   r   
startswithrE   appendr/   )r   rL   rM   rR   rN   r4   r5   itemkkeys_to_movevalues_to_movevnew_dest_keysdks   &&&&&         r   rI   rI      s    K  
#\\$3BxHJt~t<<..$yA+|	
 ! =
 cz$ 		$$ac" '('< !$   -99Lq47
Ln9 !&&($!H%B3Y  #  $	 &
 	$q1 ) !G / 6 {
)[Wq[, 3 :s   :FF F,Fc                <    V ^8  d   QhR\         R\        R\         /# )r   	snake_strconvertr   )r   bool)r   s   "r   r    r       s&     Q QC Q$ Q# Qr   c                H    V'       g   V # \         P                  ! RR V 4      # )z>Converts a snake_case string to CamelCase, if convert is True.z_([a-zA-Z])c                 @    V P                  ^4      P                  4       # )   )groupupper)matchs   &r   <lambda>&maybe_snake_to_camel.<locals>.<lambda>   s    ekk!n.B.B.Dr   )resub)r_   r`   s   &&r   maybe_snake_to_camelrl      s    		 Di	PPr   c                <    V ^8  d   QhR\         R\        R\        /# )r   objconvert_keysr   )objectra   r   )r   s   "r   r    r      s!       t  r   c                   \        V \        P                  4      '       d   \        V P	                  RR7      V4      # \        V \
        4      '       d8   V P                  4        UUu/ uF  w  r#\        W!4      \        V4      bK  	  upp# \        V \        4      '       d   V  Uu. uF  p\        WA4      NK  	  up# V # u uppi u upi )a  Recursively converts a given object to a dictionary.

If the object is a Pydantic model, it uses the model's `model_dump()` method.

Args:
  obj: The object to convert.
  convert_keys: Whether to convert the keys from snake case to camel case.

Returns:
  A dictionary representation of the object, a list of objects if a list is
  passed, or the object itself if it is not a dictionary, list, or Pydantic
  model.
T)exclude_none)	r+   pydanticr>   convert_to_dict
model_dumpr   rE   rl   r   )rn   ro   r4   r   rW   s   &&   r   rt   rt     s     X''((3>>t><lKK#t ))+%JC 	S/1GG%  #t<?@CDOD/C@@J
 As   & B=$Cc                0    V ^8  d   QhR\         R\        /# )r   
annotationr   )typera   )r   s   "r   r    r      s     6 6 6 6r   c                P   \        V 4      p\        V 4      pV\        Jd   R# V'       d   \        V4      ^8w  d   R# V^ ,          p\        V4      p\        V4      pV\        Jd   R# V'       d   \        V4      ^8w  d   R# Vw  rgV\
        J ;'       d    V\        P                  J # )zChecks if the given annotation is list[dict[str, typing.Any]]

or typing.List[typing.Dict[str, typing.Any]].

This maps to Struct type in the API.
F)r   r   r   r-   r   r   typingr   )rw   outer_origin
outer_argsinner_annotationinner_origin
inner_argskey_type
value_types   &       r   _is_struct_typer     s     J',
#*	s:!+],-,()*	s:!+ $(	S	5	5Z6::55r   c                V    V ^8  d   QhR\         R\        \        \        3,          RR/# )r   modelresponser   N)r   r   r   rp   )r   s   "r   r    r    =  s/     &E &E &EtCK/@ &ET &Er   c                b   \        VP                  4       4      pV EF  w  r4V P                  P                  4        UUu/ uF  w  r5VP                  VbK  	  pppXV P                  9  d   W69  d   VP	                  V4       Kh  VP                  W34      pV P                  V,          P                  p\        P                  ! V4      \        J d   \        P                  ! V4      ^ ,          p\        V\        4      '       d-   \        P                  ! V4      \        Jd   \        Wt4       EK  \        V\         4      '       g   EK,  \        V4      '       d   EK@  V FB  p\        V\        4      '       g   K  \        \        P                  ! V4      ^ ,          V4       KD  	  EK  	  R# u uppi )zbRemoves extra fields from the response that are not in the model.

Mutates the response in place.
N)r   rE   model_fieldsaliaspopr1   rw   rz   r   r   r   r+   r   _remove_extra_fieldsr   )	r   r   
key_valuesr4   r   
field_info	alias_maprw   rW   s	   &&       r   r   r   =  sD    HNN$%*jc 6;5G5G5M5M5O5O/#
#5O   %$$$)=ll3
--
!C##C(33J $-??:.q1j %6#4#4Z#@#L:-	E4	 	 		$	$$dD!!
vz:1=t
D 7 s   F+Tr>   )boundindent_levelindent_deltamax_len	max_itemsdepthvisitedc                    V ^8  d   QhR\         R\        R\        R\        R\        R\        R\        \        \        ,          ,          R\        /# 	r   rn   r   r   r   r   r   r   r   )r   rS   r   r   r   )r   s   "r   r    r    i  sm     {: {:	{: {: 	{:
 {: {: {: in%{: 	{:r   c               n   Vf   \        4       p\        V 4      pWv9   d   R# V^ 8  d   R# \        \        V4      V.,           4      pRV,          pRW,           ,          p	\        V \        P
                  4      '       d   V P                  P                  p
. p\        \        V 4      P                  4      pV F|  p\        V 4      P                  V,          pVP                  '       g   K3   \        W4      pTf   KE  \        TY,           TTTT^,
          TR7      pTP                  T	 T RT 24       K~  	  V'       g   V
 R2# V
 R2R	P!                  V4      ,           R
V R2,           # \        V \"        4      '       d+   R
V 9   d   V P%                  RR4      pRV R2# \        V 4      # \        V \&        4      '       d7   \)        V 4      V8  d   \        V RV^,
           4      RR  R2# \        V 4      # \        V \*        P,                  P.                  4      '       Ed   V '       g   R# V^ 8:  d)   \)        V 4       R\)        V 4      ^8w  d   RMR 2pRV R2# \)        V 4      V8  d   R\)        V 4       R2# . p \        V P1                  4       \"        R7      pV Fb  pV V,          p\        VW,           VVVV^,
          VR7      p\        VW,           VVVV^,
          VR7      pVP                  V	 V RV 24       Kd  	  RR	P!                  V4      ,           R
V R2,           # \        V \        \4        \6        34      '       d   \9        V VVVVVVR7      # \        V 4      pVP%                  R
R
V	 24      #   \         d     EK  i ; i  \2         d    \        T P1                  4       4      p ELi ; i)z-Returns a representation of the given object.Nz<... Circular reference ...>z<... Max depth ...> r   r   r   r   r   r   =z()z(
,

)z"""z\"\"\"z...'z{} items z{<... z at Max depth ...>}z
<dict len=>)r4   z: z{
}r&   )	frozensetidr   r+   rs   r>   	__class__r   sortedrx   r   reprr@   AttributeError_pretty_reprrV   joinr   replacebytesr-   collectionsabcMappingr   	TypeErrortuplerG   _format_collection)rn   r   r   r   r   r   r   obj_idindentnext_indent_strcls_namerE   fields
field_namer   r   
value_represcapeditem_count_strsorted_keysrX   r[   k_reprv_reprraw_reprs   &$$$$$$                  r   r   r   i  s    _kGc7&)
QY d7mvh./'&<67/X''((}}%%HEDI**+F
9))*5j___( 

#2#	j llo&zl!J<@A- 0 z_Zsejj//Bvha.@@#ss{E;/g7)39#u
3x'S'!)_%cr*+4009#{..// zc(5CA2(FGn~&&:;;
3x)#c(1%%E%388:3/k 
a&a
#2#	f 
#2#	f llo&vhb9:) * UZZ&&2fXR88#eS)**!!  CyHDB&7"899i  Z  %$k%s$   +M9<N 9N	N	$N43N4c                    V ^8  d   QhR\         R\        R\        R\        R\        R\        R\        \        ,          R\        /# r   )r   rS   r   r   )r   s   "r   r    r      sh     ;Q ;Q	;Q ;Q 	;Q
 ;Q ;Q ;Q s^;Q 	;Qr   c                  \        V \        4      '       d   RpT pMj\        V \        4      '       d   Rp\        V 4      pMF\        V \        4      '       d   \        V 4      pV '       d   RpMRpM\	        R\        V 4       24      hV'       g   V^ ,          V^,          ,           # V^ 8:  d<   \        V4       RR\        V4      ^8g  ,           2p	V^ ,           RV	 RV^,           2# RV,          p
RW,           ,          p. p\        \        V4      V4      p\        V4       F@  pW,          pVP                  V\        VW,           VVVV^,
          VR7      ,           4       KB  	  \        V4      V8  d(   VP                  V R\        V4      V,
           R24       V^ ,           R	2R
P                  V4      ,           R
V
 V^,           2,           # )z(Formats a collection (list, tuple, set).zUnsupported collection type: r   r   z<... z at Max depth ...>r   r   z more items ...>r   r   )[])(r   ){r   )zset(r   )r+   r   r   rG   r.   rx   r-   minr,   rV   r   r   )rn   r   r   r   r   r   r   bracketsinternal_objr   r   r   elementsnum_to_showr3   elems   &$$$$$$         r   r   r     s    THL#uH9L#s9L
hh
4T#YK@
AA	A;!$$ aZL)*%S5F5I0J/KLNqk]%//A(1+OO&<67/(C%y1+a?DOO
%4%!)
		
  	"OO
5\!2Y!> ??OP QK=	ejj2	2s6(8A;-5P	PPr   c                     a a ] tR tRt o]P
                  ! ]P                  RRRRRRR]P                  3R7	      t
]P                  ! RR7      ]V3R lR	 l4       4       tV3R
 lV 3R llt]V3R lR l4       tV3R lR ltRtVtV ;t# )r>   i%  Tforbidbase64)	alias_generatorpopulate_by_namefrom_attributesprotected_namespacesextraarbitrary_types_allowedser_json_bytesval_json_bytesignored_typesbefore)modec                &   < V ^8  d   QhRS[ RS[ /# r   r   r   r   )r   __classdict__s   "r   r    BaseModel.__annotate__6  s     " "c "c "r   c                z   \        V\        \        P                  34      '       g   V# V P                  P                  4        EFn  w  r#\        V\        4      '       d   VP                  V4      pM\        WR4      pVf   K@  VP                  p\        V4      pV\        J dF   \        V4      pV Uu. uF  q\        R4      Jg   K  VNK  	  p	p\        V	4      ^8X  d
   V	^ ,          p\        V\        4      '       g   K  \        V4      e   K  \        V\        P                  4      '       g   K  \        V\        P                  4      '       g   EK  \        WE4      '       d   EK&  \        P!                  RV P"                   RV RVP"                   R\        V4      P"                   24       EKq  	  V# u upi )zFCheck for type mismatches and warn before Pydantic processes the data.NzType mismatch in r$   z: expected z, got )r+   r   rs   r>   r   rE   r1   r@   rw   r   r   r   rx   r-   
issubclassloggerwarningr   )
clsr   r   r   r   expected_typeoriginargsargnon_none_typess
   &&        r   _check_field_type_mismatches&BaseModel._check_field_type_mismatches4  sc   
 dT8#5#5677k"%"2"2"8"8":
	D$		$$/	 ++m-(f	5&)-G#DJ1F##G~!#(+-
]D
)
)
]
#
+
]H$6$6
7
7
UH..
/
/..~Qzl ;%../vd5k6J6J5KM	
/ #;8 K Hs   3F8F8c                    < V ^8  d   QhRS[ /# r   r   r   )r   r   s   "r   r    r   Z  s          r   c                Z   <  \        V 4      #   \         d    \        ST `  4       u # i ; iN)r   	Exceptionsuper__repr__)selfr   s   &r   r   BaseModel.__repr__Z  s0     $  W s   
 **c                   < V ^8  d   QhRS[ P                  S[,          RS[S[S[3,          RS[S[S[3,          RS[/# )r   r   r   kwargsr   )rz   Typer   r   r   rp   )r   r   s   "r   r    r   a  sM      ;;q> S&[! 3;	
 	r   c               ,   VR J;'       dd    RV9   ;'       dW    VR,          R J;'       dD    \        VR,          \        4      ;'       d%    RVR,          9   ;'       d    VR,          R,          pV'       g   \        W4       V P                  V4      pV# )Nconfiginclude_all_fields)r+   r   r   model_validate)r   r   r   should_skip_removing_fieldsvalidated_responses   &$$  r   _from_responseBaseModel._from_response`  s     	d 	3 	3	3 	38D(	3 	3 vh'.	3 	3 !F8$44		3 	3
 812   '3)++H5r   c                6   < V ^8  d   QhRS[ S[S[3,          /# r   r   r   rp   )r   r   s   "r   r    r   |  s     ; ;Df- ;r   c                (    V P                  R RR7      # )Tjson)rr   r   )ru   )r   s   &r   to_json_dictBaseModel.to_json_dict|  s    ??6?::r   r   )r   r   r   r   rs   
ConfigDictr	   to_camelrz   TypeVarmodel_configmodel_validatorclassmethodr   r   r   r  r   __classdictcell____classcell__r   r   s   @@r   r>   r>   %  s     $$&//"^^%, *"  +"H     6; ; ;r   c                   L   a a ] tR tRt oRt]V3R lV 3R ll4       tRtVtV ;t	# )CaseInSensitiveEnumi  zCase insensitive enum.c                &   < V ^8  d   QhRS[ RS[ /# )r   r   r   r   )r   r   s   "r   r     CaseInSensitiveEnum.__annotate__  s      C C r   c                V  <  WP                  4       ,          #   \         d     YP                  4       ,          u #   \         d]    \        P                  ! T R T P
                   24        \        ST `  Y4      p\        T4      Tn	        Yn
        Tu u #       R# ; ii ; ii ; i)z is not a valid N)rf   KeyErrorlowerwarningswarnr   r   __new__r   _name__value_)r   r   unknown_enum_valr   s   && r   	_missing_CaseInSensitiveEnum._missing_  s     ;;=!! 
/~>?	 #W_S8
$'J

!%*
"!
!	
sG    B(=B(0B$.&BB$B(B B$B( B$$B(r   )
r   r   r   r   r   r  r  r   r  r  r  s   @@r   r  r    s$        r   r  c                $    V ^8  d   QhR\         /# r   r   )r   s   "r   r    r      s     $ $ $r   c                     \         P                   P                  4       P                  R4      p \        P                  ! 4       P
                  R,          pV  RV 2# )zWComposes a timestamped unique name.

Returns:
    A string representing a unique name.
z%Y%m%d%H%M%S:       Nr6   )datetimenowstrftimeuuiduuid4hex)	timestamp	unique_ids     r   timestamped_unique_namer+    sJ     ##%..~>)jjls#);a	{	##r   c                t    V ^8  d   QhR\         \        \        3,          R\         \        \        3,          /# r   r  )r   s   "r   r    r      s,     # #d3;&7 #Df<M #r   c                   / p\        V \        4      '       g   V # V P                  4        EF  w  r#\        V\        4      '       d*   \        P
                  ! V4      P                  R4      W&   KE  \        V\        P                  4      '       d   VP                  4       W&   Ky  \        V\        4      '       d   \        V4      W&   K  \        V\        4      '       d   \        ;QJ d    R V 4       F  '       d   K   RM	  RM! R V 4       4      '       d8   V Uu. uF(  p\        P
                  ! V4      P                  R4      NK*  	  upW&   \        ;QJ d    R V 4       F  '       d   K   RM	  RM! R V 4       4      '       d%   V Uu. uF  qDP                  4       NK  	  upW&   EK  V Uu. uF  p\        V4      NK  	  upW&   EK  W1V&   EK  	  V# u upi u upi u upi )a  Converts unserializable types in dict to json.dumps() compatible types.

This function is called in models.py after calling convert_to_dict(). The
convert_to_dict() can convert pydantic object to dict. However, the input to
convert_to_dict() is dict mixed of pydantic object and nested dict(the output
of converters). So they may be bytes in the dict and they are out of
`ser_json_bytes` control in model_dump(mode='json') called in
`convert_to_dict`, as well as datetime deserialization in Pydantic json mode.

Returns:
  A dictionary with json.dumps() incompatible type (e.g. bytes datetime)
  to compatible type (e.g. base64 encoded string, isoformat date string).
asciic              3   B   "   T F  p\        V\        4      x  K  	  R # 5ir   )r+   r   .0r[   s   & r   	<genexpr>.encode_unserializable_types.<locals>.<genexpr>  s     15aZ5!!5s   FTc              3   V   "   T F  p\        V\        P                  4      x  K!  	  R # 5ir   )r+   r#  r0  s   & r   r2  r3    s      =u!Z8,,--us   '))r+   r   rE   r   r   urlsafe_b64encodedecoder#  	isoformatencode_unserializable_typesr   all)r   processed_datar4   r   r[   s   &    r   r8  r8    sl    ').	D$		KJJLjc%"44U;BB7Kn	E8,,	-	-!OO-n	E4	 	 7>n	E4	 	 	151151	1	1AF
AFAF$$Q'..w7
 
=u==u=	=	=6;<e{{}e<GLMu!:1=uM!S# !$ 

 =Ms   .GG2G#c                    V ^8  d   QhR\         R\        \        R\        3,          .\        R\        3,          3,          /# )r   messager   .)r   r   r   )r   s   "r   r    r      s;      xS!"HS#X$667r   c                   a  R V 3R llpV# )z&Experimental warning, only warns once.c                d    V ^8  d   QhR\         R\        3,          R\         R\        3,          /# )r   func.r   )r   r   )r   s   "r   r    *experimental_warning.<locals>.__annotate__  s,      hsCx( Xc3h-? r   c                 X   <a a R o\         P                  ! S 4      R V VV3R ll4       pV# )Fc                <    V ^8  d   QhR\         R\         R\         /# )r   r   r   r   r   )r   s   "r   r    =experimental_warning.<locals>.decorator.<locals>.__annotate__  s!     	# 	#s 	#c 	#c 	#r   c                  b   < S'       g    R o\         P                  ! S\        ^R7       S! V / VB # )T)r<  category
stacklevel)r  r  r   )r   r   r?  r<  warning_dones   *,r   wrapper8experimental_warning.<locals>.decorator.<locals>.wrapper  s4     (	

 4"6""r   )	functoolswraps)r?  rH  rG  r<  s   f @r   	decorator'experimental_warning.<locals>.decorator  s/    L__T	# 	# 	# Nr   r   )r<  rL  s   f r   experimental_warningrN    s    
 " 
r   c                0    V ^8  d   QhR\         R\         /# )r   key_strr   r   )r   s   "r   r    r      s     * * * *r   c                B    V P                  RR4      P                  4       # )z?Normalizes a key for case-insensitive and snake/camel matching.r6   r   )r   r  )rP  s   &r   _normalize_key_for_matchingrR    s    	b	!	'	'	))r   c                <    V ^8  d   QhR\         R\         R\         /# )r   target_dictupdate_dictr   
StringDict)r   s   "r   r    r      s$     & &&*4&&r   c                   / pV P                  4        Uu/ uF  p\        V4      VbK  	  ppVP                  4        F  w  r5\        V4      pWd9   d
   WF,          pMTp\        V\        4      '       d<   \        V P                  V4      \        4      '       d   \        W,          V4      W'&   Kr  \        V\        4      '       d,   \        V P                  V4      \        4      '       d   WRV&   K  WRV&   K  	  V# u upi )a  Aligns the keys of update_dict to the case of target_dict keys.

Args:
    target_dict: The dictionary with the target key casing.
    update_dict: The dictionary whose keys need to be aligned.

Returns:
    A new dictionary with keys aligned to target_dict's key casing.
)r   rR  rE   r+   r   r1   align_key_caser   )rT  rU  aligned_update_dictr4   target_keys_mapr   normalized_update_keyaligned_keys   &&      r   rY  rY    s     %'7B7G7G7I7I!#&+7I    %%'jc7</#:kk%:$d$ $ *8

"E*& 
E4	 	 Z$d& & */+&).+&) (* 
3s   C9c                4    V ^8  d   QhR\         R\         RR/# )r   rT  rU  r   NrV  )r   s   "r   r    r      s$     ! !!*4!	!r   c                   \        W4      pVP                  4        F  w  r4W09   dG   \        W,          \        4      '       d+   \        V\        4      '       d   \	        W,          V4       KQ  W09   d_   \        W,          \        V4      4      '       g>   \        P                  RV R\        W,          4       R\        V4       R24       W@V&   K  W@V&   K  	  R# )a  Recursively updates a target dictionary with values from an update dictionary.

We don't enforce the updated dict values to have the same type with the
target_dict values except log warnings.
Users providing the update_dict should be responsible for constructing correct
data.

Args:
    target_dict (dict): The dictionary to be updated.
    update_dict (dict): The dictionary containing updates.
zType mismatch for key 'z'. Existing type: z, new type: z. Overwriting.N)rY  rE   r+   r   recursive_dict_updaterx   r   r   )rT  rU  rZ  r4   r   s   &&   r   r`  r`    s    $ '{@'--/jc{'..ud##K,e4		J{/?e$M$Mnn#C5 );#$%\$u+nN ## 0r   c                f    V ^8  d   QhR\         R\        \        P                  ,          R\        /# )r   rn   r   r   )r   rx   rs   r>   ra   )r   s   "r   r    r    3  s,       4(:(:#;  r   c                B  a a \        S \        4      '       g   \        VR4      '       g   R# \        ;QJ d)    V 3R lVP                   4       F  '       d   K   RM	  RM! V 3R lVP                   4       4      pV'       g   \        S \
        P                  4      '       dk    V! 4       o\        ;QJ d2    V3R l\        S 4      P                   4       F  '       d   K   RM'	  RM#! V3R l\        S 4      P                   4       4      pV# V#   \         d     R# i ; i)a  Checks if an object has all of the fields of a Pydantic model.

This is a duck-typing alternative to `isinstance` to solve dual-import
problems. It returns False for dictionaries, which should be handled by
`isinstance(obj, dict)`.

Args:
  obj: The object to check.
  cls: The Pydantic model class to duck-type against.

Returns:
  True if the object has all the fields defined in the Pydantic model, False
  otherwise.
r   Fc              3   <   <"   T F  p\        SV4      x  K  	  R # 5ir   r?   )r1  fieldrn   s   & r   r2  "is_duck_type_of.<locals>.<genexpr>F  s     F5EEGC''5E   Tc              3   <   <"   T F  p\        SV4      x  K  	  R # 5ir   rd  )r1  fobj_privates   & r   r2  rf  L  s     P9OAQ//9Org  )	r+   r   r?   r9  r   rs   r>   rx   r.   )rn   r   all_matchedrj  s   f& @r   is_duck_type_ofrl  3  s     T'#~">"> FS5E5EFFS5E5EFF+	C););<<EkCPc9O9OPCCCPc9O9OPPk 
  s   $D 6'D  +D DDc                @    V ^8  d   Qh/ ^ \         9   d
   \        ;R&   # )r   rW  )__conditional_annotations__r
   )r   s   "r   r    r       s     # #& ' &I &' $r   )T)F)6rn  r   r   collections.abcr   r#  enumrJ  loggingrj   rz   r   r   r   r   r   r   r   r&  r  rs   r	   typing_extensionsr
   	getLoggerr   r   r   rW  Warningr   r/   r=   rP   rI   rl   rt   r   r   r	  r   r   r   r>   Enumr  r+  r8  rN  rR  rY  r`  rl  r    )rn  s   @r   <module>rv     sQ    $       	  R R R    % '			1	2S#X
 &+' +GT'8<'T!IH5pQ66B&ER NN3k*{: {: 	{:
 {: {: {: )-{:|;Q|X;"" X;v#tyy .$#L2*
&R!Hr   