
    Ojg                        % S 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rSSK	r	SSK	J
r
JrJrJrJrJrJr  SSKrSSKrSSKrSSKJr  SSKJr  \R.                  " S5      r\\\
4   r\\S'    " S S	\5      rS
\\\
\
4      S\\   S\
SS4S jr SS.S
\
S\\   S\
S\
4S jjr!S
\
S\\\4   SS4S jr"S
\
S\\   S\\   S\#S\$\   SS4S jr%SDS\S\&S\4S jjr'SES\(S\&S\
4S jjr)S\*S\&4S  jr+S!\
S"\\\(4   SS4S# jr,\	RZ                  " S$S%S&9r.SS'S(S)S*SS+.S\
S,\#S-\#S.\#S/\#S0\#S1\\\#      S\4S2 jjr/S\
S,\#S-\#S.\#S/\#S0\#S1\\#   S\4S3 jr0 " S4 S%\Rb                  5      r1 " S5 S6\\Rd                  5      r3S\4S7 jr4S
\\\(4   S\\\(4   4S8 jr5S9\S\\S:\
4   /\S:\
4   4   4S; jr6S<\S\4S= jr7S>\S?\S\4S@ jr8S>\S?\SS4SA jr9S\
SB\*\Rb                     S\&4SC jr:g)FzCommon utilities for the SDK.    N)AnyCallable	FrozenSetOptionalUnionget_args
get_origin)alias_generators)	TypeAliaszgoogle_genai._common
StringDictc                       \ rS rSrSrSrg)ExperimentalWarning&   z"Warning for experimental features. N)__name__
__module____qualname____firstlineno____doc____static_attributes__r       V/var/www/html/leaf-doctor-v1/venv/lib/python3.13/site-packages/google/genai/_common.pyr   r   &   s    *r   r   datakeysvaluereturnc           	      @   Uc  g[        USS 5       GH9  u  p4UR                  S5      (       a  USS nU bS  XP;  aN  [        U[        5      (       a(  [	        [        U5      5       Vs/ s H  n0 PM     snX'   O[        SU SU 35      e[        U[        5      (       a/  U b,  [        X   5       H  u  px[        XUS-   S X'   5        M       gU b  X    H  n[        XUS-   S U5        M       gUR                  S5      (       a.  USS	 nU b
  XP;  a  0 /X'   U b  [        X   S
   XS-   S U5          gU c  GM'  U R                  U0 5      n GM<     U b  U R                  US   5      n	U	bb  U(       d  gX):X  a  g[        U	[        5      (       a'  [        U[        5      (       a  U	R                  U5        g[        SUS    SU	 SU S35      eUS   S:X  a<  [        U [        5      (       a'  [        U[        5      (       a  U R                  U5        gX US   '   ggs  snf )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]r   z+Cannot set value for an existing key. Key: z; Existing value: z; New value: ._self)	enumerateendswith
isinstancelistrangelen
ValueErrorset_value_by_path
setdefaultgetdict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   'Hdefault_valuer:   c          
         US/:X  a  U $ [        U5       H  u  p4U (       d  Us  $ UR                  S5      (       a3  USS nXP;   a%  X    Vs/ s H  n[        XaUS-   S US9PM     sns  $ Us  $ UR                  S5      (       a.  USS nXP;   a   X   (       a  [        X   S	   XS-   S US9s  $ Us  $ X@;   a  X   n M  [        U [        5      (       a  [        X5      (       a  [        X5      n M  Us  $    U $ s  snf )
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   Nr    r!   r9   r"   r#   r   )r&   r'   get_value_by_pathr(   	BaseModelhasattrgetattr)r   r   r:   r2   r3   r4   r7   s          r   r<   r<   t   s    
gYK$fa
||DSbh		 ^
# aa!egmL#
 	

 	e		Sbh		dn N1tEG}M
 	
 	ydI&&74+=+=t!5  6 
++
s   C7pathsc                    UR                  5        H  u  p#UR                  S5      nUR                  S5      n[        5       nSn[        U5       H  u  pU	S:X  d  M  Un  O   US:w  ax  [	        U5      U:  ai  [        U[	        U5      5       HP  nXX   n	U	S:w  d  M  U	R                  S5      (       a  M'  U	R                  S5      (       a  M?  UR                  U	5        MR     [        XUSU5        M     g)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   r"   r   N)	itemssplitsetr&   r+   r*   r'   add_move_value_recursive)
r   r@   source_path	dest_pathsource_keys	dest_keysexclude_keyswildcard_idxr2   r3   s
             r   move_value_by_pathrN      s     !&k##C(K$I 5LLK(	 )
 rc)n|; \3y>2!l#:cll400e9L9L


3
 3 $Y<H- !.r   rJ   rK   key_idxrL   c                    U[        U5      :  a  gX   nUR                  S5      (       a?  USS nX`;   a4  [        X   [        5      (       a  X    H  n[	        XqX#S-   U5        M     gggUS:X  a  [        U [
        5      (       a  [        U R                  5       5       Vs/ s H$  nUR                  S5      (       a  M  X;  d  M"  UPM&     n	nU	 Vs0 s H  oX   _M	     n
nU
R                  5        HH  u  p/ nX#S  H-  nUS:X  a  UR                  U5        M  UR                  U5        M/     [        XU5        MJ     U	 H  nX	 M     ggXP;   a  [	        X   XUS-   U5        ggs  snf s  snf )z>Recursively moves values from source path to destination path.Nr   r    r!   rB   r5   )r+   r'   r(   r)   rG   r0   r   
startswithrC   appendr-   )r   rJ   rK   rO   rL   r3   r4   itemkkeys_to_movevalues_to_movevnew_dest_keysdks                 r   rG   rG      s    K  
#\\$3BxHJt~t<<.$yA+|	
 ! =
 cz$ 		$$ac" '('< $   -99Lq47
Ln9 !&&($!H%B3Y  #  $	 &
 	$q1 ) !G / 6 {
)[Wq[, 3 :s    E$>E$E$E)	snake_strconvertc                 F    U(       d  U $ [         R                  " SS U 5      $ )z>Converts a snake_case string to CamelCase, if convert is True.z_([a-zA-Z])c                 @    U R                  S5      R                  5       $ )Nr!   )groupupper)matchs    r   <lambda>&maybe_snake_to_camel.<locals>.<lambda>   s    ekk!n.B.B.Dr   )resub)rZ   r[   s     r   maybe_snake_to_camelre      s    		 Di	PPr   objconvert_keysc                    [        U [        R                  5      (       a  [        U R	                  SS9U5      $ [        U [
        5      (       a8  U R                  5        VVs0 s H  u  p#[        X!5      [        U5      _M     snn$ [        U [        5      (       a  U  Vs/ s H  n[        XA5      PM     sn$ U $ s  snnf s  snf )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_dumpr0   rC   re   r)   )rf   rg   r3   r   rS   s        r   rk   rk     s     X''((3>>t><lKK#t ))+%JC 	S/1GG%  #t<?@CDOD/C@@J
 As   !!B9B?
annotationc                 2   [        U 5      n[        U 5      nU[        La  gU(       a  [        U5      S:w  a  gUS   n[        U5      n[        U5      nU[        La  gU(       a  [        U5      S:w  a  gUu  pgU[
        L =(       a    U[        R                  L $ )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.
Fr!   r      )r	   r   r)   r+   r0   strtypingr   )rm   outer_origin
outer_argsinner_annotationinner_origin
inner_argskey_type
value_types           r   _is_struct_typery     s     J',
#*	s:!+],-,()*	s:!+ $(	S	5Z6::55r   modelresponsec                 :   [        UR                  5       5      nU GHu  u  p4U R                  R                  5        VVs0 s H  u  p5UR                  U_M     nnnWU R                  ;  a  X6;  a  UR	                  U5        Mg  UR                  X35      nU R                  U   R                  n[        R                  " U5      [        L a  [        R                  " U5      S   n[        U[        5      (       a+  [        R                  " U5      [        La  [        Xt5        GM  [        U[         5      (       d  GM  [        U5      (       a  GM2  U H=  n[        U[        5      (       d  M  [        [        R                  " U5      S   U5        M?     GMx     gs  snnf )zbRemoves extra fields from the response that are not in the model.

Mutates the response in place.
r   N)r)   rC   model_fieldsaliaspopr/   rm   rq   r	   r   r   r(   r0   _remove_extra_fieldsry   )	rz   r{   
key_valuesr3   r   
field_info	alias_maprm   rS   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=   )boundro   d         indent_levelindent_deltamax_len	max_itemsdepthvisitedr   r   r   r   r   r   c                   Uc
  [        5       n[        U 5      nXv;   a  gUS:  a  g[        [        U5      U/-   5      nSU-  nSX-   -  n	[        U [        R
                  5      (       a  U R                  R                  n
/ n[        [        U 5      R                  5      nU Hk  n[        U 5      R                  U   nUR                  (       d  M.   [        X5      nUc  M?  [        UX-   UUUUS-
  US9nUR                  U	 U SU 35        Mm     U(       d  U
 S	3$ U
 S
3SR!                  U5      -   SU S3-   $ [        U ["        5      (       a)  SU ;   a  U R%                  SS5      nSU S3$ [        U 5      $ [        U [&        5      (       a1  [)        U 5      U:  a  [        U SUS-
   5      SS  S3$ [        U 5      $ [        U [*        R,                  R.                  5      (       a  U (       d  gUS::  a'  [)        U 5       S[)        U 5      S:w  a  SOS 3nSU S3$ [)        U 5      U:  a  S[)        U 5       S3$ / n [        U R1                  5       ["        S9nU HH  nU U   n[        UX-   UUUUS-
  US9n[        UX-   UUUUS-
  US9nUR                  U	 U SU 35        MJ     SSR!                  U5      -   SU S3-   $ [        U [        [4        [6        45      (       a  [9        U UUUUUUS9$ [        U 5      nUR%                  SSU	 35      $ ! [         a     GM~  f = f! [2         a    [        U R1                  5       5      n Nf = f)z-Returns a representation of the given object.Nz<... Circular reference ...>r   z<... Max depth ...> r!   r   =z()z(
,

)z"""z\"\"\"   r   z...'z{} items z{<... z at Max depth ...>}z
<dict len=>)r3   z: z{
})	frozensetidr)   r(   rj   r=   	__class__r   sortedtyper}   reprr?   AttributeError_pretty_reprrR   joinrp   replacebytesr+   collectionsabcMappingr   	TypeErrortuplerE   _format_collection)rf   r   r   r   r   r   r   obj_idindentnext_indent_strcls_namerC   fields
field_namer   r   
value_represcapeditem_count_strsorted_keysrT   rW   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$   L=L# 
L L ##M	M	c                   [        U [        5      (       a  SnU nOg[        U [        5      (       a  Sn[        U 5      nOD[        U [        5      (       a  [        U 5      nU (       a  SnOSnO[	        S[        U 5       35      eU(       d  US   US   -   $ US::  a/  [        U5       SS	[        U5      S:g  -   3n	US    S
U	 SUS    3$ SU-  n
SX-   -  n/ n[        [        U5      U5      n[        U5       H-  nX   nUR                  U[        UX-   UUUUS-
  US9-   5        M/     [        U5      U:  a#  UR                  U S
[        U5      U-
   S35        US    S3SR                  U5      -   SU
 US    3-   $ )z(Formats a collection (list, tuple, set).)[])(r   ){r   )zset(r   zUnsupported collection type: r   r!   r   r   z<... z at Max depth ...>r   r   z more items ...>r   r   )r(   r)   r   rE   r,   r   r+   minr*   rR   r   r   )rf   r   r   r   r   r   r   bracketsinternal_objr   r   r   elementsnum_to_showr2   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                   6  ^  \ rS rSr\R
                  " \R                  SSSSSSS\R                  4S9	r
\R                  " SS9\S	\S
\4S j5       5       rS
\4U 4S jjr\S\R"                  \   S\\\4   S\\\4   S
\4S j5       rS
\\\4   4S jrSrU =r$ )r=   i%  Tr   forbidbase64)	alias_generatorpopulate_by_namefrom_attributesprotected_namespacesextraarbitrary_types_allowedser_json_bytesval_json_bytesignored_typesbefore)moder   r   c                 ^   [        U[        [        R                  45      (       d  U$ U R                  R                  5        GHa  u  p#[        U[        5      (       a  UR                  U5      nO[        XS5      nUc  M>  UR                  n[        U5      nU[        L a@  [        U5      nU Vs/ s H  o[        S5      Ld  M  UPM     n	n[        U	5      S:X  a  U	S   n[        U[        5      (       d  M  [        U5      b  M  [        U[        R                  5      (       d  M  [        U[        R                  5      (       d  GM  [        XE5      (       a  GM  [        R!                  SU R"                   SU SUR"                   S[        U5      R"                   35        GMd     U$ s  snf )zFCheck for type mismatches and warn before Pydantic processes the data.Nr!   r   zType mismatch in r$   z: expected z, got )r(   r0   rj   r=   r}   rC   r/   r?   rm   r	   r   r   r   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  sa   
 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   /F*F*c                 X   >  [        U 5      $ ! [         a    [        TU ]  5       s $ f = fN)r   	Exceptionsuper__repr__)selfr   s    r   r   BaseModel.__repr__Z  s0     $  W s   
 ))r   r{   kwargsc                    US L=(       aK    SU;   =(       a?    US   S L=(       a1    [        US   [        5      =(       a    SUS   ;   =(       a    US   S   nU(       d  [        X5        U R                  U5      nU$ )Nconfiginclude_all_fields)r(   r0   r   model_validate)r   r{   r   should_skip_removing_fieldsvalidated_responses        r   _from_responseBaseModel._from_response`  s     	d 	3	38D(	3 vh'.	3 !F8$44		3
 812   '3)++H5r   c                 "    U R                  SSS9$ )NTjson)ri   r   )rl   )r   s    r   to_json_dictBaseModel.to_json_dict|  s    ??6?::r   )r   r   r   r   rj   
ConfigDictr
   to_camelrq   TypeVarmodel_configmodel_validatorclassmethodr   r   rp   r   Typer   r0   objectr   r   r   __classcell__r   s   @r   r=   r=   %  s    $$&//"^^%, *"c "c "  +"H    ;;q> S&[! 3;	
 	 6;Df- ; ;r   c                   B   ^  \ rS rSrSr\S\S\4U 4S jj5       rSrU =r	$ )CaseInSensitiveEnumi  zCase insensitive enum.r   r   c                 @  >  XR                  5          $ ! [         a~     XR                  5          s $ ! [         a[    [        R                  " U SU R
                   35         [        TU ]  X5      n[        U5      Ul	        Xl
        Us s $ !      g = ff = ff = f)Nz is not a valid )r_   KeyErrorlowerwarningswarnr   r   __new__rp   _name__value_)r   r   unknown_enum_valr   s      r   	_missing_CaseInSensitiveEnum._missing_  s     ;;=!! 
/~>?	 #W_S8
$'J

!%*
"!
!	
sG    
B4B/B$&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&    C C  r   r   c                      [         R                   R                  5       R                  S5      n [        R                  " 5       R
                  SS nU  SU 3$ )zWComposes a timestamped unique name.

Returns:
    A string representing a unique name.
z%Y%m%d%H%M%Sr   r   r5   )datetimenowstrftimeuuiduuid4hex)	timestamp	unique_ids     r   timestamped_unique_namer    sL     ##%..~>)jjlq#);a	{	##r   c                 @   0 n[        U [        5      (       d  U $ U R                  5        GH`  u  p#[        U[        5      (       a)  [        R
                  " U5      R                  S5      X'   MD  [        U[        R                  5      (       a  UR                  5       X'   Mw  [        U[        5      (       a  [        U5      X'   M  [        U[        5      (       a  [        S U 5       5      (       a8  U Vs/ s H(  n[        R
                  " U5      R                  S5      PM*     snX'   [        S U 5       5      (       a%  U Vs/ s H  oDR                  5       PM     snX'   GM;  U Vs/ s H  n[        U5      PM     snX'   GM\  X1U'   GMc     U$ s  snf s  snf s  snf )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   #    U  H  n[        U[        5      v   M     g 7fr   )r(   r   .0rW   s     r   	<genexpr>.encode_unserializable_types.<locals>.<genexpr>  s     15aZ5!!5s   c              3   V   #    U  H  n[        U[        R                  5      v   M!     g 7fr   )r(   r  r  s     r   r  r    s      =u!Z8,,--us   '))r(   r0   rC   r   r   urlsafe_b64encodedecoder  	isoformatencode_unserializable_typesr)   all)r   processed_datar3   r   rW   s        r   r  r    sL    ').	D$		KJJLjc%"44U;BB7Kn	E8,,	-	-!OO-n	E4	 	 7>n	E4	 	 	151	1	1AF
AFAF$$Q'..w7
 
=u=	=	=6;<e{{}e<GLMu!:1=uM!S# !$ 

 =Ms   5/FF)Fmessage.c                 T   ^  S[         S[        4   S[         S[        4   4U 4S jjnU$ )z&Experimental warning, only warns once.func.r   c                 z   >^ ^ Sm[         R                  " T 5      S[        S[        S[        4U UU4S jj5       nU$ )NFr   r   r   c                  Z   > T(       d  Sm[         R                  " T[        SS9  T" U 0 UD6$ )NTro   )r"  category
stacklevel)r  r  r   )r   r   r$  r"  warning_dones     r   wrapper8experimental_warning.<locals>.decorator.<locals>.wrapper  s4     (	

 4"6""r   )	functoolswrapsr   )r$  r*  r)  r"  s   ` @r   	decorator'experimental_warning.<locals>.decorator  sD    L__T	#s 	#c 	#c 	# 	# 	# Nr   )r   r   )r"  r.  s   ` r   experimental_warningr0    s0    
hsCx( Xc3h-? " 
r   key_strc                 B    U R                  SS5      R                  5       $ )z?Normalizes a key for case-insensitive and snake/camel matching.r5   r   )r   r  )r1  s    r   _normalize_key_for_matchingr3    s    	b	!	'	'	))r   target_dictupdate_dictc                    0 nU R                  5        Vs0 s H  n[        U5      U_M     nnUR                  5        H  u  p5[        U5      nXd;   a  XF   nOUn[        U[        5      (       a6  [        U R                  U5      [        5      (       a  [        X   U5      X''   Mg  [        U[        5      (       a*  [        U R                  U5      [        5      (       a  XRU'   M  XRU'   M     U$ s  snf )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   r3  rC   r(   r0   r/   align_key_caser)   )r4  r5  aligned_update_dictr3   target_keys_mapr   normalized_update_keyaligned_keys           r   r7  r7    s     %'7B7G7G7I7I!#&+7I    %%'jc7</#:kk%:$d$ $ *8

"E*& 
E4	 	 Z$d& & */+&).+&) (* 
3s   C-c                    [        X5      nUR                  5        H  u  p4X0;   a<  [        X   [        5      (       a%  [        U[        5      (       a  [	        X   U5        MF  X0;   aU  [        X   [        U5      5      (       d9  [        R                  SU S[        X   5       S[        U5       S35        X@U'   M  X@U'   M     g)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)r7  rC   r(   r0   recursive_dict_updater   r   r   )r4  r5  r8  r3   r   s        r   r=  r=    s    $ '{@'--/jc{'..ud##K,e4		J{/?e$M$Mnn#C5 );#$%\$u+nN ## 0r   r   c                 f  ^ ^ [        T [        5      (       d  [        US5      (       d  g[        U 4S jUR                   5       5      nU(       dQ  [        T [
        R                  5      (       a2   U" 5       m[        U4S j[        T 5      R                   5       5      nU$ U$ ! [         a     gf = f)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   <   >#    U  H  n[        TU5      v   M     g 7fr   r>   )r  fieldrf   s     r   r  "is_duck_type_of.<locals>.<genexpr>F  s     F5EEGC''5E   c              3   <   >#    U  H  n[        TU5      v   M     g 7fr   r@  )r  fobj_privates     r   r  rB  L  s     P9OAQ//9OrC  )	r(   r0   r>   r   r}   rj   r=   r   r,   )rf   r   all_matchedrF  s   `  @r   is_duck_type_ofrH  3  s     T'#~">"> FS5E5EFF+	C););<<EkPc9O9OPPk 
  s   0/B# #
B0/B0)T)F);r   r   collections.abcr   r  enumr,  loggingrc   rq   r   r   r   r   r   r   r	   r  r  rj   r
   typing_extensionsr   	getLoggerr   r0   rp   r   __annotations__Warningr   r)   r-   r<   rN   intrE   rG   boolre   r   rk   r   ry   r   r   r   r   r   r=   Enumr   r  r  r0  r3  r7  r=  rH  r   r   r   <module>rS     s    $       	  R R R    % '			1	2S#X
I &+' +G
4S>
"G*.s)G<?G	GV 9='
'#Y'25''T!IS !Ic3h !ID !IH5
5c5 Cy5 	5
 c(5 
5pQC Q$ Q# Q t  66 6 6B&E &EtCK/@ &ET &ER NN3k* (,{:	{: {: 	{:
 {: {: {: in%{: 	{:|;Q	;Q ;Q 	;Q
 ;Q ;Q ;Q s^;Q 	;Q|X;"" X;v#tyy .$ $#d3;&7 #Df<M #LxS!"HS#X$6672* * *
&&*4&&R!!*4!	!H 4(:(:#;  r   