
    bMh#                        U d dl mZ d dlmZmZ d dlmZ d dlmZm	Z	m
Z
mZ d dlmZ dZded<    G d	 d
e          Z G d de          Ze G d d                      ZddZddZd dZd!dZdS )"    )annotations)	dataclassfield)	TypedDict)ComputedField
CoreSchemaDefinitionReferenceSchema	SerSchema)	TypeAliasz&CoreSchema | SerSchema | ComputedFieldr   
AllSchemasc                  *    e Zd ZU dZded<   	 ded<   dS )GatherResultzSchema traversing result.+dict[str, DefinitionReferenceSchema | None]collected_referenceslist[CoreSchema]deferred_discriminator_schemasN)__name__
__module____qualname____doc____annotations__     a/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/pydantic/_internal/_schema_gather.pyr   r      s7         ##EEEE 5444QQr   r   c                      e Zd ZdZddZdS )	MissingDefinitionErrorz7A reference was pointing to a non-existing core schema.schema_referencestrreturnNonec                   || _         d S )N)r   )selfr   s     r   __init__zMissingDefinitionError.__init__   s     0r   N)r   r   r   r    )r   r   r   r   r#   r   r   r   r   r      s.        AA1 1 1 1 1 1r   r   c                  j    e Zd ZU dZded<   	  ede          Zded<   	  ede          Z	ded	<   d
S )GatherContextzThe 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   N)
r   r   r   r   r   r   listr   dictr   r   r   r   r%   r%   #   s          
 '&&&$7<u%Y]7^7^7^"^^^^
 INSXjnHoHoHooooo r   r%   schemactxr   r    c                x    |                      d          }| d|v r|j                            |            d S d S d S )Nmetadata%pydantic_internal_union_discriminator)getr   append)r,   r-   metas      r   traverse_metadatar4   ?   sO    ::j!!DCtKK*11&99999 KKr   def_ref_schemar	   c                   | d         }||j         vrq|j                            |          }|t          |          | |j         |<   t	          ||           d| v rt	          | d         |           t          | |           d S d |j         |<   d S )N
schema_refserialization)r   r'   r1   r   traverse_schemar4   )r5   r-   r7   
definitions       r   traverse_definition_refr;   E   s    -J111_((44
(444 0> ,
C(((n,,N?;SAAA.#..... 04 ,,,r   contextc                	   | d         }|dk    rt          | |           d S |dk    r3t          | d         |           | d         D ]}t          ||           n |dv rd| v rt          | d         |           n|dk    r!d| v r| d         D ]}t          ||           n|dk    r6d	| v rt          | d	         |           d
| v rt          | d
         |           n}|dk    rI| d         D ]>}t          |t                    rt          |d         |           .t          ||           ?n.|dk    r/| d                                         D ]}t          ||           n|dk    r| d         D ]}t          ||           n|dk    r.t          | d         |           t          | d         |           n|dk    r.t          | d         |           t          | d         |           nn|dv rhd| v rt          | d         |           d| v r| d         D ]}t          ||           | d                                         D ]}t          ||           n|dk    r<d| v r| d         D ]}t          ||           | d         D ]}t          ||           n|dk    rW| d         D ]}t          |d         |           d| v rt          | d         |           d| v rt          | d         |           nc|d k    r#| d         D ]}t          |d         |           n:|d!k    r2t          | d         |           d"| v rt          | d"         |           n|d#k    rt          | d"         |           n|d$k    r5d| v rt          | d         |           d%| v rt          | d%         |           n|d&k    r5d"| v rt          | d"         |           d%| v rt          | d%         |           no|d'k    rOd"| v rt          | d"         |           d| v rt          | d         |           d%| v rt          | d%         |           nd| v rt          | d         |           d(| v rt          | d(         |           t          | |           d S ))Ntypezdefinition-refr'   r,   >   setr*   	frozenset	generatoritems_schematupler+   keys_schemavalues_schemaunionchoicesr   ztagged-union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-wrapr8   )r;   r9   
isinstancerC   valuesr4   )r,   r<   schema_typer:   schoicevsteps           r   r9   r9   Z   s    .K&&&000		%	%x('222 / 	1 	1JJ0000	1	A	A	AV##F>2G<<<			V##N+ , ,7++++			F""F=17;;;f$$F?3W===			Y' 	1 	1F&%(( 1q	733330000		1
 
	&	&	"))++ 	( 	(AAw''''	(			7O 	+ 	+DD'****	+		'	'|,g666/9999	(	(	(}-w777/9999	6	6	6f$$F?3W===&&-. , ,7++++!((** 	( 	(AAw''''	(	(	(	(&&-. , ,7++++! 	( 	(AAw''''	(		#	#*+ 	2 	2AAhK1111&&F#45w???&((F#67AAA		&	&*+ 	2 	2AAhK1111	2			12G<<<f$$F?3W===	(	(	(/9999	)	)	)vF8,g666%//F#=>HHH	(	(	(f$$F?3W===%//F#=>HHH		'	'f$$F?3W===vF8,g666%//F#=>HHHvF8,g666&  /999fg&&&&&r   r   r'   r&   c                ^    t          |          }t          | |           |j        |j        dS )a]  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%   r9   r   r   )r,   r'   r<   s      r   gather_schemas_for_cleaningrb      s>     K((GFG$$$ !( <*1*P  r   N)r,   r   r-   r%   r   r    )r5   r	   r-   r%   r   r    )r,   r   r<   r%   r   r    )r,   r   r'   r&   r   r   )
__future__r   dataclassesr   r   typingr   pydantic_core.core_schemar   r   r	   r
   typing_extensionsr   r   r   r   LookupErrorr   r%   r4   r;   r9   rb   r   r   r   <module>ri      sz   " " " " " " " ( ( ( ( ( ( ( (       e e e e e e e e e e e e ' ' ' ' ' '@
 @ @ @ @R R R R R9 R R R1 1 1 1 1[ 1 1 1        6: : : :4 4 4 4*c' c' c' c'L     r   