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   ú^/var/www/html/CropPilot/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 )ÚGatherContextz�The 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r·t| d |ƒ t| d |ƒ �nA|dkrËt| d |ƒ t| d |ƒ �n-|dv rùd| v rÚt| d |ƒ d| v rê| d D ]}t||ƒ qâ| d  ¡ D ]}t||ƒ qðnÿ|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�r†t| d! |ƒ nr|d#k�r¤d| v �r—t| d |ƒ d$| v �r£t| d$ |ƒ nT|d%k�rÂd!| v �rµt| d! |ƒ d$| v �rÁt| d$ |ƒ n6|d&k�rìd!| 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Ú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