
    9Cg}             
      <   U d Z ddlmZ ddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddlZddlZddlmZmZ ddlmZmZ ddlmZ ddlmZ ddlmZ dd	lmZmZmZ dd
lmZmZm Z m!Z!m"Z"m#Z# ddl$m%Z% ddl&m'Z' ddl(m)Z)m*Z*m+Z+ ddlm,Z,m-Z-m.Z.m/Z/m0Z0m1Z1m2Z2m3Z3m4Z4m5Z5m6Z6m7Z7m8Z8m9Z9 ddl:m;Z; ddlm<Z< ddl=Z=ddl>m?Z?m@Z@mAZAmBZBmCZCmDZDmEZEmFZF ddl=mGZGmHZHmIZImJZJmKZKmLZL ddlMmNZNmOZOmPZP ddlQmRZRmSZS ddlTmUZUmVZVmWZW ddlXmYZYmZZZm[Z[ ddl\m]Z]m^Z^m_Z_m`Z`maZa ddlbmcZc ddldmeZe ddlmfZf ddlgmhZhmiZimjZjmkZkmlZl ddlmmnZnmoZo ddlpmqZqmrZr dd lhmsZsmtZtmuZumvZvmwZwmxZxmyZymzZzm{Z{ dd!lim|Z|m}Z}m~Z~mZmZmZmZmZmZmZmZmZ dd"lmZ dd#lmZ dd$lmZ dd%lmZmZmZmZ dd&lmZmZ dd'lmZ dd(lmZ dd)llmZmZmZmZmZ dd*lmZmZ e,r dd+lmZmZ dd,lmZ dd-l(mZ dd.lmZ dd/lmZ ej        d0k    Ze7eee~f         Z e6d1e2          Ze7e|e         e|e         e|e~         f         ZeRZe.e-egeEj?        f         Zeej        gZd3ed4<   eej        ej        j        gZd3ed5<   eej        ej        j        gZd3ed6<   eej        ej        j        gZd3ed7<   eej/        gZd3ed8<   eee e!e"e#gZd3ed9<   ej        ej        j        gZd3ed:<   e	j        e
j        e
j        e
j        e
j        e
j        gZd3ed;<   ej4        ej        ej        j4        ej        j        ej        e=j        ej        ej        ej        ej        g
Zej        ej        gZd3ed<<   e^e]e`ead=Zd>ed?<   ddFZddLZddPZddWZddXddaZe/e5e-         eWf         ZddfZe7e/ee-f         df         Z G dg dh          ZddkZ G dl dm          Zdn do dp dq dr ds dt du dvZdwedx<   dd{Zdd}ZddZddZddZddZddZ G d deI          ZddddddddZ G d d          ZddZ G d d          Z G d d          ZdS )z-Convert python types to pydantic-core schema.    )annotationsN)	ExitStackcontextmanager)copydeepcopy)Decimal)Enum)partial)	Parameter_ParameterKind	signature)IPv4AddressIPv4InterfaceIPv4NetworkIPv6AddressIPv6InterfaceIPv6Network)chain)
attrgetter)FunctionType
LambdaType
MethodType)TYPE_CHECKINGAnyCallableDictFinal
ForwardRefIterableIteratorMappingTypeTypeVarUnioncastoverload)UUID)warn)
CoreSchemaMultiHostUrlPydanticCustomError$PydanticSerializationUnexpectedValuePydanticUndefinedUrlcore_schemato_jsonable_python)LiteralTypeAliasType	TypedDictget_args
get_originis_typeddict   )AliasChoicesAliasGenerator	AliasPath)GetCoreSchemaHandlerGetJsonSchemaHandler)
ConfigDictJsonDictJsonEncoder)PydanticSchemaGenerationErrorPydanticUndefinedAnnotationPydanticUserError)AfterValidatorBeforeValidatorFieldValidatorModesPlainValidatorWrapValidator)JsonSchemaValue)version_short)PydanticDeprecatedSince20   )_core_utils_decorators_discriminated_union_known_annotated_metadata_typing_extra)ConfigWrapperConfigWrapperStack)CoreMetadataHandlerbuild_metadata_dict)	CoreSchemaOrFieldcollect_invalid_schemasdefine_expected_missing_refsget_refget_type_refis_function_with_inner_schema%is_list_like_schema_with_items_schemasimplify_schema_referencesvalidate_core_schema)	DecoratorDecoratorInfosFieldSerializerDecoratorInfoFieldValidatorDecoratorInfoModelSerializerDecoratorInfoModelValidatorDecoratorInfoRootValidatorDecoratorInfoValidatorDecoratorInfoget_attribute_from_basesinspect_field_serializerinspect_model_serializerinspect_validator)extract_docstrings_from_cls)collect_dataclass_fields)PydanticRecursiveRef)get_standard_typevars_maphas_instance_in_typerecursively_defined_type_refsreplace_types)import_cached_base_modelimport_cached_field_info)MockCoreSchema)CallbackGetCoreSchemaHandler)get_cls_type_hints_lenientis_annotatedis_finalvaris_self_typeis_zoneinfo_type)lenient_issubclasssmart_deepcopy)ComputedFieldInfo	FieldInfo)	BaseModel)Discriminator)StandardDataclass)GetJsonSchemaFunction)      FieldDecoratorInfoType)boundz
list[type]TUPLE_TYPES
LIST_TYPES	SET_TYPESFROZEN_SET_TYPES
DICT_TYPESIP_TYPESSEQUENCE_TYPES
PATH_TYPESDEQUE_TYPES)beforeafterplainwrapzbdict[FieldValidatorModes, type[BeforeValidator | AfterValidator | PlainValidator | WrapValidator]]_mode_to_validatorinfoFieldDecoratorInfofieldstrreturnboolc                B    d| j         v rdS | j         D ]}||k    r dS dS )zCheck if field name is in validator fields.

    Args:
        info: The field info.
        field: The field name to check.

    Returns:
        `True` if field name is in validator fields, `False` otherwise.
    *TF)fields)r   r   v_field_names      U/var/www/api/venv/lib/python3.11/site-packages/pydantic/_internal/_generate_schema.py)check_validator_fields_against_field_namer      sC     dkt  5  44 !5    
decoratorsIterable[AnyFieldDecorator]r   Iterable[str]Nonec           	         t          |          }| D ]U}d|j        j        v r|j        j        du r |j        j        D ](}||vr"t	          d|j         d|j         dd          )VdS )	av  Check if the defined fields in decorators exist in `fields` param.

    It ignores the check for a decorator if the decorator has `*` as field or `check_fields=False`.

    Args:
        decorators: An iterable of decorators.
        fields: An iterable of fields name.

    Raises:
        PydanticUserError: If one of the field names does not exist in `fields` param.
    r   Fz*Decorators defined with incorrect fields: .zO (use check_fields=False if you're inheriting from the model and intended this)zdecorator-missing-fieldcodeN)setr   r   check_fieldsrB   cls_refcls_var_name)r   r   decr   s       r   check_decorator_fields_existr      s     [[F  #(/!!8 E))X_ 	 	EF""'f f fsO_ f f f2    #	 r   validator_functions+Iterable[Decorator[FieldDecoratorInfoType]]'list[Decorator[FieldDecoratorInfoType]]c                     fd| D             S )Nc                >    g | ]}t          |j                  |S  )r   r   ).0r   r   s     r   
<listcomp>z8filter_field_decorator_info_by_field.<locals>.<listcomp>   s.    mmmC2[\_\dfk2l2lmCmmmr   r   )r   r   s    `r   $filter_field_decorator_info_by_fieldr      s!     nmmm.mmmmr   schemacore_schema.CoreSchemaeach_item_validators'list[Decorator[ValidatorDecoratorInfo]]
field_name
str | Nonec                H   |s| S | d         dk    rt          | d         ||          | d<   | S | d         dk    r>|                     d          x}&t          | d         |         ||          | d         |<   nt          |           r<|                     dt	          j                              }t          |||          | d<   n`| d         dk    r<|                     dt	          j                              }t          |||          | d<   nt          d	| d                    | S )
Ntypenullabler   tuplevariadic_item_indexitems_schemadictvalues_schemazO`@validator(..., each_item=True)` cannot be applied to fields with a schema of )apply_each_item_validatorsgetapply_validatorsr[   r/   
any_schema	TypeError)r   r   r   r   inner_schemas        r   r   r      sU      
 f~##5fX6FH\^hiix	7	"	"#)::.C#D#DDQ:J~&':;$; ;F>"#67
 
/v	6	6 	
zz.+2H2J2JKK!1,@TV`!a!a~	6	!	!zz/;3I3K3KLL"2<AUWa"b"bn^dek^lnn
 
 	
 Mr   )titleschema_or_fieldrU   handlerr<   clsr   r   rH   c                  ddl m} ddlm} ddlm} t                      } ||           }|                    |          }	|||	d<   nd|	vr
|j        |	d<   ||u s ||          s ||          rdn|j	        }
|
rd|	vrt          j        |
          |	d<   n7t          ||          r'|j        d	         j        r|j        d	         j        |	d<   |S )
a  Add title and description for model-like classes' JSON schema.

    Args:
        schema_or_field: The schema data to generate a JSON schema from.
        handler: The `GetCoreSchemaHandler` instance.
        cls: The model-like class.
        title: The title to set for the model's schema, defaults to the model's name

    Returns:
        JsonSchemaValue: The updated JSON schema.
    r7   is_pydantic_dataclass)	RootModelrK   )is_builtin_dataclassNr   descriptionroot)dataclassesr   
root_modelr   _dataclassesr   rq   resolve_ref_schema__name____doc__inspectcleandoc
issubclassmodel_fieldsr   )r   r   r   r   r   r   r   r~   json_schemaoriginal_schema	docstrings              r   modify_model_json_schemar      s7   $ 433333&&&&&&222222(**I'/**K00==O#(  		'	'#&< y((,@,@,E,E(I^I^_bIcIc(ilitI N]/99)0)9))D)D&&	C	#	# N(8(@(L N),)9&)A)M&r   json_encodersJsonEncoders | Nonetpr)   c                *   | s|S d|v r|S |gt          |d|j        j                  dd         R D ]`}|                     |          }|t	          j        dt                       dt                     t          j	        |d          |d<   |c S |S )	a  Iterate over the json_encoders and add the first matching encoder to the schema.

    Args:
        json_encoders: A dictionary of types and their encoder functions.
        tp: The type to check for a matching encoder.
        schema: The schema to add the encoder to.
    serialization__mro__Nz=`json_encoders` is deprecated. See https://docs.pydantic.dev/z</concepts/serialization/#custom-serializers for alternativesjson)	when_used)
getattr	__class__r   r   warningsr(   rI   rJ   r/   $plain_serializer_function_ser_schema)r   r   r   baseencoders        r   ,_add_custom_serialization_from_json_encodersr   "  s      &   Hgb)R\-ABB3B3GHH  ##D))? ZMOO  Z  Z  Z%	
 	
 	
 #."RSZfl"m"m"mMr   c                  J    e Zd ZdZddZedd            Zedd	            Zd
S )TypesNamespaceStackzA stack of types namespaces.types_namespaceTypesNamespacec                    |g| _         d S N_types_namespace_stack)selfr   s     r   __init__zTypesNamespaceStack.__init__J  s    =L<M###r   r   c                    | j         d         S Nr   r   r   s    r   tailzTypesNamespaceStack.tailM  s    *2..r   for_type	type[Any]c              #  :  K   t          j        |                                          }|                    | j        pi            | j                            |           	 d V  | j                                         d S # | j                                         w xY wr   )rP   get_module_ns_ofr   updater  r   appendpop)r   r  r   s      r   pushzTypesNamespaceStack.pushQ  s      '8BBGGIItyB///#**?;;;	.EEE'++-----D'++----s    A? ?BN)r   r   )r   r   )r  r  )	r   
__module____qualname__r   r   propertyr  r   r
  r   r   r   r   r   G  sr        &&N N N N / / / X/ . . . ^. . .r   r   abc                    | | n|S )aB  Return the first argument if it is not None, otherwise return the second argument.

    Use case: serialization_alias (argument a) and alias (argument b) are both defined, and serialization_alias is ''.
    This function will return serialization_alias, which is the first argument, even though it is an empty string.
    r   )r  r  s     r   _get_first_non_nullr  \  s     111$r   c                  (   e Zd ZdZdZ	 dddZedd            Zedd            Z	edd            Z
edd            Zedd            ZddZddZdd"Zdd#Zdd$Zdd'Zdd)Zdd*Zdd,Zdd0Z G d1 d2e          Zdd3Zdd4Zdd8Z	 ddd<Zdd?Ze	 dddD            ZddEZ ddHZ!ddIZ"e#ddM            Z$e#ddO            Z$dddQZ$ddRZ%ddTZ&ddUZ'ddVZ(ddXZ)d9dYddaZ*ddcZ+ddeZ,eddi            Z-eddm            Z.eddo            Z/ddqZ0ddsZ1ddtZ2ddvZ3ddxZ4ddzZ5e6j7        dfddZ8ddZ9ddZ:ddZ;ddZ<ddZ=ddZ>ddZ?ddZ@ddZAddZBddZCddZDddZEddZFddZGd fddZHddZIddZJddZK	 dddZLddZMdS )GenerateSchemaz\Generate core schema for a Pydantic model, dataclass and types like `str`, `datetime`, ... .)_config_wrapper_stackr   _typevars_mapfield_name_stackmodel_type_stackdefsNconfig_wrapperrQ   r   dict[str, Any] | Nonetypevars_mapdict[Any, Any] | Noner   r   c                    t          |          | _        t          |          | _        || _        t                      | _        t                      | _        t                      | _
        d S r   )rR   r  r   r   r  _FieldNameStackr  _ModelTypeStackr  _Definitionsr  )r   r  r   r  s       r   r   zGenerateSchema.__init__q  sW     &8%G%G"&9/&J&J#) / 1 1 / 1 1 NN			r   config_wrapper_stackrR   types_namespace_stackr   r  r  r  r   c                    |                      |           }||_        ||_        ||_        ||_        t                      |_        ||_        |S r   )__new__r  r   r  r  r  r  r  )r   r!  r"  r  r  r  objs          r   __from_parentzGenerateSchema.__from_parent  sO     kk#$8!%:"/(.00
r   c                    | j         j        S r   )r  r  r  s    r   _config_wrapperzGenerateSchema._config_wrapper  s    )..r   c                    | j         j        S r   )r   r  r  s    r   _types_namespacezGenerateSchema._types_namespace  s    *//r   c                    | j         j        pt          }|                    | j        | j        | j        | j        | j                  S r   )	r(  schema_generatorr  _GenerateSchema__from_parentr  r   r  r  r  )r   r   s     r   _current_generate_schemaz'GenerateSchema._current_generate_schema  sG    "3E~  &'!I
 
 	
r   r   c                    | j         j        S r   )r(  arbitrary_types_allowedr  s    r   _arbitrary_typeszGenerateSchema._arbitrary_types  s    #;;r   r)   c                (    t          j                    S )zGenerate a CoreSchema for `str`)r/   
str_schemar  s    r   r3  zGenerateSchema.str_schema  s    %'''r   
items_typer   c                P    t          j        |                     |                    S r   )r/   list_schemagenerate_schemar   r4  s     r   _list_schemazGenerateSchema._list_schema  s!    &t';';J'G'GHHHr   	keys_typevalues_typec                x    t          j        |                     |          |                     |                    S r   )r/   dict_schemar7  )r   r:  r;  s      r   _dict_schemazGenerateSchema._dict_schema  s2    &t';';I'F'FH\H\]hHiHijjjr   c                P    t          j        |                     |                    S r   )r/   
set_schemar7  r8  s     r   _set_schemazGenerateSchema._set_schema  s!    %d&:&::&F&FGGGr   c                P    t          j        |                     |                    S r   )r/   frozenset_schemar7  r8  s     r   _frozenset_schemaz GenerateSchema._frozenset_schema  s!    +D,@,@,L,LMMMr   	enum_type
type[Enum]c           	       	
 t          j                                                  t                    	j        sd nt          j        j                  }|dk    rd }j        |d
d 
                                D             
d t          t                    rdt          j        d          }nmt          t                    rdt          j        d          }nAt          t                    rdt          j        d          }nt          j        d           }rd
fd}t!          j        dd           t$          j        j        k    }t          j        |rd nj        	d|gi          }| j        j        r$t          j        t1          d          ||          }|S d	
fd}t          j        d|gi          S )NzAn enumeration.)r   r   c                    i | ]
\  }}|||S r   r   r   kvs      r   
<dictcomp>z/GenerateSchema._enum_schema.<locals>.<dictcomp>  s    KKKtq!Q]a]]]r   intr   floatc                    | S r   r   xs    r   <lambda>z-GenerateSchema._enum_schema.<locals>.<lambda>  s    XY r   r   r)   r   r<   r   rH   c                r     ||           }|                     |          }|                               |S r   )r   r  )r   r   r   r   
js_updatess       r   get_json_schemaz4GenerateSchema._enum_schema.<locals>.get_json_schema  s=    %gfoo")"<"<["I"I&&z222""r   __func__pydantic_js_functions)sub_typemissingrefmetadatavalue)r   c                     |t          j                            }|                    |          }|                               |S )N)rX  rZ  )r/   enum_schemar   r  )	_r   r   r   casesenum_refrE  rT  rX  s	       r   get_json_schema_no_casesz=GenerateSchema._enum_schema.<locals>.get_json_schema_no_cases  sU    %gk&=iYago&p&p&pqq")"<"<["I"I&&z222""r   r[  )r   r)   r   r<   r   rH   )r   r<   r   rH   )list__members__valuesrY   r   r   r   r   itemsr   rM  r/   simple_ser_schemar   rN  r   r   	_missing_r	   rV  r^  r(  use_enum_values no_info_after_validator_functionr   is_instance_schema)r   rE  r   value_ser_typerU  default_missingr^  rb  r`  ra  rT  rX  s    `      @@@@r   _enum_schemazGenerateSchema._enum_schema  sG   	 5 < < > >??	**"+"3\dd9I)J[9\9\,,,K(1+NN
KKz'7'7'9'9KKK
:>i%% 	[H4?4QRW4X4XNN	3'' 		[H(:5AANN	5)) 	[H(:7CCNN )MkkZZN +	# # # # # # &i&9:tLLPTP^PggO%1! /HY5H1O3DE  K #3 )Jw''N   # # # # # # # # # # 114L3MN   r   r   c                   ddl m} t          dt          dt          dt
          dt          dt          didfd}t          j	        t          j
        |                   t          j        t          j        t          j                              t          j                            t          j        |          t!          fdg                    S )NrK   )IP_VALIDATOR_LOOKUPipv4ipv4networkipv4interfaceipv6ipv6networkipv6interfaceipr   r   r   c           	         t          | t          f          s&t          d dt          |            d|  d          t          |           S )Nz
Expected `z` but got `z` with value `'z-'` - serialized value may not be as expected.)
isinstancer   r,   r   )rx  r   s    r   ser_ipz)GenerateSchema._ip_schema.<locals>.ser_ip  s\    b2s),, :zzzRzzzzz   r77Nr   )r   python_schemac                    d         dS )Nstringr   formatr   )_1_2ip_type_json_schema_formatr   s     r   rR  z+GenerateSchema._ip_schema.<locals>.<lambda>  s    hJdegJh-i-i r   js_functions)
lax_schemastrict_schemar   r[  )rx  r   r   r   )_validatorsrq  r   r   r   r   r   r   r/   lax_or_strict_schema no_info_plain_validator_functionjson_or_python_schemark  r3  rl  r   rT   )r   r   rq  r{  r  s    `  @r   
_ip_schemazGenerateSchema._ip_schema  s    444444 ??&
"	 	 	 	 	 	 /"CDWXZD[\\%;'H[McMeMeff)<R@@   &J6RR(iiiiij  

 

 

 
	
r   c                    t          |t                    s+t          |dt                     t	          j                    S t	          j        |          S )Na   is not a Python type (it may be an instance of an object), Pydantic will allow any object with no validation since we cannot even enforce that the input is an instance of the given type. To get rid of this error wrap the type with `pydantic.SkipValidation`.)rz  r   r(   UserWarningr/   r   rl  )r   r   s     r   _arbitrary_type_schemaz%GenerateSchema._arbitrary_type_schema!  sb    "d## 	, Z Z Z    )+++-b111r   r%  c                (    t          d|d          )N,Unable to generate pydantic-core schema for a  . Set `arbitrary_types_allowed=True` in the model_config to ignore this error or implement `__get_pydantic_core_schema__` on your type to fully support it.

If you got this error by calling handler(<some type>) within `__get_pydantic_core_schema__` then you likely need to call `handler.generate_schema(<some type>)` since we do not call `__get_pydantic_core_schema__` on `<some type>` otherwise to avoid infinite recursion.)r@   r   r%  s     r   _unknown_type_schemaz#GenerateSchema._unknown_type_schema-  s.    +f3 f f f
 
 	
r   r   discriminatorstr | Discriminator | Nonec                    ||S 	 t          j        ||          S # t           j        $ r t          j        ||           |cY S w xY wr   )rN   apply_discriminatorMissingDefinitionForUnionRefset_discriminator_in_metadata)r   r   r  s      r   _apply_discriminator_to_unionz,GenerateSchema._apply_discriminator_to_union8  su      M	';   $@ 	 	 	 >   MMM	s    &AAc                      e Zd ZdS )GenerateSchema.CollectedInvalidN)r   r  r  r   r   r   CollectedInvalidr  J  s        r   r  c                    |                      |          }t          |          }t          |          r|                                 t	          j        |          }t          |          }|S r   )collect_definitionsr\   rV   r  rN   apply_discriminatorsr]   )r   r   s     r   clean_schemazGenerateSchema.clean_schemaM  sf    ))&11+F33"6** 	*'')))%:6BB%f--r   c                $   t          d|                    dd                     }|r|| j        j        |<   d|v rt	          j        |d                   }t	          j        |t          | j        j                                                            S )Nr   rZ  )	r%   r   r  definitionsr/   definition_reference_schemadefinitions_schemard  rf  )r   r   rZ  s      r   r  z"GenerateSchema.collect_definitionsV  s    <E4!8!899 	0)/DI!#&F?? <VE]KKF-&--//00
 
 	
r   metadata_schemajs_functionCallable[..., Any]c                    t          |          j        }|                    dg           }||vr|                    |           d S d S )NrW  )rS   r[  
setdefaultr  )r   r  r  r[  rW  s        r   _add_js_functionzGenerateSchema._add_js_functiona  sY    &77@ ( 3 34KR P P 333!((55555 43r   Tfrom_dunder_get_core_schemar   c                .   d}|r|                      ||          }||}||                     |          }t          ||          }|2t          || j        j                  }|r|                     ||           t          | j        j	        ||          }|S )a  Generate core schema.

        Args:
            obj: The object to generate core schema for.
            from_dunder_get_core_schema: Whether to generate schema from either the
                `__get_pydantic_core_schema__` function or `__pydantic_core_schema__` property.

        Returns:
            The generated core schema.

        Raises:
            PydanticUndefinedAnnotation:
                If it is not possible to evaluate forward reference.
            PydanticSchemaGenerationError:
                If it is not possible to generate pydantic-core schema.
            TypeError:
                - If `alias_generator` returns a disallowed type (must be str, AliasPath or AliasChoices).
                - If V1 style validator with `each_item=True` applied on a wrong field.
            PydanticUserError:
                - If `typing.TypedDict` is used instead of `typing_extensions.TypedDict` on Python < 3.12.
                - If `__modify_schema__` method is used instead of `__get_pydantic_json_schema__`.
        N)
_generate_schema_from_property_generate_schema_inner!_extract_get_pydantic_json_schemaresolve_original_schemar  r  r  r   r(  r   )r   r%  r  r   from_propertymetadata_js_functionr  s          r   r7  zGenerateSchema.generate_schemal  s    6 %)& 	' ??SIIM(&>0055F@fMM+5fdi>STTO M%%o7KLLL=d>R>`begmnnr   r   type[BaseModel]c                	     j                             |          5 \  }}||cddd           S |j        }|j        j        }t          t          j                                        j	                                        j
                                                  h |                                |                                           t          |j        d          }|                    |          }                     ||          }t!          t#          t$          ||          g          }	j                                        }
 j                            |          5   j                            |          5   j         d}|                    d          dk    r|j        d         |u sJ |j        d	         t4          u sJ |j        dd	         D ]}t7          |d
i                               dd          }|t9          |t:                    r/t=          j        t=          j         |dd           j!                  }tE          |          }|tF          tH          fvrtK          d           &                    |d          d         }|tN          ur (                    |          } n|j)        rq *                    d|d                   }|d         }tW          ||
d          }tY          j-        ||t7          |dd          dt7          |dd          |||	          }ntY          j.         fd|/                                D              fd|                                D             ||j0                  }tc          |j2                                        d          }tg          |ti                                }||}tW          ||
d          }tY          j-        ||t7          |dd          dt7          |dd          |||	          } 5                    |j6                                                  }tW          ||
d          }| j         j7        |<   tY          j8        |          cddd           cddd           cddd           S # 1 swxY w Y   ddd           n# 1 swxY w Y   ddd           dS # 1 swxY w Y   dS )z%Generate schema for a Pydantic model.NF)checkr   r   r  extra_fields_behaviorallowr   r   __annotations____pydantic_extra__T)is_argumentis_classzEThe type annotation for `__pydantic_extra__` must be `Dict[str, ...]`requiredrK   r   r   inner__pydantic_custom_init____pydantic_post_init__)custom_initr   	post_initconfigrZ  r[  c                F    i | ]\  }}|                     ||          S r   )_generate_md_field_schemar   rJ  rK  r   r   s      r   rL  z0GenerateSchema._model_schema.<locals>.<dictcomp>  s4    hhhQUQRTUD::1aLLhhhr   c                F    g | ]}                     |j                  S r   _computed_field_schemafield_serializersr   dr   r   s     r   r   z0GenerateSchema._model_schema.<locals>.<listcomp>  s<     ) ) ) ! !77:;WXX) ) )r   )computed_fieldsextras_schema
model_nameouter)9r  get_schema_or_refr   __pydantic_decorators__r  r   r   field_validatorsrf  r  
validatorskeysrQ   model_configcore_config_get_model_title_from_configrT   r
   r   model_validatorsr  r
  r   r.  r   r   objectr   rz  r   rP   eval_type_backport_make_forward_refr*  r5   r   r   r@    _get_args_resolving_forward_refsr   r7  __pydantic_root_model___common_field_schemaapply_model_validatorsr/   model_schemamodel_fields_schemarg  r   r   root_validatorsrW   ro   _apply_model_serializersmodel_serializersr  r  )r   r   	model_refmaybe_schemar   r  r  r  r   r[  r  r  candidate_clsextras_annotationr   extra_items_type
root_fieldr   r  fields_schemanew_inner_schemar   r   s   `                     @r   _model_schemazGenerateSchema._model_schema  s   Y((-- b	J1J)\'#b	J b	J b	J b	J b	J b	J b	J b	J %F4J(8O(/668807799)0022 
 :&++--9/"6"6"8"89   +3+;5IIIN(44S99K55c>JJE*AY_bjo9p9p9p8qrrrH):AACC+00@@ LJ LJ$B]BbBbcfBgBg LJ LJ4 $??#:;;wFF;q>S0000;r?f4444),SbS)9 & &,3MCTVX,Y,Y,],]0$- -) -8)*;SAA "4A4T$1$C(9uW[%& %& %& %)$9	5" 5" 1 ",,=!>!>B!$55&C$k'" '" !" 04/T/T 1)- 0U 0 0  0!,  0s::040D0DEU0V0V %. '!%!:!:66&>S]!^!^J#-h#7L#9,HXZa#b#bL#.#;$$+C1KT$R$R#'")#/G"N"N*%!)	$ 	$ 	$LL =H<[hhhhhY_YeYeYgYghhh) ) ) ) )%4%;%;%=%=) ) ) '4#&<= = =M $4M:C]CdCdCfCfhl#m#mL'CLRoRqRq'r'r$'3'7#9,HXZa#b#bL#.#;$$+C1KT$R$R#(")#/G"N"N*%!)	$ 	$ 	$L 66|ZEaEhEhEjEjkk/8H'RR39	%i0">yIIYLJ LJ LJ LJ LJ LJ LJ LJ LJ LJ LJ LJ LJ LJ-b	J b	J b	J b	J b	J b	J b	J b	J,LJ LJ LJ LJ LJ LJ LJ LJ LJ LJ LJ LJ LJ LJ LJ LJ LJ LJ LJ LJ LJ LJ LJ-b	J b	J b	J b	J b	J b	J b	J b	J b	J b	J b	J b	J b	J b	J b	J b	J b	J b	Jsf   SD;S,R<K9R% R<S%R))R<,R)-R<0S<S 	 SS 	SSSmodel#type[BaseModel | StandardDataclass]ConfigWrapper | Noner   c                    |dS |j         r|j         S |j        }|r< ||           }t          |t                    st	          d| d|j                   |S dS )zfGet the title of a model if `model_title_generator` or `title` are set in the config, else return NoneNzmodel_title_generator  must return str, not )r   model_title_generatorrz  r   r   r   )r  r  r  r   s       r   r  z+GenerateSchema._get_model_title_from_config  s    
 !4 	(!'' . D  	))%00EeS)) y w9N w wfkfu w wxxxLtr   c                r    |d         dk    r*| j         j        }|d         D ]}|||d         <   |d         S |S )zuUnpack all 'definitions' schemas into `GenerateSchema.defs.definitions`
        and return the inner schema.
        r   r  rZ  r   )r  r  )r   r   r  ss       r   _unpack_refs_defsz GenerateSchema._unpack_refs_defs  sR     &>]**)/KM* * *()AeH%%(##r   sourcecore_schema.CoreSchema | Nonec                   t          |          r| j                                        }| j                            |          5 \  }}||cddd           S 	 ddd           n# 1 swxY w Y   ||u rd}nd}t          |dd          x}" ||t          | j        | |                    }nt          |dd          x}2t          |t                    s|                    dd          |k    r|}nQt          |dd          x}	<t          d	t                     t          j        d
  |	            D                       }ndS |                     |          }t          |          r$|d                             dd          }
|
r|
|d<   nt#          |          }
|
r#|| j        j        |
<   t          j        |
          S |S )a0  Try to generate schema from either the `__get_pydantic_core_schema__` function or
        `__pydantic_core_schema__` property.

        Note: `__get_pydantic_core_schema__` takes priority so it can
        decide whether to use a `__pydantic_core_schema__` attribute, or generate a fresh schema.
        Nunpackzto-def__get_pydantic_core_schema__)ref_mode__pydantic_core_schema__r   __get_validators__zc`__get_validators__` is deprecated and will be removed, use `__get_pydantic_core_schema__` instead.c                6    g | ]}t          j        |          S r   r/   "with_info_plain_validator_functionr   rK  s     r   r   zAGenerateSchema._generate_schema_from_property.<locals>.<listcomp>C  s%    .w.w.wef{/]^_/`/`.w.w.wr   r   rZ  )rx   r  r   r  r  r   rt   r  rz  rs   r(   rJ   r/   chain_schemar  rZ   r	  rX   r  r  )r   r%  r  r_  r  r  
get_schemar   existing_schemar  rZ  s              r   r  z-GenerateSchema._generate_schema_from_property   sb     	.'++--CY((-- 	$1B!\'#	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$'	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ &==HHH "#'EtLLLJYZ4T5PRVaijjj FF !(-G N NN_[?? \##E400C77$FF#C)=tDDDjQu)   !-.w.wjtjtjvjv.w.w.wxxFF 4''//(00 	""&&ud33C $ #u&//C 	@)/DI!#&:3???s   A$$A(+A(c                    	 t          j        || j                  }n'# t          $ r}t	          j        |          |d }~ww xY wt          |t                    rt	          |j        d|           | j	        rt          || j	                  }|S )N)globalnsz%Unable to evaluate forward reference )rP   r  r*  	NameErrorrA   from_name_errorrz  r   __forward_arg__r  rp   )r   r%  es      r   _resolve_forward_refz#GenerateSchema._resolve_forward_refW  s    	H23AVWWWCC 	H 	H 	H-=a@@aG	H c:&& 	r-c.ACpknCpCpqqq 	9T%788C
s    
A=Ar  Literal[True]tuple[Any, ...]c                    d S r   r   )r   r%  r  s      r   r  z/GenerateSchema._get_args_resolving_forward_refsm  s    fifir   tuple[Any, ...] | Nonec                    d S r   r   r  s     r   r  z/GenerateSchema._get_args_resolving_forward_refsp  s    TWTWr   Fc                     t          |          }|rt           fd|D                       }n|rt          d| d          |S )Nc                h    g | ].}t          |t                    r                    |          n|/S r   )rz  r   r  )r   r  r   s     r   r   zCGenerateSchema._get_args_resolving_forward_refs.<locals>.<listcomp>v  s=    iii_`*Q
:S:SZ$33A666YZiiir   z	Expected z+ to have generic parameters but it had none)r4   r   r   )r   r%  r  argss   `   r   r  z/GenerateSchema._get_args_resolving_forward_refss  sd    }} 	ZiiiidhiiijjDD 	ZXXXXYYYr   c                N    |                      |          }|st          S |d         S )Nr   )r  r   )r   r%  r  s      r   _get_first_arg_or_anyz$GenerateSchema._get_first_arg_or_any{  s+    44S99 	JAwr   tuple[Any, Any]c                    |                      |          }|st          t          fS t          |          dk     r"t          |          }t	          d| d          |d         |d         fS )Nr7   z Expected two type arguments for z, got 1r   rK   )r  r   lenr5   r   )r   r%  r  origins       r   _get_first_two_args_or_anyz)GenerateSchema._get_first_two_args_or_any  sn    44S99 	:t99q==__FNvNNNOOOAwQr   c                   t          |          r|                     |          S t          |t                    r|S t          |t                    rt          |          }t          |t
                    r(|                     |                     |                    S t                      }t          ||          rG| j
                            |          5  |                     |          cd d d            S # 1 swxY w Y   t          |t                    rt          j        |j                  S |                     |          S )N)
schema_ref)rv   _annotated_schemarz  r   r   r   r7  r  rq   rz   r  r
  r  rl   r/   r  type_ref
match_type)r   r%  r~   s      r   r  z%GenerateSchema._generate_schema_inner  sl    	/))#...c4   	Jc3 	"S//Cc:&& 	H''(A(A#(F(FGGG,..	c9-- 	/&++C00 / /))#../ / / / / / / / / / / / / / / / c/00 	T:clSSSSs###s   C77C;>C;c                4   |t           u r|                                 S |t          u rt          j                    S |t
          u rt          j                    S |t          u rt          j                    S |t          u rt          j
                    S |t          u rt          j                    S |t          u s	|t          u rt          j                    S |t           j        u rt          j                    S |t           j        u rt          j                    S |t           j        u rt          j                    S |t           j        u rt          j                    S |t0          u rt          j                    S |t4          u rt          j                    S |t8          u rt          j                    S |t<          u rt          j                    S ||t@          j!        u rt          j"                    S |tF          v r| $                    |          S |tJ          v r| &                    |          S |tN          v r| (                    t                    S |tR          v r| *                    t                    S |tV          v r| ,                    t                    S |tZ          v r| .                    t                    S |t^          v r | 0                    t          t                    S tc          |td                    r| 3                    |          S |th          u r| 5                                S tA          j6        |          rt          j7                    S tA          j8        |          r| 9                    |          S tu          |          r| ;                    |d          S tA          j<        |          r| =                    |d          S tA          j>        |          r| ?                    |j@                  S |t          jB        k    r| C                    |          S |t          jE        jF        u s|t          jF        u r| H                                S tc          |t          jI                  r| J                    |          S t          |          rD|t          u rt          j                    S | ?                    | M                    |                    S tc          |t          t          t          t          f          r| R                    |          S t          jT        |          r*t          |t                    r| W                    |          S t          |          r| Y                                S tA          jZ        |          r| [                    |d          S t          |          }|| ]                    ||          S | ^                    |d          }||\  }}| _                    ||          S | j`        r| a                    |          S | b                    |          S )a  Main mapping of types to schemas.

        The general structure is a series of if statements starting with the simple cases
        (non-generic primitive types) and then handling generics and other more complex cases.

        Each case either generates a schema directly, calls into a public user-overridable method
        (like `GenerateSchema.tuple_variable_schema`) or calls into a private method that handles some
        boilerplate before calling into the user-facing method (e.g. `GenerateSchema._tuple_schema`).

        The idea is that we'll evolve this into adding more and more user facing methods over time
        as they get requested and we figure out what the right API for them is.
        Nr   )cr   r3  bytesr/   bytes_schemarM  
int_schemarN  float_schemar   bool_schemacomplexcomplex_schemar   r  r   datetimedatedate_schemadatetime_schematimetime_schema	timedeltatimedelta_schemar   decimal_schemar'   uuid_schemar.   
url_schemar*   multi_host_url_schemarP   NoneTypenone_schemar   r  r   _tuple_schemar   r9  r   rA  r   rD  r   _sequence_schemar   r>  rz  r2   _type_alias_type_schemar   _type_schemais_callable_typecallable_schemais_literal_type_literal_schemar6   _typed_dict_schemais_namedtuple_namedtuple_schemais_new_typer7  __supertype__rePattern_pattern_schemacollectionsabcHashabletyping_hashable_schemar#   _unsubstituted_typevar_schemarw   r   r  r   r   r   r
   _callable_schemar   isclassr   r	   ro  ry   _zoneinfo_schemais_dataclass_dataclass_schemar5   _match_generic_type0_get_prepare_pydantic_annotations_for_known_type_apply_annotationsr1  r  r  )r   r%  r  ressource_typer   s         r   r#  zGenerateSchema.match_type  s    #::??$$$E\\+---CZZ)+++E\\+---D[[*,,,G^^-///CZZ3&==)+++HM!!*,,,H%%%.000HM!!*,,,H&&&/111G^^-///D[[*,,,CZZ)+++L  4666[C=#999*,,,H__??3'''K%%c***J$$S)))I##C((($$$))#...N""((---J$$S#...]++  	+//444D[[$$&&&+C00 	+.000*3// 	+'',,,# 	+**3555(-- 	+**3555&s++ 	+''(9:::BJ'',,,KO,,,v0F0F((***V^,, 	+55c::: 	+e||"-///''**3//   lJ
GLMM 	+((---_S!! 	+jd&;&; 	+$$S)))c"" 	+((***%c** 	5))#t444C++C888CCCLL?'*$K**;DDD  	4..s333((---r   r  c                   t          |t                    r|                     |          S t          j        |          r|                     ||          S t          j        |          r|                     ||          S |                     ||          }||S t          j	        |          r| 
                    |          S |t          v r|                     |          S |t          v r(|                     |                     |                    S |t           v r(|                     |                     |                    S |t$          v r(|                     |                     |                    S |t(          v r | j        |                     |           S t/          |          r|                     ||          S |t2          j        t6          fv r|                     |          S |t:          v r(|                     |                     |                    S |t2          j        t@          j!        j        t2          j"        t@          j!        j"        hv r| #                    |          S |tH          j%        t2          j%        fv r| &                    |          S | '                    |d          }||\  }}| (                    ||          S | j)        r| *                    |          S | +                    |          S )Nr   ),rz  r2   r<  rP   rS  rT  rC  rD  r  origin_is_union_union_schemar   r:  r   r9  r  r   rA  r   rD  r   r>  r  r6   rB  rM  r"   r   _subclass_schemar   r;  r   rJ  rK  	Generator_iterable_schemarG  rH  rI  rV  rW  r1  r  r  )r   r%  r  r  rX  rY  r   s          r   rU  z"GenerateSchema._match_generic_type  s   fm,, 	5//444 %f-- 	7))#v666&v.. 	8**3777;;FCHH$  (00 	-%%c***{""%%c***z!!$$T%?%?%D%DEEEy  ##D$>$>s$C$CDDD'''))$*D*DS*I*IJJJz!!$4$d&E&Ec&J&JKK&!! 		-**3777T***((---~%%(()C)CC)H)HIII)A6CSU`UdUnooo((---
FN333'',,,CCCLL?'*$K**;DDD  	7..v666((---r   r  namer   
field_infor}   r   r_   core_schema.TypedDictFieldc          	         |                      |||          }t          j        |d         |                                sdn||d         |d         |d         |d                   S )zAPrepare a TypedDictField to represent a model or typeddict field.r   Fserialization_excludevalidation_aliasserialization_aliasr[  )r  rd  re  rf  r[  )r  r/   typed_dict_fieldis_required)r   r`  ra  r   r  common_fields         r   _generate_td_field_schemaz(GenerateSchema._generate_td_field_schemaA  sx     00z:NN+"","8"8":":HUU"./F"G)*<= ,-B C!*-
 
 
 	
r   core_schema.ModelFieldc           	         |                      |||          }t          j        |d         |d         |d         |d         |d         |d                   S )z0Prepare a ModelField to represent a model field.r   rd  re  rf  frozenr[  rd  re  rf  rm  r[  )r  r/   model_fieldr   r`  ra  r   ri  s        r   r  z(GenerateSchema._generate_md_field_schemaT  sh     00z:NN&""./F"G)*<= ,-B C)!*-
 
 
 	
r   core_schema.DataclassFieldc                    |                      |||          }t          j        ||d         |j        |j        pd|j        rdnd|d         |d         |d         |d         |d         	
  
        S )
zJPrepare a DataclassField to represent the parameter/field, of a dataclass.r   NFrd  re  rf  rm  r[  )init	init_onlykw_onlyrd  re  rf  rm  r[  )r  r/   dataclass_fieldrs  init_varru  rp  s        r   _generate_dc_field_schemaz(GenerateSchema._generate_dc_field_schemae  s     00z:NN*" )1T&.9DDE"./F"G)*<= ,-B C)!*-
 
 
 	
r   alias_generator%Callable[[str], str] | AliasGeneratorr   c                   |j         !|j         dk    s|j        |j        |j        !d\  }}}t	          | t
                    r|                     |          \  }}}nOt	          | t                    r: | |          }t	          |t                    st          d|  d|j
                   |j         |j         dk    rd|_         |j         dk    r1t          ||          |_        t          ||          |_        ||_        |j        ||_        |j        t          ||          |_        |j        t          ||          |_        dS dS dS )a  Apply an alias_generator to aliases on a FieldInfo instance if appropriate.

        Args:
            alias_generator: A callable that takes a string and returns a string, or an AliasGenerator instance.
            field_info: The FieldInfo instance to which the alias_generator is (maybe) applied.
            field_name: The name of the field from which to generate the alias.
        NrK   NNNalias_generator r  )alias_priorityaliasre  rf  rz  r9   generate_aliasesr   r   r   r   r  )ry  ra  r   r  re  rf  s         r   $_apply_alias_generator_to_field_infoz3GenerateSchema._apply_alias_generator_to_field_infoz  s    %-(A--'*2-5;K8E#%8/>:: q?N?_?_`j?k?k<')<)<OX66 q'
33!%-- q#$o$o$o^c^m$o$oppp
 (0J4MQR4R4R,-
) (A--1DEXZ_1`1`
..ABRTY.Z.Z
+#(
  '#(
 -51DEXZ_1`1`
.*2.ABRTY.Z.Z
+++; 658 32r   computed_field_infor|   computed_field_namec                   |j         |j         dk    s|j        d\  }}}t          | t                    r|                     |          \  }}}nOt          | t
                    r: | |          }t          |t                    st          d|  d|j                   |j         |j         dk    rd|_         |j         dk    rt          ||          |_        dS dS dS )a  Apply an alias_generator to alias on a ComputedFieldInfo instance if appropriate.

        Args:
            alias_generator: A callable that takes a string and returns a string, or an AliasGenerator instance.
            computed_field_info: The ComputedFieldInfo instance to which the alias_generator is (maybe) applied.
            computed_field_name: The name of the computed field from which to generate the alias.
        NrK   r|  r}  r  )
r~  r  rz  r9   r  r   r   r   r   r  )ry  r  r  r  re  rf  s         r   -_apply_alias_generator_to_computed_field_infoz<GenerateSchema._apply_alias_generator_to_computed_field_info  s   $  .6"1Q66"(0;K8E#%8/>:: q?N?_?_`s?t?t<')<)<OX66 q'(;<<!%-- q#$o$o$o^c^m$o$oppp
 #19=P=_cd=d=d56#2
 #1Q66,?@SUZ,[,[#)))+ 10( 76r   FieldInfo | ComputedFieldInfoc                    |j         p| j         }|dS |j        D |||          }t          |t                    st	          d| d|j                   ||_        dS dS )ae  Apply a field_title_generator on a FieldInfo or ComputedFieldInfo instance if appropriate
        Args:
            config_wrapper: The config of the model
            field_info: The FieldInfo or ComputedField instance to which the title_generator is (maybe) applied.
            field_name: The name of the field from which to generate the title.
        Nzfield_title_generator r  )field_title_generatorr   rz  r   r   r   )r  ra  r   r  r   s        r   *_apply_field_title_generator_to_field_infoz9GenerateSchema._apply_field_title_generator_to_field_info  s     !+ @ hNDh (F#))*jAAEeS)) y w9N w wfkfu w wxxx$J $#r   _CommonFieldc                \    t                      }t          j        t          t          f          r j        } j        rL|pi                                 }|                    d  j        	                                D                        t          j        j        |          }|j        urt          |t                    ss |j        |          }|j        _        |j        	                                D ](\  }}	|j        vr|j        vrt!          ||	           )g |j        j        _        j        j        }}
d fd}g }t%          |j                                        |          D ]?}|                    t,          |j        j                                     |                     @ j                            |          5  j                             |
||z   |          }n                     |
||z             }d d d            n# 1 swxY w Y   t%          |j                                        |          }t?          |          rd_         d |D             fd	|D             }tC          ||          }tE          |||          }#                                stI          |          } %                    |t%          |j&                                        |                    } '                     j(        |           j)        j*        tW          j,                  pj,        d
k    pd t[          j.                  d}d |	                                D             }j/        }ta          tc          ||          g          } j(        j2        }| 3                    ||           ti          j5        tl          tn          f          rj5        8                                }nj5        }ts          |j:        rdnd |j;        j<        |          S )Nc                $    i | ]\  }}|j         |S r   )r   rI  s      r   rL  z7GenerateSchema._common_field_schema.<locals>.<dictcomp>  s     ']']']$!Q
A']']']r   r   r)   r   c                >                         | j                  } | S r   )r  r  )r   ra  r   s    r   set_discriminatorz>GenerateSchema._common_field_schema.<locals>.set_discriminator  s     77
@XYYFMr   )transform_inner_schemaTc                .    g | ]}|j         j        d u |S T)r   	each_itemr  s     r   r   z7GenerateSchema._common_field_schema.<locals>.<listcomp>(  s(    ]]]aAFDTX\D\D\D\D\D\r   c                    g | ]}|v|	S r   r   )r   rK  r   s     r   r   z7GenerateSchema._common_field_schema.<locals>.<listcomp>)  s$     c c cqQNbEbEbEbEbEbr    )r   r   
deprecatedexamplesc                    i | ]
\  }}|||S r   r   rI  s      r   rL  z7GenerateSchema._common_field_schema.<locals>.<dictcomp>?  s    ]]]1q}q!}}}r   js_annotation_functionsrn  r   r)   r   r)   )=rr   rn   
annotationr   r   r*  r  r   r  rg  rP   eval_type_lenientrl   from_annotation_attributes_setmetadata_lookupsetattrr[  r   r  rf  r  r   r   mode_from_decoratorr  r
  r  rW  r  $_validators_require_validate_defaultvalidate_defaultr   r   rh  wrap_default_apply_field_serializersr  r  r(  r   r   r   r  r0   r  json_schema_extrarT   get_json_schema_update_funcry  r  rz  re  r8   r:   convert_to_aliases_common_fieldexcluderf  rm  )r   r`  ra  r   r}   r   	evaluatednew_field_inforJ  rK  rY  r   r  validators_from_decorators	decoratorr   this_field_validatorsjson_schema_updatesr  r[  ry  re  r   s   ` `                   @r   r  z#GenerateSchema._common_field_schema  s    -..	
 5
C7HII 	W"3O! _#2#8b">">"@"@&&']']$BTBZBZB\B\']']']^^^%7
8M__I
 555>RS\^r>s>s5!:!:9!E!E(6(A
% +:@@BB 2 2DAq
 
 :::q
Hb?b?b
Aq111 'W(?&V*BU&V
##-#8*:M[	 	 	 	 	 	 	
 &("=j>Y>`>`>b>bdhii 	r 	rI&--.@AT.U.e.efo.p.pqqqq"''-- 		 		'300/I!Ibs 1   00"<< 		 		 		 		 		 		 		 		 		 		 		 		 		 		 		 !EZEZEaEaEcEcei j j/0EFF 	/*.J']]+@]]] c c c c,A c c c+F4H$OO!&*?FF
 %%'' 	6!*f55F..89U9\9\9^9^`dee
 
 	778LjZ^___  %%1z455\9NRT9T\X\*:+>??	
 
 ^]0C0I0I0K0K]]]&8&%@ATVg%h%h$i
 
 
 .>&55ozSWXXXj1L)3LMM 	;):MMOO):*4*<"F$$$- * >$
 
 
 	
s   =HH!H
union_typec                   |                      |d          }g }d}|D ]=}||t          j        u rd}|                    |                     |                     >t          |          dk    r	|d         }n}g }|D ]d}|                    di                               t          j                  }	|	|                    ||	f           O|                    |           et          j
        |          }|rt          j        |          }|S )zGenerate schema for a Union.Tr  FNrK   r   r[  )r  rP   r8  r  r7  r  r   rL   TAGGED_UNION_TAG_KEYr/   union_schemanullable_schema)
r   r  r  choicesr   argr  choices_with_tagschoicetags
             r   r\  zGenerateSchema._union_schemaY  s)   44Z$4OO$& 	: 	:C{c]%;;;t33C889999w<<1
AAKM! 5 5jjR0044[5UVV?%,,fc];;;;%,,V4444():;;A 	/+A..Ar   c                ,   | j                             |          5 \  }}||cd d d            S t          |          p|}|j        }t	          |          }| j                            |          5  t          j        || j	                  }t          ||          }|                     |          }|d         dk    sJ ||d<   d d d            n# 1 swxY w Y   || j         j        |<   t          j        |          cd d d            S # 1 swxY w Y   d S )Nr   r  rZ  )r  r  r5   	__value__rm   r   r
  rP   r  r*  rp   r7  r  r/   r  )r   r%  rZ  r  r  r  r  r   s           r   r<  z&GenerateSchema._type_alias_type_schemat  s    Y((-- 	@1D#|'#	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@  __+F)J4S99L,11&99 $ $*<ZI^__
*:|DD
--j99f~6666 #u$ $ $ $ $ $ $ $ $ $ $ $ $ $ $ *0DI!#&:3??!	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@s<   D	AD	0ACD	C	D	C	%D		DDliteral_typec                    t          j        |          }|sJ d|             t          j        |          }| j        j        r/t          d |D                       rt          j        d |          }|S )zGenerate schema for a Literal.z(literal "expected" cannot be empty, obj=c              3  @   K   | ]}t          |t                    V  d S r   )rz  r	   r  s     r   	<genexpr>z1GenerateSchema._literal_schema.<locals>.<genexpr>  s-      7^7^PQ
1d8K8K7^7^7^7^7^7^r   c                >    t          | t                    r| j        n| S r   )rz  r	   r\  )rK  s    r   rR  z0GenerateSchema._literal_schema.<locals>.<lambda>  s    Z4%8%8?!''a r   )rP   all_literal_valuesr/   literal_schemar(  rj  anyrk  )r   r  expectedr   s       r   rA  zGenerateSchema._literal_schema  s     3LAARRRLRRRRR+H55/ 	C7^7^U]7^7^7^4^4^ 	 A?? F r   typed_dict_clsc                    t                      } j                            |          5   j                            |          5 \  }}||cddd           cddd           S t          |          }||}t          s)t          |          j        dk    rt          dd          	 t          |d          }n# t          $ r d}Y nw xY w j                            |          5   j                            |          5   j                            |          } j         |j        }	i }
t%          j        |           j        j        rt+          |d          }nd}t-          | j                                                  D ]\  }}t3          ||          }||	v }t5          |          t6          j        k    r d}                     |d	          d
         }n<t5          |          t6          j        k    rd}                     |d	          d
         } |j        |          }||j         ||v r||         |_          !                     j        ||            "                    |||	          |
|<    #                    |tI          |                    }tK          tM          tN          ||          g          }tQ          j)        |
| fdj*        +                                D             |||          } ,                    |j-        +                                          }t]          |j/        +                                d          }| j        j0        |<   tQ          j1        |          cddd           cddd           cddd           cddd           S # 1 swxY w Y   ddd           n# 1 swxY w Y   ddd           n# 1 swxY w Y   ddd           dS # 1 swxY w Y   dS )a  Generate schema for a TypedDict.

        It is not possible to track required/optional keys in TypedDict without __required_keys__
        since TypedDict.__new__ erases the base classes (it replaces them with just `dict`)
        and thus we can track usage of total=True/False
        __required_keys__ was added in Python 3.9
        (https://github.com/miss-islington/cpython/blob/1e9939657dd1f8eb9f596f77c1084d2d351172fc/Doc/library/typing.rst?plain=1#L1546-L1548)
        however it is buggy
        (https://github.com/python/typing_extensions/blob/ac52ac5f2cb0e00e7988bae1e2a1b8257ac88d6d/src/typing_extensions.py#L657-L666).

        On 3.11 but < 3.12 TypedDict does not preserve inheritance information.

        Hence to avoid creating validators that do not do what users expect we only
        support typing.TypedDict on Python >= 3.12 or typing_extension.TypedDict on all versions
        NrM  zXPlease use `typing_extensions.TypedDict` instead of `typing.TypedDict` on Python < 3.12.ztyped-dict-versionr   __pydantic_config__T)use_inspectr  r   Fr  r  c                F    g | ]}                     |j                  S r   r  r  s     r   r   z5GenerateSchema._typed_dict_schema.<locals>.<listcomp>  <     % % % 33Az7STT% % %r   )r   r  rZ  r[  r  all)2rr   r  r
  r  r  rm   _SUPPORTS_TYPEDDICTr   r  rB   rf   AttributeErrorr  r   r(  r  r.  __required_keys__r_   builduse_attribute_docstringsrj   ru   r*  rg  rp   r5   rP   Requiredr  NotRequiredr  r   r  rj  r  rQ   rT   r
   r   r/   typed_dict_schemar  rf  r  r  r  r  r  r  )r   r  r  r}   typed_dict_refr  r  r  r  required_keysr   field_docstringsr   r  r  ra  r   r[  	td_schemar   r   s   `                   @r   rB  z!GenerateSchema._typed_dict_schema  s     -..	"''77 V	O V	O9T9TUc9d9d V	O i
'#V	O V	O V	O V	O V	O V	O V	O V	O V	O V	O V	O V	O V	O V	O V	O 5^DDL!!'& 4+?+?+Jh+V+V'n-   
,D^Uj,k,k!    +0088 @O @O$:U:Z:Z[i:j:j @O @O"2>>~NN40>0P@B+1.AA
'@ ,'B>_c'd'd'd$$'+$.HY]Yn.o.o.u.u.w.w  *J
!.z<!H!HJ)]:H!*--1GGG#'%)%J%J&%) &K & & &

 $J//=3LLL#(%)%J%J&%) &K & & &

 ";!::!F!FJ(4&2:&*:::1A*1M
.CCDDXZdfpqqq)-)G)G"J
X *H * *F:&& 99.-X^J_J_``.")*B^c"d"d"d!e   (9&% % % % %!+!;!B!B!D!D% % % '%&
 
 
	 66y*B^BeBeBgBghh/
8S8Z8Z8\8\^cdd8>	%n5">~NNA@O @O @O @O @O @O @O @O @O @O @O @O @O @O-V	O V	O V	O V	O V	O V	O V	O V	O V	O V	O V	O V	O V	O V	O V	O,@O @O @O @O @O @O @O @O @O @O @O @O @O @O @O @O @O @O @O @O @O @O @O-V	O V	O V	O V	O V	O V	O V	O V	O V	O V	O V	O V	O V	O V	O V	O V	O V	O V	O V	O V	O V	O V	O V	O V	O V	O V	O V	O V	O V	O V	O V	O V	O V	Os   O2OO2&AO*B;:O;C
O	C

O'OI9N,	;OOO2,N00O3N04O7OOO
OOO2O	O2!O	"O22O69O6namedtuple_clsc           	          j                                       5   j                                      5 \  }}||cddd           cddd           S t	                    || j                                      5  t           j                  }|sd j        D             }r fd|	                                D             }t          j         fd|	                                D             t          d                    }t          j        ||          cddd           cddd           cddd           S # 1 swxY w Y   	 ddd           n# 1 swxY w Y   ddd           dS # 1 swxY w Y   dS )	z!Generate schema for a NamedTuple.Nc                    i | ]
}|t           S r   )r   )r   rJ  s     r   rL  z5GenerateSchema._namedtuple_schema.<locals>.<dictcomp>  s    "J"J"Ja1c"J"J"Jr   c                8    i | ]\  }}|t          |          S r   rp   )r   r   r  r  s      r   rL  z5GenerateSchema._namedtuple_schema.<locals>.<dictcomp>  s9     # # #2J
 #M*l$K$K# # #r   c           
         g | ]@\  }}                     ||j                            |t          j                             AS ))default)_generate_parameter_schema_field_defaultsr   r   empty)r   r   r  r  r   s      r   r   z5GenerateSchema._namedtuple_schema.<locals>.<listcomp>  sd        3J
 77&&$2$B$F$FzS\Sb$c$c 8    r   T)js_prefer_positional_argumentsrc  )rZ  )r  r
  r  r  rm   r   ru   r*  _fieldsrg  r/   arguments_schemarT   call_schema)r   r  r  namedtuple_refr  r   r  r  s   ``     @r   rD  z!GenerateSchema._namedtuple_schema  s\   "''77 !	e !	e9T9TUc9d9d !	e i
'#!	e !	e !	e !	e !	e !	e !	e !	e !	e !	e !	e !	e !	e !	e !	e 5^DDL!!',11.AA e e.HY]Yn.o.o" K"J"J>3I"J"J"JK # # # #6A6G6G6I6I# # #K
 $/#?     7B6G6G6I6I   1PTUUU
$ 
$ 
$  #./?Ucddd/e e e e e e e!	e !	e !	e !	e !	e !	e !	e !	e !	e !	e !	e !	e !	e !	e !	ee e e e e e e e e!	e !	e !	e !	e !	e !	e !	e !	e !	e !	e !	e !	e !	e !	e !	e !	e !	e !	e !	e !	e !	e !	e !	e !	e !	e !	e !	e !	e !	e !	e !	e !	e !	esk   E?E' E?-E'B$E*E'6E?EE'EE'E?'E+	+E?.E+	/E??FFr  r  r  r  JLiteral['positional_only', 'positional_or_keyword', 'keyword_only'] | Nonecore_schema.ArgumentsParameterc                   t                      }|t          j        u r |j        |          }n |j        ||          }|j        
J d            |j        |j        }}| j                            |          5  | 	                    ||          }	ddd           n# 1 swxY w Y   |
                                st          ||	          }	t          j        ||	          }
|||
d<   |j        |j        |
d<   nd| j        j        }t#          |t$                    r |j        |                    |          |
d<   n#t#          |t&                    r ||          |
d<   |
S )zXPrepare a ArgumentsParameter to represent a field in a namedtuple or function signature.Nz<field.annotation should not be None when generating a schemar  r  )rr   r   r  r  from_annotated_attributer  r[  r  r
  rW  rh  r  r/   arguments_parameterr  r(  ry  rz  r9   r   )r   r`  r  r  r  r}   r   rY  r   r   parameter_schemary  s               r   r  z)GenerateSchema._generate_parameter_schema&  s    -..	io%%-I-j99EE6I6z7KKE++-k+++#(#3U^["''-- 	G 	G,,[+FFF	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	G 	G   "" 	1!%00F&:4HH'+V$;"(-W%%"2BO/>:: B?T?`,;,A,A$,G,G ))OX66 B,;OD,A,A )s   8BB"B
tuple_typec                    t          |                               |          }r|rt          fd|D                       }|sE|t          v r(t	          j        t	          j                    gd          S t	          j        g           S |d         t          u rRt          |          dk    r0t	          j         	                    |d                   gd          S t          d          t          |          dk    r |d         dk    rt	          j        g           S t	          j         fd	|D                       S )
zIGenerate schema for a Tuple, e.g. `tuple[int, str]` or `tuple[int, ...]`.c              3  8   K   | ]}t          |          V  d S r   r  )r   paramr  s     r   r  z/GenerateSchema._tuple_schema.<locals>.<genexpr>P  s-      RR%===RRRRRRr   r   )r   r   r7   z&Variable tuples can only have one typerK   r   c                :    g | ]}                     |          S r   )r7  )r   r  r   s     r   r   z0GenerateSchema._tuple_schema.<locals>.<listcomp>e  s'    ,],],]UT-A-A%-H-H,],],]r   )rm   r  r   r   r/   tuple_schemar   Ellipsisr  r7  
ValueError)r   r  paramsr  s   `  @r   r:  zGenerateSchema._tuple_schemaI  sY    1<<66zBB 	SF 	SRRRR6RRRRRF  	_[(("/1G1I1I0J`abbbb #/333BZ8##6{{a"/1E1EfQi1P1P0Qghiiii !!IJJJ[[A&)r// +B///+,],],],]V\,],],]^^^r   c                ^    t          j        t          j        t                    dd          S )Nis_typezInput should be a typecustom_error_typecustom_error_message)r/   custom_error_schemarl  r   r  s    r   r=  zGenerateSchema._type_schemag  s0    .*400'!9
 
 
 	
r   c                    t           j        dk     r
J d            ddlmm dfd
}t          d g          }t          j        |t          j                    |          S )z/Generate schema for a zone_info.ZoneInfo object)r   	   FUnreachabler   )ZoneInfoZoneInfoNotFoundErrorr\  r   r   r  c                   t          |           r| S 	  |           S # t          t          f$ r t          ddd| i          w xY w)Nzoneinfo_strzinvalid timezone: {value}r\  )rz  r  r   r+   )r\  r  r  s    r   validate_str_is_valid_iana_tzzFGenerateSchema._zoneinfo_schema.<locals>.validate_str_is_valid_iana_tzw  sn    %** ix&):yA i i i).:UX_afWghhhis	   
  &Ac                    dddS )Nr~  zoneinfor  r   r  r  s     r   rR  z1GenerateSchema._zoneinfo_schema.<locals>.<lambda>  s    XakDlDl r   r  r   r[  )r\  r   r   r  )	sysversion_infor  r  r  rT   r/   r  to_string_ser_schema)r   r  r[  r  r  s      @@r   rR  zGenerateSchema._zoneinfo_scheman  s     f$$'-''' 	=<<<<<<<	i 	i 	i 	i 	i 	i 	i '5l5l4mnnn;)%:<<
 
 
 	
r   c                r                           |d          }t          j         fd|D                       S )z*Generate schema for `Type[Union[X, ...]]`.Tr  c                Z    g | ]'}                     t          j        |                   (S r   r7  rM  r"   )r   r  r   s     r   r   z<GenerateSchema._union_is_subclass_schema.<locals>.<listcomp>  s/    (b(b(bUY)=)=fk$>O)P)P(b(b(br   )r  r/   r  )r   r  r  s   `  r   _union_is_subclass_schemaz(GenerateSchema._union_is_subclass_schema  sB    44Z$4OO'(b(b(b(b]a(b(b(bcccr   type_c                                          |          }t          j        |          p|}|t          k    r                                 S t          |t          j                  r|j        rYt          j	        t          |j                            r                     |j                  S t          j        |j                  S |j        r%t          j         fd|j        D                       S                                  S t          j	        t          |                    r                     |          S t          j        |          S )z-Generate schema for a Type, e.g. `Type[int]`.c                Z    g | ]'}                     t          j        |                   (S r   r  )r   cr   s     r   r   z3GenerateSchema._subclass_schema.<locals>.<listcomp>  s-    ^^^aT))&+a.99^^^r   )r  rP   annotated_typer   r=  rz  rM  r#   	__bound__r[  r5   r  r/   is_subclass_schema__constraints__r  )r   r  
type_params   `  r   r]  zGenerateSchema._subclass_schema  s?   //66
"1*==K
$$&&&
FN33 	># 	+ 0J<P1Q1QRR P99*:NOOO"5j6JKKK+ +"/^^^^:C]^^^   ((****:j+A+ABB 	>11*===1*===r   c                   ddl m} |                     |          }t          j        |          }t          |          }t          j        t          j        d          }|t          k    r/ddl
m} t          j        |t          j        ||          g          }t          j        ||d          }t          j        |||          S )	z5Generate schema for a Sequence, e.g. `Sequence[int]`.rK   )serialize_sequence_via_listSequence)cls_repr)sequence_validatorT)r   info_arg)r   r|  r   )_serializersr  r7  r/   r6  r{   rl  rM  r  r   r  r  r  no_info_wrap_validator_function#wrap_serializer_function_ser_schemar  )	r   r4  r  item_type_schemar6  r   r|  r  r   s	            r   r;  zGenerateSchema._sequence_schema  s    ======//
;;!-.>??$[11#6vQ[\\\777777'4 KL^`k l lm M $G'0@4
 
 
 0#=P]
 
 
 	
r   core_schema.GeneratorSchemac                z    |                      |          }t          j        |                     |                    S )z$Generate a schema for an `Iterable`.)r  r/   generator_schemar7  )r   r  	item_types      r   r_  zGenerateSchema._iterable_schema  s4    ..u55	+D,@,@,K,KLLLr   pattern_typec                   ddl m} t          d g          }t          j        t          d          dt          j                              }|t          j        k    s|t          j        k    rt          j
        |j        ||          S |                     |d	
          d         }|t          u rt          j
        |j        ||          S |t          u rt          j
        |j        ||          S t#          d|d          )NrK   )r  c                    dddS )Nr~  regexr  r   r  s     r   rR  z0GenerateSchema._pattern_schema.<locals>.<lambda>  s    XahDiDi r   r  patternr   )r   return_schemar	  Tr  r   r  r   )r  r  rT   r/   r   r   r3  rM  rH  rG  r  pattern_either_validatorr  r   pattern_str_validatorr%  pattern_bytes_validatorr@   )r   r(  r  r[  serr  s         r   rI  zGenerateSchema._pattern_schema  sB   !!!!!!&5i5i4jkkk>y!!V;CYC[C[
 
 
 6>))\RZ-G-G?4CRZ    55 6 
 
  C<<?1x    e^^?33QY    00p_k0p0p0pqqqr   c                r    t          j        t          j        t          j        j                  dd          S )Nis_hashablezInput should be hashabler  )r/   r  rl  rJ  rK  rL  r  s    r   rN  zGenerateSchema._hashable_schema  s5    .*;?+CDD+!;
 
 
 	
r   	dataclasstype[StandardDataclass]type[StandardDataclass] | Nonec                     j                             |          5   j                            |          5 \  }}||cddd           cddd           S t	          |          }||}t                      5 }|j        D ]C}t          j        |          r-|	                     j
                            |                     Dd}t          |j                  D ]T}t          j        |          r>t          |dd          }|	                     j                            |                     U j                            |          }	 j         ddlm}
  |
|          rIt%          |j                  }|r2|                                D ]}|                    | j                   nt/          | j        |          } j        j        j        dk    r8|                                D ]#\  }}|j        du rt9          d| d	d
          $|j                            d          pt?          j         |          tC           fd|                                D             d           }tE          |d          }tE          |d          }tG          j$        |j%        | fdj&                                        D             |          }tO          |j(                                        d          }j)                                        }tU          ||d          } +                    |tY          |                    }t[          t]          t^          ||          g          }tG          j0        ||||d t          j1        |          D             ||	| j        j        j2        	  	        } 3                    |j4                                                  }tU          ||d          }| j        j5        |<   tG          j6        |          cddd           cddd           cddd           S # 1 swxY w Y   J d            # 1 swxY w Y   ddd           dS # 1 swxY w Y   dS )z Generate schema for a dataclass.Nr  r7   r   )r  r  FzField zd has `init=False` and dataclass has config setting `extra="allow"`. This combination is not allowed.z dataclass-init-false-extra-allowr   r  c              3  L   K   | ]\  }}                     ||          V  d S r   )rx  r  s      r   r  z3GenerateSchema._dataclass_schema.<locals>.<genexpr>  s9      aa$!QT33Aq*EEaaaaaar   c                0    |                      d          duS )Nru  Fr   )r  s    r   rR  z2GenerateSchema._dataclass_schema.<locals>.<lambda>   s    !%%	"2"2%"? r   )key__post_init__	__slots__c                F    g | ]}                     |j                  S r   r  r  s     r   r   z4GenerateSchema._dataclass_schema.<locals>.<listcomp>(  r  r   )r  collect_init_onlyr  r  r  c                    g | ]	}|j         
S r   )r`  )r   r   s     r   r   z4GenerateSchema._dataclass_schema.<locals>.<listcomp>>  s    RRR5EJRRRr   )r  rZ  r   slotsr  r[  rm  r  r   )7r  r
  r  r  rm   r   r   r   rS  enter_contextr   reversedr   r  r(  r  r.  r   r   __pydantic_fields__rf  apply_typevars_mapr*  rk   r  extrarg  rs  rB   __dict__r   r_   r  sortedhasattrr/   dataclass_args_schemar   r  r   r  r  r  r  rQ   rT   r
   r   dataclass_schemar   rm  r  r  r  r  )r   r4  r  dataclass_refr  r  dataclass_bases_stackdataclass_baser  r  r   r   r   r   r  has_post_init	has_slotsargs_schemar   r  r   r[  	dc_schemar   r   s   `                       @r   rT  z GenerateSchema._dataclass_schema  sl    "''	22 g	( g	(DI4O4OPY4Z4Z g	( _
'#g	( g	( g	( g	( g	( g	( g	( g	( g	( g	( g	( g	( g	( g	( g	( 5Y??L!"	 XN 5&/&7 n nN"/?? n-;;D<W<\<\]k<l<lmmm &.y/@&A&A e eN"/?? e!(9NPT!U!U-;;D<V<[<[\b<c<cddd"2>>yII4??????((33 
%i&CDDF# Z%+]]__ Z ZE!44\4CXYYYY5!-%1  F -28GCC-3\\^^  )
E :.."3!D !D !D !D%G# # #  / '/334MNNqR`RfgpRqRq
 aaaaaRXR^R^R`R`aaa??   !(	? C C#I{;;	)?&% % % % %!+!;!B!B!D!D% % % '4    0Z=W=^=^=`=`bfgg#-#>#E#E#G#G 5lDTV]^^99)]SYEZEZ[[.")*B	Y^"_"_"_!`   (8 +%RRK4Fy4Q4QRRR#&%  5:A  	 66y*B^BeBeBgBghh/8H'RR7=	%m4">}MMqXN XN XN XN XN XN XNg	( g	( g	( g	( g	( g	( g	( g	( g	( g	( g	( g	( g	( g	( g	(XN XN XN XN XN XN XN XNx (-'''Og	( g	( g	( g	( g	( g	( g	( g	( g	( g	( g	( g	( g	( g	( g	( g	( g	( g	( g	( g	( g	( g	( g	( g	( g	( g	(sd   Q$QQ$!Q9NP7QQ$7P;;Q>P;?QQ	Q$Q	Q$$Q(+Q(functioncore_schema.CallSchemac                   t          |          }t          j        || j                  }t          j        dt          j        dt          j        di}g }d}d}|j        	                                D ]\  }}	|	j
        |j        u r t          j        t          t                    }
n||         }
|                    |	j                  }|3|                     ||
|	j        |          }|                    |           |	j        t          j        k    r|                     |
          }|	j        t          j        k    sJ |	j                    |                     |
          }d}| j        }|j        r,|                    d          }||                     |          }t3          j        t3          j        ||||j                  ||          S )	zsGenerate schema for a Callable.

        TODO support functional validators once we support them in Config
        )r   positional_onlypositional_or_keywordkeyword_onlyNr   )var_args_schemavar_kwargs_schemapopulate_by_name)r-  )r   rP   get_function_type_hintsr*  r   POSITIONAL_ONLYPOSITIONAL_OR_KEYWORDKEYWORD_ONLY
parametersrg  r  r  rM  r%   r   r   kindr  r  r  VAR_POSITIONALr7  VAR_KEYWORDr(  validate_returnr/   r  r  r[  )r   rS  sig
type_hintsmode_lookuparguments_listrY  rZ  r`  pr  parameter_mode
arg_schemar-  r  return_hints                   r   rP  zGenerateSchema._callable_schemaO  s   
 !!":8UYUjkkk
 %'8+-D"Nr
 @B9=;?~++-- 	E 	EGD!|sy((#[c22

'-
(__QV44N)!<<T:qyZhii
%%j11119333"&"6"6z"B"Bv!6666666$($8$8$D$D!!7;-) 	B$..22K& $ 4 4[ A A&( /"3!/!@	   '	
 	
 	
 		
r   typevartyping.TypeVarc                X   t          |t          j                  sJ |j        }|j        }	 |                                }n## t          $ r t          |dd           d u}Y nw xY w|d ut          |          dk    z   |z   dk    rt          d          |r| 
                    |j                  S |r%|                     t          j        |                   S |rB| 
                    |          }t          j        d t          j                              |d<   |S t          j                    S )N__default__r   rK   zZPydantic does not support mixing more than one of TypeVar bounds, constraints and defaultsc                     ||           S r   r   )rQ  hs     r   rR  z>GenerateSchema._unsubstituted_typevar_schema.<locals>.<lambda>  s    QQqTT r   )r   r   )rz  rM  r#   r  r  has_defaultr  r   r  NotImplementedErrorr7  rp  r\  r$   r/   r"  r   )r   rm  r   constraintstypevar_has_defaultr   s         r   rO  z,GenerateSchema._unsubstituted_typevar_schema  sc   '6>22222!-	T")"5"5"7"7 	T 	T 	T")'=$"G"Gt"S	T #k"2"2a"78;NNQRRR%l    	,''(;<<< 		,%%fl;&?@@@ 	,))%00F&1&U!!+*@*B*B' ' 'F?# M)+++s   A A! A!r  Decorator[ComputedFieldInfo]r  2dict[str, Decorator[FieldSerializerDecoratorInfo]]core_schema.ComputedFieldc                   	 t          j        j        j        j        | j                  }n'# t          $ r}t          j        |          |d }~ww xY w|t          u rt          dd          t          || j                  }t          j        j        |          _        |                     |          }|                     |t#          |                                j                  d          }| j        j        }|"|                     |j        j                   |                     | j        j        j                   dfd}t1          |g          }t3          j        j        |j        j        |          S )NzComputed field is missing return type annotation or specifying `return_type` to the `@computed_field` decorator (e.g. `@computed_field(return_type=int|str)`)zmodel-field-missing-annotationr   )return_typeTcomputed_field)ry  r  r  r   rU   r   r<   r   rH   c                2    ||           }d|d<   j         j        }|||d<   j         j        }|||d<   j         j        sj         j        dk    rd|d<   j         j        }|t          |          |d<   j         j        }|t          ||           |S )NTreadOnlyr   r   r  r  r  )r   r   r   r  r  r0   r  add_json_schema_extra)r   r   r   r   r   r  r  r  s          r   set_computed_field_metadatazJGenerateSchema._computed_field_schema.<locals>.set_computed_field_metadata  s    !'&//K&*K
#FLE ',G$&,K&-8M*v  1AF$5$;$;,0L)vH#*<X*F*FJ' ! 8 ,%k3DEEEr   r  )r-  r  r[  )r   rU   r   r<   r   rH   )rM   get_function_return_typefuncr   r{  r*  r  rA   r  r-   rB   rp   r  r   replacer7  r  r   rf  r   r(  ry  r  r  rT   r/   r}  r  )	r   r  r  r{  r  return_type_schemary  r  r[  s	    `       r   r  z%GenerateSchema._computed_field_schema  s   
	H%>qvqvGY[_[pqqKK 	H 	H 	H-=a@@aG	H+++#d5    $K1CDD $QVEEE!11+>>!::01B1I1I1K1KQ^\\ ; 
 
 .>&>> /QVabao ?    	778LafVWVdeee	 	 	 	 	 	4 '@[?\]]])N*<AFL[c
 
 
 	
s   *. 
AAAr  c                    t                      }|                     |d          ^}}|                     ||          }|D ]"}t          ||          rt	          ||          }#|S )zdGenerate schema for an Annotated type, e.g. `Annotated[int, Field(...)]` or `Annotated[int, Gt(0)]`.Tr  )rr   r  rW  rz  r  )r   r  r}   rY  r   r   r  s          r   r!  z GenerateSchema._annotated_schema  s    ,..	$($I$I %J %
 %
!k ((kBB & 	: 	:J*i00 :%j&99r   r   tuple[Any, list[Any]] | Nonec                    ddl m}m}m} 	 t	          |           n# t
          $ r Y d S w xY wt          |          p|}|t          v r |||          S |t          v r |||          S |t          v r |||          S d S )NrK   ))deque_schema_prepare_pydantic_annotations)mapping_like_prepare_pydantic_annotations(path_schema_prepare_pydantic_annotations)
_std_types_schemar  r  r  hashr   r5   r   r   MAPPING_TYPES)r   r%  r   r  r  r  
obj_origins          r   rV  z?GenerateSchema._get_prepare_pydantic_annotations_for_known_type  s    	
 	
 	
 	
 	
 	
 	
 	
 	
 	
	IIII 	 	 	44	  __+
##;;CMMM;&&<<S+NNN=((<<S+NNN4s    
**c                    | S r   r   rP  s    r   rR  zGenerateSchema.<lambda>  s    q r   rY  	list[Any]r  "Callable[[CoreSchema], CoreSchema]c                    t          t          j        |                    }                     t	          |                    }||\  }g }d fd}t          |           }|D ]}|                     |||          } |          }	|r=t          |	          j        }
|
	                    dg           
                    |           t           j        j        |	          S )	a  Apply arguments from `Annotated` or from `FieldInfo` to a schema.

        This gets called by `GenerateSchema._annotated_schema` but differs from it in that it does
        not expect `source_type` to be an `Annotated` object, it expects it to be  the first argument of that
        (in other words, `GenerateSchema._annotated_schema` just unpacks `Annotated`, this process it).
        Nr%  r   r   r)   c                                        |           }|                    |           }n|}t          | |          }|2t          |j        j                  }|                    ||            |          S r   )r  r  r  r  r  r  r  )r%  r  r   r  r  r   rY  r  s        r   inner_handlerz8GenerateSchema._apply_annotations.<locals>.inner_handler%  s     ??[QQM$44S99&#DS&#Q#Q #/"9&$)BW"X"X".))/;OPPP))&111r    pydantic_js_annotation_functionsr%  r   r   r)   )rd  rO   expand_grouped_metadatarV  r   rt   _get_wrapped_inner_schemarS   r[  r  extendr   r(  r   )r   rY  r   r  rX  r  r  get_inner_schemar  r   r[  s   `` `       r   rW  z!GenerateSchema._apply_annotations  s2    4L[YYZZCCKQVWbQcQcdd?'*$KHJ(	2 	2 	2 	2 	2 	2 	2 	2 8tLL% 	 	J!#== *.N    "!+..+ 	q*622;H BBGGNNOoppp;D<P<^`kmstttr   r[  c                   t                      }t          ||          rD|j        D ]}|                     ||          }|j        |                     ||j                  }|S |d         dk    rF|                    dt          j                              }|                     ||          }|r||d<   |S |}|                    dd           }|O|	                                }|dt          |           z   }|| j        j        v r| j        j        |         S ||d<   n|d         dk    rt|d         }|| j        j        v r^| j        j        |         	                                }|dt          |           z   }|| j        j        v r| j        j        |         S ||d<   t          j        ||	                                          }	|	|	S |S )Nr   r   r   rZ  r_  definition-refr   )rr   rz  r[  _apply_single_annotationr  r  r   r/   r   r   reprr  r  rO   apply_known_metadata)
r   r   r[  r}   field_metadatar  r   rZ  new_refmaybe_updated_schemas
             r   r  z'GenerateSchema._apply_single_annotationA  s   ,..	h	** 	"*"3 O O66v~NN%1;;FHDZ[[M&>Z''JJx)?)A)ABBE11%BBE )#(x M jj%%?[[]]F0X000G$)///y,W55#F5MMF^///&Cdi+++.s388:: 4DNN 4 44di3339099 'u8MhX^XcXcXeXeff+''r   c                   t                      }t          ||          r|j        D ]}|                     ||          }i }|j        r
|j        |d<   |j        r
|j        |d<   |j        rt          |j                  |d<   |j        }|s|rIt          |          j        
                    dg                               t          ||                     |S )Nr   r   r  r  )rr   rz  r[  $_apply_single_annotation_json_schemar   r   r  r0   r  rS   r  r  r  )r   r   r[  r}   r  json_schema_updater  s          r   r  z3GenerateSchema._apply_single_annotation_json_schemak  s	    -..	h	** 	"*"3 [ [BB6>ZZ24~ =.6n"7+# I4<4H"=1  W1CHDU1V1V":. ( :! %6 #F++4??@bdfggnn/0BDUVV   r   r  r;   r  list[GetJsonSchemaFunction]rt   c                h     t          dd           pd d fd}t          |           S )	Nr  c                     ||           S r   r   )r  r   s     r   rR  z:GenerateSchema._get_wrapped_inner_schema.<locals>.<lambda>  s    GGFOO r   r  r   r   r   c                     |           }                     |          }                    |          }t          |          }|                    |           |S r   )r  r  r  r  )r  r   r  r  r  metadata_get_schemar  r   s      r   new_handlerz=GenerateSchema._get_wrapped_inner_schema.<locals>.new_handler  sq    ((1ABBF226:FFF>>vzRRF#DZQW#X#X #/0778LMMMMr   )r  r   r   r   )r   rt   )r   r  r  r  r  r  s   ```` @r   r  z(GenerateSchema._get_wrapped_inner_schema  sn     6=ZIgim5n5n 6
33 		 	 	 	 	 	 	 	 	 	 ,K>>>r   serializers-list[Decorator[FieldSerializerDecoratorInfo]]r}  c                V   |rt          |          }|d         dk    r#|d         }|                     ||          |d<   |S t          j        d|                    dd                    }|#|| j        j        |<   t          j        |          }|d         }t          |j
        |j        j        |          \  }}	 t          j        |j
        |j        j        | j                  }	n'# t"          $ r}
t%          j        |
          |
d}
~
ww xY w|	t(          u rd}n|                     |	          }|j        j        d	k    r,t          j        |j
        ||||j        j        
          |d<   n=|j        j        dk    sJ t          j        |j
        ||||j        j        
          |d<   |S )z$Apply field serializers to a schema.r   r  r   zstr|NonerZ  Nr   r|  r   )is_field_serializerr  r-  r   r   r   )r   r  rM  r%   r   r  r  r/   r  rg   r  r   r  rM   r  r{  r*  r  rA   r  r-   r7  r"  r   r   )r   r   r  r}  r   rZ  
serializerr  r  r{  r  r-  s               r   r  z'GenerateSchema._apply_field_serializers  s     .	&\\Ff~..%h/#'#@#@{#[#[x k*fjj.E.EFF?17DI)#.(DSIIF %RJ,D!5n- - -)L)BOZ_%@$BW   L L L1A!DD!KL /// $ $ 4 4[ A A#v--*5*YO(;%"/(o7+ + +'' "+w6666*5*ZO(;%"/(o7+ + +' s   =*C( (
D2DD1Iterable[Decorator[ModelSerializerDecoratorInfo]]c                ^   |                     dd          }|rt          |          d         }t          |j        |j        j                  }	 t          j        |j        |j        j        | j	                  }n'# t          $ r}t          j        |          |d}~ww xY w|t          u rd}n|                     |          }|j        j        dk    r(t          j        |j        |||j        j                  }	n't          j        |j        |||j        j                  }	|	|d<   |r||d<   |S )z$Apply model serializers to a schema.rZ  Nr   r   )r  r-  r   r   )r	  rd  rh   r  r   r  rM   r  r{  r*  r  rA   r  r-   r7  r/   r"  r   r   )
r   r   r  rZ  r  r  r{  r  r-  
ser_schemas
             r   r  z'GenerateSchema._apply_model_serializers  sZ    !**UD11 	1k**2.J/
AUVVHL)BOZ_%@$BW   L L L1A!DD!KL/// $ $ 4 4[ A A#v--4?4cO%"/(o7	5 5 5

 )MO%"/(o7	  
 '1F?# 	 F5Ms   *A: :
BBBr   )r  rQ   r   r  r  r  r   r   )r!  rR   r"  r   r  r  r  r  r  r   r   r  )r   rQ   )r   r  )r   r  )r   r   )r   r)   )r4  r   r   r)   )r:  r   r;  r   r   r)   )rE  rF  r   r)   )r   r   r   r)   r  )r   r)   r  r  r   r)   r  )r  r)   r  r  r   r   r  )r%  r   r  r   r   r   )r   r  r   r   )r  r  r  r  r   r   )r%  r   r  r   r   r  )r%  r   r   r   )r%  r   r  r  r   r  )r%  r   r   r  )F)r%  r   r  r   r   r  )r%  r   r   r  )r%  r   r   r   )r%  r   r  r   r   r)   )
r`  r   ra  r}   r   r_   r  r   r   rb  )r`  r   ra  r}   r   r_   r   rk  )r`  r   ra  r}   r   r_   r   rq  )ry  rz  ra  r}   r   r   r   r   )ry  rz  r  r|   r  r   )r  rQ   ra  r  r   r   r   r   )r`  r   ra  r}   r   r_   r   r  )r  r   r   r   )r  r   r   r)   )r  r   r  r   r   r   )r  r   r  r   r   r   )
r`  r   r  r  r  r   r  r  r   r  )r  r   r   r   )r   r   )r  r   r   r   )r4  r   r   r   )r  r   r   r$  )r(  r   r   r   )r4  r5  r  r6  r   r   )rS  r  r   rT  )rm  rn  r   r   )r  rw  r  rx  r   ry  )r  r   r   r   )r%  r   r   r  r   r  )rY  r   r   r  r  r  r   r)   )r   r   r[  r   r   r   )r  r;   r  r   r  r  r   rt   )r   r   r  r  r}  r   r   r   )r   r   r  r  r   r   )Nr   r  r  r   r=  r   classmethodr-  r  r(  r*  r.  r1  r3  r9  r>  rA  rD  ro  r  r  r  r  	Exceptionr  r  r  r  r7  r  staticmethodr  r  r  r  r&   r  r  r  r  r#  rU  rj  r  rx  r  r  r  r  r\  r<  rA  rB  rD  r   r  r  r:  r=  rR  r  r]  r;  r_  rI  rN  rT  rP  rO  r  r!  rV  rW  r  r  r  r  r  r   r   r   r  r  e  s       ffI /3	# # # # #    [" / / / X/ 0 0 0 X0 
 
 
 X
 < < < X<( ( ( (I I I Ik k k kH H H HN N N NF F F FP
 
 
 
>
2 
2 
2 
2	
 	
 	
 	
   $    9      	
 	
 	
 	
	6 	6 	6 	6 -1- - - - -^dJ dJ dJ dJL [_    \&	 	 	 	5 5 5 5n   , iii XiWWW XW              $ $ $ $2k. k. k. k.Z/. /. /. /.n 
 
 
 
 
 
&
 
 
 
"
 
 
 
* /[ /[ /[ \/[b (\ (\ (\ \(\T % % % \%*j
 j
 j
 j
X   6@ @ @ @,   hO hO hO hOT#e #e #e #eR ![_!  !  !  !  ! F_ _ _ _<
 
 
 

 
 
 
0d d d d
> > > >.
 
 
 
.M M M Mr r r r8
 
 
 
k( k( k( k(Z3
 3
 3
 3
j, , , ,<@
 @
 @
 @
D       D FQ[	-u -u -u -u -u^( ( ( (T   .? ? ? ?4  %	6 6 6 6 6p& & & & & &r   r  c                ,    t          j        | |          S r   )r/   !no_info_before_validator_functionfr   r_  s      r   rR  rR    s    0]^_ag0h0h r   c                ,    t          j        | |          S r   )r/   rk  r  s      r   rR  rR    s    {/[\]_e/f/f r   c                *    t          j        |           S r   )r/   r  )r  r  r  s      r   rR  rR    s    K,XYZ,[,[ r   c                ,    t          j        | |          S r   )r/   r!  r  s      r   rR  rR   	  s    k.YZ[]c.d.d r   c                0    t          j        | ||          S N)r   )r/   #with_info_before_validator_functionr  r   r   s      r   rR  rR  	  s    ;;j	6j< < < r   c                0    t          j        | ||          S r  )r/   "with_info_after_validator_functionr  s      r   rR  rR  	  s    +:h	6j; ; ; r   c                .    t          j        | |          S r  r  )r  r_  r   s      r   rR  rR  	  s    [5c	j6 6 6 r   c                0    t          j        | ||          S r  )r/   !with_info_wrap_validator_functionr  s      r   rR  rR  
	  s    9f	6j: : : r   ))r   no-info)r   r  )r   r  )r   r  )r   	with-info)r   r  )r   r  )r   r  zMapping[tuple[FieldValidatorModes, Literal['no-info', 'with-info']], Callable[[Callable[..., Any], core_schema.CoreSchema, str | None], core_schema.CoreSchema]]_VALIDATOR_F_MATCHr  Iterable[Decorator[RootValidatorDecoratorInfo]] | Iterable[Decorator[ValidatorDecoratorInfo]] | Iterable[Decorator[FieldValidatorDecoratorInfo]]c                    |D ]O}t          |j        |j        j                  }|rdnd}t	          |j        j        |f         |j        | |          } P| S )a  Apply validators to a schema.

    Args:
        schema: The schema to apply validators on.
        validators: An iterable of validators.
        field_name: The name of the field if validators are being applied to a model field.

    Returns:
        The updated schema.
    r  r  )ri   r  r   r  r  )r   r  r   	validatorr  val_types         r   r   r   	  sd    "   i i	$Y^Y^5HII"*9;;	#Y^%8($CDY^U[]ghhMr   +Iterable[Decorator[ValidatorDecoratorInfo]]c                .    | D ]}|j         j        r dS dS )a?  In v1, if any of the validators for a field had `always=True`, the default value would be validated.

    This serves as an auxiliary function for re-implementing that logic, by looping over a provided
    collection of (v1-style) ValidatorDecoratorInfo's and checking if any of them have `always=True`.

    We should be able to drop this function and the associated logic calling it once we drop support
    for v1-style validator decorators. (Or we can extend it and keep it if we add something equivalent
    to the v1-validator `always` kwarg to `field_validator`.)
    TF)r   always)r  r  s     r   r  r  +	  s1        	>  	44	5r   0Iterable[Decorator[ModelValidatorDecoratorInfo]]r   Literal['inner', 'outer', 'all']c                   |                      dd          }|D ]0}|dk    r|j        j        dk    r|dk    r|j        j        dk    r1t          |j        |j        j                  }|j        j        dk    r:|rt          j        |j        |           } ~t          j        |j        |           } |j        j        dk    r:|rt          j        |j        |           } t          j	        |j        |           } |j        j        dk    sJ |rt          j
        |j        |           } t          j        |j        |           } 2|r|| d<   | S )	a  Apply model validators to a schema.

    If mode == 'inner', only "before" validators are applied
    If mode == 'outer', validators other than "before" are applied
    If mode == 'all', all validators are applied

    Args:
        schema: The schema to apply validators on.
        validators: An iterable of validators.
        mode: The validator mode.

    Returns:
        The updated schema.
    rZ  Nr  r   r  r   )rS  r   r   )r	  r   r  ri   r  r/   r  r!  r  r  r  rk  )r   r  r  rZ  r  r  s         r   r  r  ;	  s   & jj--C n n	7??y~2h>>7??y~2h>>$Y^Y^5HII>&(( m$FPYP^gmnnn$Dineklll^ H,, o$HR[R`ioppp$FPYP^gmnnn>&'1111 n$GQZQ_hnooo$Ey~flmmm
 uMr   ra  r}   c                    | j         r!t          j        || j         | j                  S | j        t
          ur!t          j        || j        | j                  S |S )a  Wrap schema with default schema if default value or `default_factory` are available.

    Args:
        field_info: The field info object.
        schema: The schema to apply default on.

    Returns:
        Updated schema by default value or `default_factory`.
    )default_factoryr  )r  r  )r  r/   with_default_schemar  r  r-   )ra  r   s     r   r  r  j	  sv     ! 	.J$>Q[Ql
 
 
 	
 
	#4	4	4.J.A\
 
 
 	
 r   GetJsonSchemaFunction | Nonec                z   t          | dd          }t          | d          rat                      }|duo|j        j        |t          |dd          fv}|s.t          | dd          }t          d|rd| dnd	 d
d          t          | d          r$t          |           st          | j        |          S |dS |S )z`Extract `__get_pydantic_json_schema__` from a type, handling the deprecated `__modify_schema__`.__get_pydantic_json_schema__N__modify_schema__rV  r   zjThe `__modify_schema__` method is not supported in Pydantic v2. Use `__get_pydantic_json_schema__` insteadz in class ``r  r   zcustom-json-schemar   
__origin__)	r   rI  rq   r  rV  rB   rv   r  r  )r   r   js_modify_functionr~   has_custom_v2_modify_js_funccls_names         r   r  r  	  s    %CTJJr&'' ,..	 d* W6?&0BJPT(U(UVW 	% , 	r:t44H#nZb=j=V8=V=V=V=Vhjn n n)    r<   Hb)9)9 H0GGG!tr   r  r  3JsonDict | typing.Callable[[JsonDict], None] | Noner   c                     d fd}|S )	Ncore_schema_or_fieldrU   r   r<   r   rH   c                F    i  ||           }t          |           |S r   )r  )r  r   r   r  r  s      r   json_schema_update_funcz<get_json_schema_update_func.<locals>.json_schema_update_func	  s8     N!566M:LMk+<===r   )r  rU   r   r<   r   rH   r   )r  r  r  s   `` r   r  r  	  s/           #"r   r   c                    t          |t                    r$|                     t          |                     d S t	          |          r ||            d S d S r   )rz  r   r  r0   callable)r   r  s     r   r  r  	  sm     #T** '-.?@@AAAAA	#	$	$ '+&&&&&' 'r   c                  L    e Zd ZU ded<   ded<   ded<   ded<   ded	<   d
ed<   dS )r  r   r   4str | list[str | int] | list[list[str | int]] | Nonere  r   rf  bool | Nonerd  rm  zdict[str, Any]r[  N)r   r  r  r  r   r   r   r  r  	  sZ         """"JJJJ####&&&&r   r  )re  rf  rd  rm  r[  re  r  rf  rd  r  rm  r[  c                   | |||||dS )Nr   re  rf  rd  rm  r[  r   r  s         r   r  r  	  s%     ,2!6  r   c                  2    e Zd ZdZd
dZedd            Zd	S )r   z*Keeps track of references and definitions.r   r   c                :    t                      | _        i | _        d S r   )r   seenr  r  s    r   r   z_Definitions.__init__	  s    !ee	>@r   r   r   3Iterator[tuple[str, None] | tuple[str, CoreSchema]]c              #  4  K   t          |          }|| j        v s	|| j        v r|t          j        |          fV  dS | j                            |           	 |dfV  | j                            |           dS # | j                            |           w xY w)ao  Get a definition for `tp` if one exists.

        If a definition exists, a tuple of `(ref_string, CoreSchema)` is returned.
        If no definition exists yet, a tuple of `(ref_string, None)` is returned.

        Note that the returned `CoreSchema` will always be a `DefinitionReferenceSchema`,
        not the actual definition itself.

        This should be called for any type that can be identified by reference.
        This includes any recursive types.

        At present the following types can be named/recursive:

        - BaseModel
        - Dataclasses
        - TypedDict
        - TypeAliasType
        N)rY   r  r  r/   r  adddiscard)r   r   rZ  s      r   r  z_Definitions.get_schema_or_ref	  s      ( 2$)sd&666?DDEEEEEEIMM#'Dk!!!	!!#&&&&&	!!#&&&&s   A; ;BNr   r   )r   r   r   r  )r   r  r  r   r   r   r  r   r   r   r   r   	  sR        44A A A A ' ' ' ^' ' 'r   r   r  dict[str, CoreSchema]CoreSchema | Nonec                ~    | d         dk    r|                     | d         d           S | d         dk    r| d         S | S )Nr   r  r   r  r   r:  )r   r  s     r   r  r  	  sJ    f~)))vl3T:::	=	(	(hr   c                  :    e Zd ZdZddZedd            Zdd
ZdS )r  _stackr   r   c                    g | _         d S r   r  r  s    r   r   z_FieldNameStack.__init__
  s    !#r   r   r   Iterator[None]c              #  x   K   | j                             |           d V  | j                                          d S r   r  r  r	  )r   r   s     r   r
  z_FieldNameStack.push
  s=      :&&&r   r   c                .    | j         r| j         d         S d S r   r  r  s    r   r   z_FieldNameStack.get
      ; 	;r?"4r   Nr  )r   r   r   r  )r   r   r   r  r  r=  r   r   r
  r   r   r   r   r  r  
  sa        I$ $ $ $    ^
     r   r  c                  :    e Zd ZdZddZedd            Zdd
ZdS )r  r  r   r   c                    g | _         d S r   r  r  s    r   r   z_ModelTypeStack.__init__
  s    "$r   type_objr   r  c              #  x   K   | j                             |           d V  | j                                          d S r   r  )r   r  s     r   r
  z_ModelTypeStack.push
  s=      8$$$r   type | Nonec                .    | j         r| j         d         S d S r   r  r  s    r   r   z_ModelTypeStack.get 
  r   r   Nr  )r  r   r   r  )r   r  r  r   r   r   r  r  
  sa        I% % % %    ^
     r   r  )r   r   r   r   r   r   )r   r   r   r   r   r   )r   r   r   r   r   r   )r   r   r   r   r   r   r   r   )
r   rU   r   r<   r   r   r   r   r   rH   )r   r   r   r   r   r)   r   r)   )r  r   r  r   r   r   )r   r   r  r  r   r   r   r   )r  r  r   r   )r   r   r  r  r  r  r   r   )ra  r}   r   r   r   r   )r   r   r   r)   r   r  )r  rH   r  r  r   r   )r   rH   r  r  )r   r   re  r  rf  r   rd  r  rm  r  r[  r   r   r  )r   r)   r  r  r   r  )r   
__future__r   _annotationscollections.abcrJ  r   r,  r   ospathlibrG  r
  rM  r   
contextlibr   r   r   r   decimalr   enumr	   	functoolsr
   r   r   r   	ipaddressr   r   r   r   r   r   	itertoolsr   operatorr   typesr   r   r   r   r   r   r   r   r   r   r    r!   r"   r#   r$   r%   r&   uuidr'   r(   typing_extensionspydantic_corer)   r*   r+   r,   r-   r.   r/   r0   r1   r2   r3   r4   r5   r6   aliasesr8   r9   r:   annotated_handlersr;   r<   r  r=   r>   r?   errorsr@   rA   rB   functional_validatorsrC   rD   rE   rF   rG   r   rH   versionrI   rJ   r  rL   rM   rN   rO   rP   _configrQ   rR   _core_metadatarS   rT   rU   rV   rW   rX   rY   rZ   r[   r\   r]   r^   r_   r`   ra   rb   rc   rd   re   rf   rg   rh   ri   _docs_extractionrj   r  rk   _forward_refrl   	_genericsrm   rn   ro   rp   _import_utilsrq   rr   _mock_val_serrs   _schema_generation_sharedrt   ru   rv   rw   rx   ry   _utilsrz   r{   r   r|   r}   mainr~   r   r   r   r   r  r  r   r   AnyFieldDecoratorModifyCoreSchemaWrapHandlerGetCoreSchemaFunctionr   Tupler   r  rd  ListrK  MutableSequencer   r   Set
MutableSetr   	frozenset	FrozenSetr   r   r   r   r  r   PathLikePathPurePath	PosixPathPurePosixPathPureWindowsPathr   MutableMappingOrderedDictDefaultDictdefaultdictCounterr  dequeDequer   r   r   r   r   r   r   JsonEncodersr   r   r   r   r  r  r  r   r  r  r  r  r  r  r  r  r   r  r  r  r   r   r   <module>r?     sw   3 3 3 2 2 2 2 2 2           				  				 



   0 0 0 0 0 0 0 0                           8 8 8 8 8 8 8 8 8 8 f f f f f f f f f f f f f f f f             6 6 6 6 6 6 6 6 6 6                                                	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 d c c c c c c c c c c c c c c c = = = = = = = = = = K K K K K K K K 6 6 6 6 6 6 6 6 6 6 b b b b b b b b b b w w w w w w w w w w w w w w ) ) ) ) ) ) # # # # # # 0 0 0 0 0 0 f f f f f f f f f f f f f f 6 6 6 6 6 6 6 6 D D D D D D D D
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
                            : 9 9 9 9 9 - - - - - - . . . . . . t t t t t t t t t t t t M M M M M M M M ) ) ) ) ) ) C C C C C C p p p p p p p p p p p p p p 6 6 6 6 6 6 6 6 A55555555      %%%%%%//////@@@@@@&'1 13NPllm  !9ASTTT $%)**+-  3  #'B!C[E[![\  &,/ / / / /[_-LM
 M M M Mfj+/*DE	 E E E E )6+;[_=PQ  Q Q Q Q,
 , , , ,#]Km]hi i i i i$o{/GH H H H HKL
     N
OO"!

N ',fl; ; ; ; ; .Zghh  i i i i
   *   6n n n n" " " "T $ $ $ $ $ $N DI{*+   D tCH~t+,. . . . . . . .*% % % %Q Q Q Q Q Q Q Qp< ihff[[dd          2   2    , , , ,^   ,   >
# 
# 
# 
#' ' ' '    9    NR&*)-     &$' $' $' $' $' $' $' $'N          &         r   