o
    j\#                     @  s   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mZ d dlmZ dZded< G d	d
 d
eZG dd deZeG dd dZd"ddZd#ddZd$ddZd%dd Zd!S )&    )annotations)	dataclassfield)	TypedDict)ComputedField
CoreSchemaDefinitionReferenceSchema	SerSchemaiter_union_choices)	TypeAliasz&CoreSchema | SerSchema | ComputedFieldr   
AllSchemasc                   @  s$   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__ r   r   g/var/www/html/fyndo/pharma/fyndo/venv/lib/python3.10/site-packages/pydantic/_internal/_schema_gather.pyr      s   
 r   c                   @  s   e Zd ZdZd	ddZdS )
MissingDefinitionErrorz7A reference was pointing to a non-existing core schema.schema_referencestrreturnNonec                C  s
   || _ d S )N)r   )selfr   r   r   r   __init__%   s   
zMissingDefinitionError.__init__N)r   r   r   r   )r   r   r   r   r   r   r   r   r   r   "   s    r   c                   @  sF   e Zd ZU dZded< 	 ededZded< 	 eded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   
 r    schemactxr   r   c                 C  s2   |  d}|d urd|v r|j|  d S d S d S )Nmetadata%pydantic_internal_union_discriminator)getr   append)r'   r(   metar   r   r   traverse_metadataE   s   
r.   def_ref_schemar   c                 C  st   | d }||j vr3|j|}|d u rt|| |j |< t|| d| v r,t| d | t| | d S d |j |< d S )N
schema_refserialization)r   r"   r+   r   traverse_schemar.   )r/   r(   r0   
definitionr   r   r   traverse_definition_refK   s   


r4   contextc                 C  s  | d }|dkrt | | d S |dkr(t| d | | d D ]}t|| qn|dv r9d| v r7t| d | n|dkrOd| v rM| d D ]}t|| qEn|dkrkd	| v r^t| d	 | d
| v rit| d
 | n|dkr}t| D ]}t|| qsn{|dkr| d  D ]}t|| qng|dkr| d D ]}t|| qnU|dkrt| d | t| d | nA|dkrt| d | t| d | n-|dv rd| v rt| d | d| v r| d D ]}t|| q| d  D ]}t|| qn|dkrd| v r| d D ]}t|| q| d D ]}t|| qn|dkrK| d D ]
}t|d | q'd| v r>t| d | d| v rJt| d | n|dkr`| d D ]
}t|d | qTn|d kryt| d | d!| v rxt| d! | n|d"krt| d! | nr|d#krd| v rt| d | d$| v rt| d$ | nT|d%krd!| v rt| d! | d$| v rt| d$ | n6|d&krd!| v rt| d! | d| v rt| d | d$| v rt| d$ | nd| v rt| d | d'| v rt| d' | t| | d S )(Ntypezdefinition-refr"   r'   >   setr%   	frozenset	generatoritems_schematupler&   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-wrapr1   )r4   r2   r
   valuesr.   )r'   r5   schema_typer3   schoicevstepr   r   r   r2   `   s   





















r2   r   r"   r!   c                 C  s    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    r2   r   r   )r'   r"   r5   r   r   r   gather_schemas_for_cleaning   s
   
rX   N)r'   r   r(   r    r   r   )r/   r   r(   r    r   r   )r'   r   r5   r    r   r   )r'   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.   r4   r2   rX   r   r   r   r   <module>   s   


c