
    Xi\#                        % 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Jr  SrS\S'    " S	 S
\5      r " S S\5      r\ " S S5      5       rSS jrSS jrSS jrSS jrg)    )annotations)	dataclassfield)	TypedDict)ComputedField
CoreSchemaDefinitionReferenceSchema	SerSchemaiter_union_choices)	TypeAliasz&CoreSchema | SerSchema | ComputedFieldr   
AllSchemasc                  0    \ rS rSr% SrS\S'    S\S'   Srg)	GatherResult   zSchema traversing result.+dict[str, DefinitionReferenceSchema | None]collected_referenceslist[CoreSchema]deferred_discriminator_schemas N)__name__
__module____qualname____firstlineno____doc____annotations____static_attributes__r       T/var/www/html/venv/lib/python3.13/site-packages/pydantic/_internal/_schema_gather.pyr   r      s    #EE %54Qr   r   c                  "    \ rS rSrSrSS jrSrg)MissingDefinitionError"   z7A reference was pointing to a non-existing core schema.c                   Xl         g )Nschema_reference)selfr$   s     r   __init__MissingDefinitionError.__init__%   s     0r   r#   N)r$   strreturnNone)r   r   r   r   r   r&   r   r   r   r   r    r    "   s
    A1r   r    c                  X    \ rS rSr% SrS\S'    \" S\S9rS\S'    \" S\	S9r
S	\S
'   Srg)GatherContext)   zyThe current context used during core schema traversing.

Context instances should only be used during schema traversing.
dict[str, CoreSchema]definitionsF)initdefault_factoryr   r   r   r   r   N)r   r   r   r   r   r   r   listr   dictr   r   r   r   r   r,   r,   )   sI    
 '&$7<%Y]7^"$4^
 INSXjnHoEor   r,   c                r    U R                  S5      nUb#  SU;   a  UR                  R                  U 5        g g g )Nmetadata%pydantic_internal_union_discriminator)getr   append)schemactxmetas      r   traverse_metadatar<   E   s;    ::j!DCtK**11&9 Lr   c                   U S   nX!R                   ;  ac  UR                  R                  U5      nUc  [        U5      eXR                   U'   [	        X15        SU ;   a  [	        U S   U5        [        X5        g S UR                   U'   g )N
schema_refserialization)r   r/   r7   r    traverse_schemar<   )def_ref_schemar:   r>   
definitions       r   traverse_definition_refrC   K   s    -J111__((4
(44 0>  ,
(n,N?;SA.. 04  ,r   c                @   U S   nUS:X  a  [        X5        g US:X  a(  [        U S   U5        U S    H  n[        X15        M     GO9US;   a  SU ;   a  [        U S   U5        GOUS:X  a  SU ;   a  U S    H  n[        XA5        M     GOUS:X  a,  S	U ;   a  [        U S	   U5        S
U ;   a  [        U S
   U5        GOUS:X  a  [        U 5       H  n[        XQ5        M     GOUS:X  a'  U S   R                  5        H  n[        Xa5        M     GOsUS:X  a  U S    H  n[        Xq5        M     GOTUS:X  a   [        U S   U5        [        U S   U5        GO.US:X  a   [        U S   U5        [        U S   U5        GOUS;   aY  SU ;   a  [        U S   U5        SU ;   a  U S    H  n[        XA5        M     U S   R                  5        H  n[        XA5        M     GOUS:X  a6  SU ;   a  U S    H  n[        XA5        M     U S    H  n[        XA5        M     GOmUS:X  aG  U S    H  n[        US   U5        M     SU ;   a  [        U S   U5        SU ;   a  [        U S   U5        GO US:X  a  U S    H  n[        US   U5        M     OUS :X  a%  [        U S   U5        S!U ;   a  [        U S!   U5        OUS":X  a  [        U S!   U5        OUS#:X  a+  SU ;   a  [        U S   U5        S$U ;   a  [        U S$   U5        OUS%:X  a+  S!U ;   a  [        U S!   U5        S$U ;   a  [        U S$   U5        O[US&:X  a@  S!U ;   a  [        U S!   U5        SU ;   a  [        U S   U5        S$U ;   a  [        U S$   U5        OSU ;   a  [        U S   U5        S'U ;   a  [        U S'   U5        [	        X5        g )(Ntypezdefinition-refr/   r9   >   setr2   	frozenset	generatoritems_schematupler3   keys_schemavalues_schemaunionztagged-unionchoiceschainstepszlax-or-strict
lax_schemastrict_schemazjson-or-pythonjson_schemapython_schema>   
typed-dictmodel-fieldsextras_schemacomputed_fieldsfieldszdataclass-args	argumentsarguments_schemavar_args_schemavar_kwargs_schemazarguments-v3callreturn_schemazcomputed-fieldzfunction-beforejson_schema_input_schemazfunction-plainzfunction-wrapr?   )rC   r@   r   valuesr<   )r9   contextschema_typerB   schoicevsteps           r   r@   r@   `   s    .K&&0		%x('2 /JJ0 0	A	AV#F>2G<		V#N++ ,		F"F=17;f$F?3W=		(0FF, 1		&	"))+AA' ,		7ODD* $		'|,g6/9	(	(}-w7/9	6	6f$F?3W=&-.+ /!((*AA' +	(	(&-.+ /!AA' "		#*+AAhK1 ,&F#45w?&(F#67A		&*+AAhK1 ,		12G<f$F?3W=	(	(/9	)	)vF8,g6%/F#=>H	(	(f$F?3W=%/F#=>H		'f$F?3W=vF8,g6%/F#=>HvF8,g6& /9f&r   c                `    [        U5      n[        X5        UR                  UR                  S.$ )aA  Traverse the core schema and definitions and return the necessary information for schema cleaning.

During the core schema traversing, any `'definition-ref'` schema is:

- Validated: the reference must point to an existing definition. If this is not the case, a
  `MissingDefinitionError` exception is raised.
- Stored in the context: the actual reference is stored in the context. Depending on whether
  the `'definition-ref'` schema is encountered more that once, the schema itself is also
  saved in the context to be inlined (i.e. replaced by the definition it points to).
)r   r   )r,   r@   r   r   )r9   r/   rb   s      r   gather_schemas_for_cleaningri      s4     K(GF$ !( < <*1*P*P r   N)r9   r   r:   r,   r)   r*   )rA   r	   r:   r,   r)   r*   )r9   r   rb   r,   r)   r*   )r9   r   r/   r.   r)   r   )
__future__r   dataclassesr   r   typingr   pydantic_core.core_schemar   r   r	   r
   r   typing_extensionsr   r   r   r   LookupErrorr    r,   r<   rC   r@   ri   r   r   r   <module>rp      sp    " (   (@
I @R9 R1[ 1   6:4*`'Fr   