AlkantarClanX12

Your IP : 3.17.179.132


Current Path : /opt/cloudlinux/venv/lib64/python3.11/site-packages/pydantic/v1/__pycache__/
Upload File :
Current File : //opt/cloudlinux/venv/lib64/python3.11/site-packages/pydantic/v1/__pycache__/schema.cpython-311.pyc

�

X��e������UddlZddlZddlmZddlmZddlmZmZmZm	Z	ddl
mZddlm
Z
ddlmZmZmZmZmZmZddlmZdd	lmZmZmZmZmZmZmZmZm Z m!Z!m"Z"m#Z#m$Z$m%Z%m&Z&m'Z'm(Z(m)Z)dd
l*m+Z+ddl,m-Z-m.Z.dd
l/m0Z0m1Z1m2Z2m3Z3m4Z4m5Z5m6Z6m7Z7m8Z8m9Z9m:Z:m;Z;m<Z<ddl=m>Z>ddl?m@Z@mAZAddlBmCZCmDZDmEZEmFZFmGZGmHZHmIZImJZJmKZKmLZLmMZMmNZNmOZOmPZPmQZQmRZRmSZSmTZTmUZUddlmVZVmWZWmXZXmYZYmZZZm[Z[m\Z\m]Z]m^Z^ddl_m`Z`maZambZberddlmcZcddldmeZedZfdZge(e&de&e
fZhe$ehZidedde!e<deejefddfd�Zkddddegd�d e#e(e&de&d!fd"eld#e!ejd$e!ejd%e!ejd&ejdeejeffd'�Zmddegfd(e(e&de&d!fd"eld%e!ejd&ejdeejeff
d)�Znd�de<d+elde%eejefelffd,�Zoddegdd-�de<d"eld.eehejfd%e!ejd&ejd/e!eide%eejefeejefe$ejffd0�ZpeqerefZsd1esd2fd3esd4fd5ejd6ffZte%e%eje(eue%eud7ffejfd7fevd8<d9esd:fd;esd<fd=esd>fd?esd@fdAesdBffZwe%e%eje(eue%eud7ffejfd7fevdC<de<deejeffdD�ZxdEeideehejffdF�Zyd�d(e&dd/e!eideifdG�Zzde<d/eideifdH�Z{dIe#e<d/eideifdJ�Z|d e#e&ddeifdK�Z}d(ehdejfdL�Z~d*ddM�de<d"eld.eehejfd&ejd+eld%e!ejd/eide%eejefeejefe$ejffdN�ZddegdddO�d(ehd"eld.eehejfd%e!ejd&ejd/e!eide!e<de%eejefeejefe$ejffdP�Z�ddQ�d(e&dd"eld.eehejfd&ejd%e!ejd/eide%eejefeejefe$ejffdR�Z�ddS�dTe&e
de!e<deejeffdU�Z�d*ddM�de<d"eld.eehejfd&ejd+eld%e!ejd/eide%eejefeejefe$ejffdV�Z�edWdXdY�fedWdZdY�fedWd[dY�fedWd\dY�fe	d]d^dY�fedWd_dY�fedWd`dY�fedWdadY�fedWdbdY�fedWdcdY�fedWdddY�fe"dWd5dY�fejdedWife�dWdfdY�feldedgifeqdedhiferded]ifeded]ife+dWdidY�fe�dedjife�dkidl�fe�dkidl�fe�dkiddm�fe�dkiddm�ffZ�e%e%eeejeffd7fevdn<dWdodY�Z�dpedqeejefddfdr�Z�dsejd%e!ejd&ejd+eldeejeff
dt�Z�d*ddM�de<d"eld.eehejfd&ejd+eld%e!ejd/eide%eejefeejefe$ejffdu�Z�dve%ed7fde<de<fdw�Z�dxedefdy�Z�eqeRerePeeOiZ�eeed7euffevdz<	d�d{ed|e;d}ejd~elde&ef
d�Z�d{ed|e;de%e&ee$ejffd��Z�dsejdejfd��Z�Gd��d�e���Z�dS)��N)�defaultdict)�is_dataclass)�date�datetime�time�	timedelta)�Decimal)�Enum)�IPv4Address�
IPv4Interface�IPv4Network�IPv6Address�
IPv6Interface�IPv6Network)�Path)�
TYPE_CHECKING�Any�Callable�Dict�
ForwardRef�	FrozenSet�Generic�Iterable�List�Optional�Pattern�Sequence�Set�Tuple�Type�TypeVar�Union�cast)�UUID)�	Annotated�Literal�)
�MAPPING_LIKE_SHAPES�SHAPE_DEQUE�SHAPE_FROZENSET�
SHAPE_GENERIC�SHAPE_ITERABLE�
SHAPE_LIST�SHAPE_SEQUENCE�	SHAPE_SET�SHAPE_SINGLETON�SHAPE_TUPLE�SHAPE_TUPLE_ELLIPSIS�	FieldInfo�
ModelField)�pydantic_encoder)�AnyUrl�EmailStr)�ConstrainedDecimal�ConstrainedFloat�ConstrainedFrozenSet�ConstrainedInt�ConstrainedList�ConstrainedSet�ConstrainedStr�SecretBytes�	SecretStr�StrictBytes�	StrictStr�conbytes�
condecimal�confloat�confrozenset�conint�conlist�conset�constr)	�all_literal_values�get_args�
get_origin�
get_sub_types�is_callable_type�is_literal_type�
is_namedtuple�is_none_type�is_union)�ROOT_KEY�	get_model�lenient_issubclass)�	Dataclass��	BaseModelz#/definitions/z#/definitions/{model}rY�
modify_schema).N�field�field_schema�returnc��ddlm}||��}t|j�����}d|vsd|vr|||���dS||��dS)Nr)�	signaturer[�kwargs�r[)�inspectr_�set�
parameters�keys)rZr[r\r_�sig�argss      �G/opt/cloudlinux/venv/lib/python3.11/site-packages/pydantic/v1/schema.py�_apply_modify_schemari`s���"�!�!�!�!�!�
�)�M�
"�
"�C��s�~�"�"�$�$�%�%�D��$���(�d�*�*��
�l�%�0�0�0�0�0�0��
�l�#�#�#�#�#�T)�by_alias�title�description�
ref_prefix�ref_template�modelsrWrkrlrmrnroc�
�d�|D��}t|��}t|��}i}	i}
|r||
d<|r||
d<|D]<}t|||||���\}}
}|	�|
��||}||	|<�=|	r|	|
d<|
S)a�
    Process a list of models and generate a single JSON Schema with all of them defined in the ``definitions``
    top-level JSON key, including their sub-models.

    :param models: a list of models to include in the generated JSON Schema
    :param by_alias: generate the schemas using the aliases defined, if any
    :param title: title for the generated schema that includes the definitions
    :param description: description for the generated schema
    :param ref_prefix: the JSON Pointer prefix for schema references with ``$ref``, if None, will be set to the
      default of ``#/definitions/``. Update it if you want the schemas to reference the definitions somewhere
      else, e.g. for OpenAPI use ``#/components/schemas/``. The resulting generated schemas will still be at the
      top-level key ``definitions``, so you can extract them from there. But all the references will have the set
      prefix.
    :param ref_template: Use a ``string.format()`` template for ``$ref`` instead of a prefix. This can be useful
      for references that cannot be represented by ``ref_prefix`` such as a definition stored in another file. For
      a sibling json file in a ``/schemas`` directory use ``"/schemas/${model}.json#"``.
    :return: dict with the JSON Schema with a ``definitions`` top-level key including the schema definitions for
      the models and sub-models passed in ``models``.
    c�,�g|]}t|����S�)rU)�.0�models  rh�
<listcomp>zschema.<locals>.<listcomp>�s ��9�9�9��I�e�$�$�9�9�9rjrlrm�rk�model_name_maprnro�definitions)�get_flat_models_from_models�get_model_name_map�model_process_schema�update)rprkrlrmrnro�clean_models�flat_modelsrxry�
output_schemaru�m_schema�
m_definitions�m_nested_models�
model_names                rh�schemar�ms���8:�9�&�9�9�9�L�-�l�;�;�K�'��4�4�N��K�$&�M��'�!&�
�g���3�'2�
�m�$��
+�
+��3G���)�!�%�4
�4
�4
�0��-��	���=�)�)�)�#�E�*�
�"*��J����3�'2�
�m�$��rjruc��t|��}t|��}t|��}||}t|||||���\}}}	||	vr|||<t	|||d��}|r|�d|i��|S)aa
    Generate a JSON Schema for one model. With all the sub-models defined in the ``definitions`` top-level
    JSON key.

    :param model: a Pydantic model (a class that inherits from BaseModel)
    :param by_alias: generate the schemas using the aliases defined, if any
    :param ref_prefix: the JSON Pointer prefix for schema references with ``$ref``, if None, will be set to the
      default of ``#/definitions/``. Update it if you want the schemas to reference the definitions somewhere
      else, e.g. for OpenAPI use ``#/components/schemas/``. The resulting generated schemas will still be at the
      top-level key ``definitions``, so you can extract them from there. But all the references will have the set
      prefix.
    :param ref_template: Use a ``string.format()`` template for ``$ref`` instead of a prefix. This can be useful for
      references that cannot be represented by ``ref_prefix`` such as a definition stored in another file. For a
      sibling json file in a ``/schemas`` directory use ``"/schemas/${model}.json#"``.
    :return: dict with the JSON Schema for the passed ``model``
    rwFry)rU�get_flat_models_from_modelr{r|�get_schema_refr})
rurkrnrorrxr�r�r��
nested_modelss
          rh�model_schemar��s���,
�e���E�,�U�3�3�K�'��4�4�N���&�J�-A�
���J�eq�.�.�.�*�H�m�]��]�"�"�$,�
�j�!�!�*�j�,��N�N���8�����
�6�7�7�7��OrjF�schema_overridesc��i}|jjst|jt��s<|jjp,|j����dd��|d<|jjrd}|jjr|jj|d<d}|js4|j	�-t|j��st|j	��|d<d}||fS)N�_� rlTrm�default)
�
field_inforlrV�type_r
�alias�replacerm�requiredr�rO�outer_type_�encode_default)r[r��schema_s   rh�get_field_info_schemar��s���
!�G����[�%7���T�%J�%J�[� �+�1�Z�U�[�5F�5F�5H�5H�5P�5P�QT�VY�5Z�5Z������� �����#� �!&�!1�!=��
�����>� �e�m�7�@P�QV�Qb�@c�@c�7�+�E�M�:�:��	�����$�$�$rj)rkrnro�known_modelsrxr�c
��t|��\}}t|��}|r|�|��d}t|||||||p
t	�����\}	}
}d|	vr|	|
|fS|�|	��||
|fS)a�
    Process a Pydantic field and return a tuple with a JSON Schema for it as the first item.
    Also return a dictionary of definitions with models as keys and their schemas as values. If the passed field
    is a model and has sub-models, and those sub-models don't have overrides (as ``title``, ``default``, etc), they
    will be included in the definitions and referenced in the schema instead of included recursively.

    :param field: a Pydantic ``ModelField``
    :param by_alias: use the defined alias (if any) in the returned schema
    :param model_name_map: used to generate the JSON Schema references to other models included in the definitions
    :param ref_prefix: the JSON Pointer prefix to use for references to other schemas, if None, the default of
      #/definitions/ will be used
    :param ref_template: Use a ``string.format()`` template for ``$ref`` instead of a prefix. This can be useful for
      references that cannot be represented by ``ref_prefix`` such as a definition stored in another file. For a
      sibling json file in a ``/schemas`` directory use ``"/schemas/${model}.json#"``.
    :param known_models: used to solve circular references
    :return: tuple of the schema for this field and additional definitions
    T�rkrxr�rnror��$ref)r��get_field_schema_validationsr}�field_type_schemarc)r[rkrxrnror��sr��validation_schema�f_schema�
f_definitions�f_nested_modelss            rhr\r\�s���40��6�6��A��4�U�;�;��� �	���"�#�#�#���/@�
��%�)��!�!�*�S�U�U�0�0�0�,�H�m�_��������7�7�	��������-��0�0rj�
max_length�	maxLength�
min_length�	minLength�regex�pattern.�_str_types_attrs�gt�exclusiveMinimum�lt�exclusiveMaximum�ge�minimum�le�maximum�multiple_of�
multipleOf�_numeric_types_attrsc��i}t|jt��r-|jjr|�|jj��|St|jttf��r9tD]1\}}}t|j|d��}t||��r|||<�2t|jt��rSt|jt��s9tD]1\}}}t|j|d��}t||��r|||<�2|j�|jjr
|j|d<|jjr|�|jj��t|jdd��}|rt%|||��|S)z�
    Get the JSON Schema validation keywords for a ``field`` with an annotation of
    a Pydantic ``FieldInfo`` with validation arguments.
    N�const�__modify_schema__)rVr�r
r��extrar}�str�bytesr��getattr�
isinstance�
numeric_types�
issubclass�boolr�r�r�r�ri)r[r��	attr_name�t�keyword�attrrZs       rhr�r�"s���
 "�H��%�+�t�,�,����!�	4��O�O�E�,�2�3�3�3����%�+��U�|�4�4�)�%5�	)�	)�!�I�q�'��5�+�Y��=�=�D��$��"�"�
)�$(���!���%�+�}�5�5�)�j���VZ�>[�>[�)�%9�	)�	)�!�I�q�'��5�+�Y��=�=�D��$��"�"�
)�$(���!����#��(8�(>�#�!�M�������0�����(�.�/�/�/��E�-�/B�D�I�I�M��=��]�E�8�<�<�<��Orj�
unique_modelsc�r�i}t��}|D]�}t|j��}||vrt|��}|||<�/||vrO|�|��|�|��}||t|��<||t|��<��|||<��d�|���D��S)a�
    Process a set of models and generate unique names for them to be used as keys in the JSON Schema
    definitions. By default the names are the same as the class name. But if two models in different Python
    modules have the same name (e.g. "users.Model" and "items.Model"), the generated names will be
    based on the Python module path for those conflicting models to prevent name collisions.

    :param unique_models: a Python set of models
    :return: dict mapping models to names
    c��i|]\}}||��	Srsrs�rt�k�vs   rh�
<dictcomp>z&get_model_name_map.<locals>.<dictcomp>[s��4�4�4�T�Q��A�q�4�4�4rj)rc�normalize_name�__name__�get_long_model_name�add�pop�items)r��name_model_map�conflicting_namesrur��conflicting_models      rhr{r{Cs����N�"%�%�%���/�/��#�E�N�3�3�
��*�*�*�,�U�3�3�J�).�N�:�&�&�
�>�
)�
)��!�!�*�-�-�-� .� 2� 2�:� >� >��EV�N�.�/@�A�A�B�9>�N�.�u�5�5�6�6�).�N�:�&�&�4�4�^�1�1�3�3�4�4�4�4rjc��|p
t��}t��}|�|��||z}ttt|j�����}|t||���z}|S)a?
    Take a single ``model`` and generate a set with itself and all the sub-models in the tree. I.e. if you pass
    model ``Foo`` (subclass of Pydantic ``BaseModel``) as ``model``, and it has a field of type ``Bar`` (also
    subclass of ``BaseModel``) and that model ``Bar`` has a field of type ``Baz`` (also subclass of ``BaseModel``),
    the return value will be ``set([Foo, Bar, Baz])``.

    :param model: a Pydantic ``BaseModel`` subclass
    :param known_models: used to solve circular references
    :return: a set with the initial model and all its sub-models
    �r�)rcr�r#rr4�
__fields__�values�get_flat_models_from_fields)rur�r�fieldss    rhr�r�^sx�� �(�3�5�5�L� #���K��O�O�E�����K��L�
�(�:�&��(8�(?�(?�(A�(A�
B�
B�F��.�v�L�Q�Q�Q�Q�K��rjc��ddlm}t��}|j}t	t|dd��|��r|j}|jr*t	||��s|t|j|���z}nSt	||��r||vr|t||���z}n*t	|t��r|�|��|S)a�
    Take a single Pydantic ``ModelField`` (from a model) that could have been declared as a subclass of BaseModel
    (so, it could be a submodel), and generate a set with its model and all the sub-models in the tree.
    I.e. if you pass a field that was declared to be of type ``Foo`` (subclass of BaseModel) as ``field``, and that
    model ``Foo`` has a field of type ``Bar`` (also subclass of ``BaseModel``) and that model ``Bar`` has a field of
    type ``Baz`` (also subclass of ``BaseModel``), the return value will be ``set([Foo, Bar, Baz])``.

    :param field: a Pydantic ``ModelField``
    :param known_models: used to solve circular references
    :return: a set with the model used in the declaration for this field, if any, and all its sub-models
    r'rX�__pydantic_model__Nr�)�mainrYrcr�rVr�r��
sub_fieldsr�r�r
r�)r[r�rYr�
field_types     rh�get_flat_models_from_fieldr�rs��� ������ #���K���J��'�*�.B�D�I�I�9�U�U�3��2�
���$� 2�:�y� I� I�$��2�5�3C�R^�_�_�_�_���	�J�	�	2�	2�$�z��7U�7U��1�*�<�X�X�X�X���	�J��	-�	-�$����
�#�#�#��rjr�c�T�t��}|D]}|t||���z}�|S)a�
    Take a list of Pydantic  ``ModelField``s (from a model) that could have been declared as subclasses of ``BaseModel``
    (so, any of them could be a submodel), and generate a set with their models and all the sub-models in the tree.
    I.e. if you pass a the fields of a model ``Foo`` (subclass of ``BaseModel``) as ``fields``, and on of them has a
    field of type ``Bar`` (also subclass of ``BaseModel``) and that model ``Bar`` has a field of type ``Baz`` (also
    subclass of ``BaseModel``), the return value will be ``set([Foo, Bar, Baz])``.

    :param fields: a list of Pydantic ``ModelField``s
    :param known_models: used to solve circular references
    :return: a set with any model declared in the fields, and all their sub-models
    r�)rcr�)r�r�rr[s    rhr�r��s>��!$���K��T�T���1�%�l�S�S�S�S����rjc�P�t��}|D]}|t|��z}�|S)a_
    Take a list of ``models`` and generate a set with them and all their sub-models in their trees. I.e. if you pass
    a list of two models, ``Foo`` and ``Bar``, both subclasses of Pydantic ``BaseModel`` as models, and ``Bar`` has
    a field of type ``Baz`` (also subclass of ``BaseModel``), the return value will be ``set([Foo, Bar, Baz])``.
    )rcr�)rprrus   rhrzrz�s7��!$���K��9�9���1�%�8�8�8����rjc�L�|j�d|j���dd��S)N�__�.)�
__module__�__qualname__r��rus rhr�r��s,����6�6�%�"4�6�6�>�>�s�D�I�I�Irj)r�rnc	�4�ddlm}i}t��}	|jtt
ttttthvrdt||||||���\}
}}|�|��|	�|��d|
d�}
|jtthvrd|
d<�n|jtvr�dd	i}
tt|j��}t#|jd
d��}t||||||���\}
}}|�|��|	�|��|rt'j|��|
i|
d<|
r|
|
d
<�nk|jt*ks%|jt,kr�t/|j|��s�g}tt0t|j��}|D]Z}t5||||||���\}}}|�|��|	�|��|�|���[t9|��}|jt,kr|dkr|dnd|d�}d|gi}
nzd||d�}
|dkr||
d<nh|jt:t,hvsJ|j���t|||||||���\}
}}|�|��|	�|��|j|jkrC|jt,kr|j}n|j}t#|dd��}|rt?|||
��|
||	fS)a

    Used by ``field_schema()``, you probably should be using that function.

    Take a single ``field`` and generate the schema for its type only, not including additional
    information as title, etc. Also return additional schema definitions, from sub-models.
    r'rX�rkrxrnror��array��typer�T�uniqueItemsr��objectr�N�patternProperties�additionalPropertiesr�allOf)r��minItems�maxItemsr�r�r�) r�rYrc�shaper-r2r.r/r*r,r)�field_singleton_schemar}r(r#r4�	key_fieldr�r�r>�_get_patternr1r+r�rr�r��append�lenr0r�ri)r[rkrxror�rnr�rYryr��items_schemar�r�r�r�r��
sub_schemar��sf�	sf_schema�sf_definitions�sf_nested_models�sub_fields_len�all_of_schemasr�rZs                          rhr�r��s���  �������K�!�e�e�M��{�����������8N���)�!�%�%�
8
�8
�8
�4��m�_�	���=�)�)�)����_�-�-�-�#�l�;�;���;�9�o�6�6�6�&*�H�]�#��	��+�	+�	+��H�%����U�_�5�5�	��	���$�7�7��7M���)�!�%�%�
8
�8
�8
�4��m�_�	���=�)�)�)����_�-�-�-��	_�.<�-H��-O�-O�Q]�,^�H�(�)��	<�/;�H�+�,��	���	#�	#���}�(D�(D�Z�X]�Xc�en�Mo�Mo�(D��
��$�z�*�E�,<�=�=�
��	)�	)�B�:K��!�-�%�)�)�
;�;�;�7�I�~�'7�
���~�.�.�.�� � �!1�2�2�2����i�(�(�(�(��Z�����;�-�'�'�.<��.A�.A�Z��]�]�PW�bl�Gm�Gm�N��.�!1�2�H�H� �*�*���H�
��"�"�$.���!���{��
�>�>�>�>���>�>�>�3I���)�-�!�%�%�4
�4
�4
�0��-��	���=�)�)�)����_�-�-�-�
�{�e�'�'�'��;�-�'�'���J�J��*�J��
�,?��F�F�
��	A� ���x�@�@�@��[�-�/�/rj)rkrnror�r[c���ddlm}m}|p
t��}t	|t
��rBt
tt
|��}t||���}	|	it��fSt
td|��}d|j	j
p|ji}	||��}
|
r|
|	d<|�|��t||||||���\}}}
|	�|��|j	j}t!|��r:t#||��j��dkr||	��n"||	|��n|	�|��|	||
fS)	au
    Used by ``model_schema()``, you probably should be using that function.

    Take a single ``model`` and generate its schema. Also return additional schema definitions, from sub-models. The
    sub-models of the returned schema will be referenced, but their definitions will not be included in the schema. All
    the definitions are returned as the second value.
    r)�getdocr_rarYrlrmr�r')rbrr_rcrVr
r#r �enum_process_schema�
__config__rlr�r��model_type_schemar}�schema_extra�callabler�rd)rurkrxrnror�r[rr_r��docr�r�r�rs               rhr|r|(s���"*�)�)�)�)�)�)�)��(�3�5�5�L��%��&�&���T�$�Z��'�'����U�3�3�3���"�c�e�e�|����k�"�E�*�*�E�	�%�"�(�:�E�N�;�A�
�&��-�-�C�
����-�����U����->�
��%��!�!�
.�.�.�*�H�m�]��H�H�X�����#�0�L�������y�y��&�&�1�2�2�a�7�7��L��O�O�O�O��L��E�"�"�"�"�	��������m�]�*�*rj)rnc	��i}g}i}t��}	|j���D]�\}
}	t||||||���\}}
}n6#t$r)}tj|jt��Yd}~�Nd}~wwxYw|�	|
��|	�	|��|r,|||j
<|jr|�|j
����|||
<|jr|�|
����t|vr$|t}|jjp|j|d<nd|d�}|r||d<|jjdkrd|d	<|||	fS)
a)
    You probably should be using ``model_schema()``, this function is indirectly used by that function.

    Take a single ``model`` and generate the schema for its type only, not including additional
    information as title, etc. Also return additional schema definitions, from sub-models.
    r�Nrlr�)r��
propertiesr��forbidFr�)rcr�r�r\�	SkipField�warnings�warn�message�UserWarningr}r�r�r�rTrrlr�r�)rurkrxrornr�rr�ryr�r��fr�r�r��skip�
out_schemas                 rhrrZs����J��H�"$�K�!�e�e�M�� �&�&�(�(�#�#���1�	�7C��!�-�%�)�)�
8�8�8�4�H�m�_�_���	�	�	��M�$�,��4�4�4��H�H�H�H�����	����	���=�)�)�)����_�-�-�-��	#�"*�J�q�w���z�
)������(�(�(��$�J�q�M��z�
#�����"�"�"���:�����)�
�#�.�4�F���
�7���&�j�A�A�
��	.�%-�J�z�"�����)�)�-2�
�)�*��{�M�1�1s�A�
B�A<�<Bra�enumc��ddl}|j|�|jpd��d�t	t
t|��D��d�}t||��t|dd��}|rt|||��|S)z�
    Take a single `enum` and generate its schema.

    This is similar to the `model_process_schema` function, but applies to ``Enum`` objects.
    rNzAn enumeration.c��g|]	}|j��
Srs)�value)rt�items  rhrvz'enum_process_schema.<locals>.<listcomp>�s��C�C�C����C�C�Crj)rlrmrr�)
rbr��cleandoc�__doc__r#rr
�add_field_type_to_schemar�ri)rr[rbr�rZs     rhrr�s����N�N�N����'�'���(I�8I�J�J�C�C��X�d�^�T�(B�(B�C�C�C�
��G��T�7�+�+�+��D�"5�t�<�<�M��<��]�E�7�;�;�;��Nrjc
�$����ttt|j��}i}t	��}	t|��dkrt
|d|�|��|���Si}
|jdu}|r�|j�J�i}|j�	��D]�\}
}t|
t��rt|
j
��}
tt|j����r(t#|j��}���fd�|D��||
<�w|j}t%|d��r|j}�|}t)|��d��}|d||
<��|j|d	�|
d
<g}|D]�}t
||�|��|���\}}}|�|��|rd|vr|dd}|���d
dhkr|�d
��|�|��|	�|����||
|rdnd
<|
||	fS)aA
    This function is indirectly used by ``field_schema()``, you probably should be using that function.

    Take a list of Pydantic ``ModelField`` from the declaration of a type with parameters, and generate their
    schema. I.e., fields used as "type parameters", like ``str`` and ``int`` in ``Tuple[str, int]``.
    r'rr�Nc	�N��i|]!}�|t�|��d����"S�F)r�)rt�	sub_modelrxrnros  ���rhr�z5field_singleton_sub_fields_schema.<locals>.<dictcomp>�sQ���F�F�F�&�'�y�1�>�*�9�5�z�<�QV�4�4�F�F�Frjr�Fr�)�propertyName�mapping�
discriminatorr��oneOf�anyOf)r#rr4r�rcr�r��discriminator_key�sub_fields_mappingr�r�r
r�rrSrMr�rN�hasattrr�r��discriminator_aliasr}rer�r�)r[rkrxror�rnr�r�ryr�r��field_has_discriminator�discriminator_models_refs�discriminator_value�	sub_field�
sub_models�sub_field_type�discriminator_model_name�discriminator_model_ref�sub_field_schemasr�r��sub_definitions�sub_nested_modelss  `` `                  rh�!field_singleton_sub_fields_schemar6�s������ �d�:�&��(8�9�9�J��K�!�e�e�M�
�:���!��� ��q�M��)�-�!�%�%�
�
�
�	
���(-�(?�t�(K��"�	��+�7�7�7�OQ�%�27�2J�2P�2P�2R�2R�
e�
e�.�#�Y��1�4�8�8�I�*-�.A�.G�*H�*H�'��J�y��7�7�8�8�e�!.�y��!?�!?�J�F�F�F�F�F�F�*4�	F�F�F�-�.A�B�B�&/�_�N��~�/C�D�D�K�)7�)J��/=�n�/M�,�.<�=U�Wa�co�qv�.w�.w�+�E\�]c�Ed�-�.A�B�B�!&� 9�4�"�"�A�o��
���	4�	4�B�=N��!�-�!1�%�)�)�>�>�>�:�J��):�
����/�/�/��
4�G�z�$9�$9�(��0��3�
���� � �_�g�$>�>�>�����/�/�/��$�$�Z�0�0�0�� � �!2�3�3�3�3�=N��,�
9�'�'�'�:��+�}�,�,rj�string�path)r��formatz	date-timerr�numberz
time-delta�ipv4network�ipv6network�
ipv4interface�
ipv6interface�ipv4�ipv6r��binary�boolean�integer�uuidr�r�r�)r�r�r��field_class_to_schemazjson-stringr�r�c��tD]>\}}t||��s||cxur	turn�&|�|��dS�?dS)a
    Update the given `schema` with the type-specific metadata for the given `field_type`.

    This function looks through `field_class_to_schema` for a class that matches the given `field_type`,
    and then modifies the given `schema` with the information from that type.
    N)rErVrr})r�r�r��t_schemas    rhrr%ss��1�����x��j�%�0�0�	�J�%�4R�4R�4R�4R�7�4R�4R�4R�4R�4R��N�N�8�$�$�$��E�E�5S��rj�namec�X�|rd||zi}nd|�|���i}|rd|gin|S)Nr�r�r�)r9)rHrnror��
schema_refs     rhr�r�3sM���?��j�4�/�0�
�
��l�1�1��1�=�=�>�
�&6�F�G�j�\�"�"�J�Frjc	��ddlm}i}t��}	|j}
|jr9|jr|jjst|
|��st|||||||���S|
tus/|
tus&|
jtkst|
��turi||	fSt|
��rddi||	fSt!|
��rt#d|j�d����i}|j�|jjr
|j|d	<t)|
��r�t+d
�t-|
��D����}t/d�|D����dkr#t1t3||��|||||���S|d
j}
t5|��|d<t7|
|���n6t|
t8��rU||
}
t;||��\}}|�t?|
|||����tA|
|���||
<n�tC|
��rytE|
j#||||||���^}}t5|d�$����}|�d|t/|��t/|��d���nDtK|
d��s4t7|
|��tM|
dd��}|rtO|||��|r|||	fSttM|
dd��|��r|
j#}
tQ|
|��r�||
}|
|vrJtE|
||||||���\}}}|�|��|||<|	�|��n|	�)|��t?||||��}|||	fStU|
��}|�|stV|
j,vr|||	fSt[d|�����)z�
    This function is indirectly used by ``field_schema()``, you should probably be using that function.

    Take a single Pydantic ``ModelField``, and return its schema and any additional definitions from sub-models.
    r'rXr�r��nullz	Callable zC was excluded from schema since JSON schema has no equivalent type.Nr�c3�RK�|]"}t|t��r|jn|V��#dS�N)r�r
r)rt�xs  rh�	<genexpr>z)field_singleton_schema.<locals>.<genexpr>is7����e�e��*�Q��"5�"5�<�q�w�w�1�e�e�e�e�e�erjc��h|]	}|j��
Srs)�	__class__�rtr�s  rh�	<setcomp>z)field_singleton_schema.<locals>.<setcomp>ks��,�,�,����,�,�,rjr�rrra)rkrxrnror�r[rr�)r�r�r�r�r�r�z.Value not declarable with JSON Schema, field: ).r�rYrcr�r�r�r�rVr6rr�rRr!rMr�rRrOrrHr�rP�tuplerKr�r\�#multitypes_literal_field_for_schema�listrr
r�r}r�rrQr|r�r�r)r�rir�r�rLr�	__bases__�
ValueError)r[rkrxror�rnr�rYryr�r�r�r��	enum_namer�r��
items_schemasrZr�r4r5rJrgs                       rhr�r�;s��� ������"$�K�!�e�e�M���J�
��
�	�	�
�#�.�4�
�=O�PZ�\e�=f�=f�
�1���)�-�!�%�%�
�
�
�	
��S���J�&�0�0�J�4H�G�4S�4S�Wa�bl�Wm�Wm�qu�Wu�Wu��;�
�-�-��J���<�����m�;�;��
�#�#�u��s�E�J�s�s�s�t�t�t�!�H���#��(8�(>�#�!�M�����z�"�"�.A��e�e�FX�Yc�Fd�Fd�e�e�e�e�e���,�,�V�,�,�,�-�-��1�1��3�F�E�B�B�!�-�%�)�)�
���
��A�Y�(�
���<�<���� ��X�6�6�6�6�	�J��	-�	-�A�"�:�.�	�%:�5�BR�%S�%S�"��"�����y�*�l�L\�]�]�^�^�^�!4�Z�u�!M�!M�!M��I���	�z�	"�	"�A�-��)��)�!�%�%��
�
�
��
�Q��Z��5�<�<�>�>�?�?�
�����&��
�.�.��
�.�.�	
�
�	
�	
�	
�	
��Z�!5�
6�
6�A� ��X�6�6�6��
�,?��F�F�
��	A� ���x�@�@�@��4���m�3�3��'�*�.B�D�I�I�9�U�U�3��2�
��*�i�(�(�6�#�J�/�
��\�)�)�=Q��!�-�%�)�)��>�>�>�:�J��):�
����/�/�/�&0�K�
�#�� � �!2�3�3�3�3����j�)�)�)�#�J�
�L�JZ�[�[�
��;�
�5�5��J���D������J�4H�)H�)H���m�3�3�
�M�e�M�M�
N�
N�Nrjr�c
�T�tt��}|D]"}||j�|���#d�|���D��}t|jtt|��|j	|j
|j|j|j
|j���S)z�
    To support `Literal` with values of different types, we split it into multiple `Literal` with same type
    e.g. `Literal['qwe', 'asd', 1, 2]` becomes `Union[Literal['qwe', 'asd'], Literal[1, 2]]`
    c3�JK�|]}tt|��V��dSrN)r&rU)rt�same_type_valuess  rhrPz6multitypes_literal_field_for_schema.<locals>.<genexpr>�s1����r�r�>N���'7�!8�!8�9�r�r�r�r�r�rrj)rHr��class_validators�model_configr�r�r�r�)rrWrRr�r�r4rHr"rUr_r`r�r�r�r�)r�r[�literal_distinct_typesr��distinct_literalss     rhrVrV�s���
)��.�.��
�6�6���q�{�+�2�2�1�5�5�5�5�r�r�Rh�Ro�Ro�Rq�Rq�r�r�r���
�Z��E�+�,�,�-��/��'��
����k��#�	�	�	�	rj�dftc�.�ddlm}t||��st|��rt	dt|����}t|t��rd�|���D��St|t��r|j	St|tttf��r|St|ttf��r2|j}d�|D��}t!|��r||�n
||��S|�dSt|��S)Nr'rXzdict[str, Any]c�N�i|]"\}}t|��t|����#Srs�r�r�s   rhr�z"encode_default.<locals>.<dictcomp>�s.��M�M�M���A��q�!�!�>�!�#4�#4�M�M�Mrjc3�4K�|]}t|��V��dSrNrfrSs  rhrPz!encode_default.<locals>.<genexpr>�s*����3�3�!�N�1�%�%�3�3�3�3�3�3rj)r�rYr�rr#r5�dictr�r
r�int�floatr�rWrUrRrQ)rcrYr��seq_argss    rhr�r��s!���������#�y�!�!�<�\�#�%6�%6�<��#�%5�c�%:�%:�;�;���#�t���
%�M�M������M�M�M�M�	�C��	�	�%��y��	�C�#�u�c�*�	+�	+�	%��
�	�C�$���	'�	'�%��M��3�3�s�3�3�3��,�Q�/�/�@�q�q�(�|�|�Q�Q�x�[�[�@�	���t���$�$�$rj�_map_types_constraint�
annotationr��
field_name�validate_assignmentc��|���}t��}|rt||��\}}|r|�d��||z
}|r)t	d|�dd�|���d����|S)a=
    Get an annotation with validation implemented for numbers and strings based on the field_info.
    :param annotation: an annotation from a field specification, as ``str``, ``ConstrainedStr``
    :param field_info: an instance of FieldInfo, possibly with declarations for validations and JSON Schema
    :param field_name: name of the field for use in error messages
    :param validate_assignment: default False, flag for BaseModel Config value of validate_assignment
    :return: the same ``annotation`` if unmodified or a new annotation with validation in place
    �allow_mutationz
On field "z<" the following field constraints are set but not enforced: z, z\. 
For more details see https://docs.pydantic.dev/usage/schema/#unenforced-field-constraints)�get_constraintsrc�get_annotation_with_constraintsr�rY�join)rmr�rnro�constraints�used_constraints�unused_constraintss       rh�get_annotation_from_field_inforx�s����,�,�.�.�K�!$�����_�'F�z�S]�'^�'^�$�
�$��/����-�.�.�.�$�'7�7���
��
k��
k�
k��y�y�+�,�,�
k�
k�
k�
�
�	
��rjc�����t���dtdttf���fd���|���fS)a�
    Get an annotation with used constraints implemented for numbers and strings based on the field_info.

    :param annotation: an annotation from a field specification, as ``str``, ``ConstrainedStr``
    :param field_info: an instance of FieldInfo, possibly with declarations for validations and JSON Schema
    :return: the same ``annotation`` if unmodified or a new annotation along with the used constraints.
    r�r]c
�	���t���s7t�t��s"t�tt
tf��r�St���}|��Dt���}td�|D����r�S|tur�	|d��St|��r&tt�	fd�|D����St|t��r]�j��j��j�H�
�hd���t)�	|d���j�j�j���St|t*��rP�j��j�B�
�ddh��t-�	|d���j�j���St|t.��rP�j��j�B�
�ddh��t1�	|d���j�j���St2tt*t.t4fD]5}t||��r#|t�	fd	�|D����cS�6t|t6��r$t6|d�	|d
��fSd}d}t�t8���r�t�t:t<f��r#d}dt>d
t@t>f�fd�}�nxt�tB��r]t�tDtFf��sAd}t�tH��r!dt>d
t@t>f�fd�}�ntJ}�nt�tL��r?d}t�tN��r dt>d
t@t>f�fd�}n�tP}n�t�tR��r�t�tTtVtXtt
ttZf��scd}t�t\��r|dz
}t�t^��r|dz
}ta�fd�tRD����}tb|}|rf�
�te|����d��fd�|D��D��}|r*tgthdt8f|��}|di|��S�S)Nc3�@K�|]}t|t��V��dSrN)r�r)rt�as  rhrPz>get_annotation_with_constraints.<locals>.go.<locals>.<genexpr>s,����;�;��:�a��,�,�;�;�;�;�;�;rjrc3�.�K�|]}�|��V��dSrNrs�rtr|�gos  �rhrPz>get_annotation_with_constraints.<locals>.go.<locals>.<genexpr>"�+�����"7�"7�Q�2�2�a�5�5�"7�"7�"7�"7�"7�"7rj>�	max_items�	min_items�unique_items)r�r�r�r�r�)r�r�c3�.�K�|]}�|��V��dSrNrsr~s  �rhrPz>get_annotation_with_constraints.<locals>.go.<locals>.<genexpr>;r�rjr')r�r��kwr]c�2��t�j�f|��SrN�r�r��r�r�s �rh�constraint_funczDget_annotation_with_constraints.<locals>.go.<locals>.constraint_funcFs��������"�=�=�=rj)r�r�r�c�2��t�j�f|��SrNr�r�s �rhr�zDget_annotation_with_constraints.<locals>.go.<locals>.constraint_funcM����#�E�N�U�H�b�A�A�Arjc�2��t�j�f|��SrNr�r�s �rhr�zDget_annotation_with_constraints.<locals>.go.<locals>.constraint_funcVr�rj)r�r�r�r�r�)�
allow_inf_nan)�
max_digits�decimal_placesc3�<�K�|]}t�|���|V��dSrN)r�)rtr�r�s  �rhrPz>get_annotation_with_constraints.<locals>.go.<locals>.<genexpr>ms3�����#U�#U�!�
�5�RS�@T�@T�#U�A�#U�#U�#U�#U�#U�#Urjc��i|]
\}}|�||��SrNrs)rtr�r�s   rhr�z?get_annotation_with_constraints.<locals>.go.<locals>.<dictcomp>rs.�����#�I�t��#��4�#�#�#rjc3�<�K�|]}|t�|��fV��dSrN)r�)rtr�r�s  �rhrPz>get_annotation_with_constraints.<locals>.go.<locals>.<genexpr>ts3�����'k�'k�Xa��G�J�	�4R�4R�(S�'k�'k�'k�'k�'k�'krj.rs)5rPr�rrVr<r=r:rMrL�anyr%rSr"rUr�rr�r�r�r}rHrrIrrFrrrr�r@r?rr r�r7r6rBrJr�rArCr�r;r9r8r�rjr	�nextrlrcr#r)r��originrgr��attrsr��numeric_typer`r�rrvs`       ���rhrz+get_annotation_with_constraints.<locals>.gosk�����E�"�"�	��%��,�,�	�"�%�/�>�K_�)`�a�a�	�
�L��E�"�"����$,�U�O�O�D��;�;�d�;�;�;�;�;�
�����"�"��r�$�q�'�{�{�"�����
9��U�"7�"7�"7�"7�$�"7�"7�"7�7�7�8�8��&�$�'�'�
��$�0��'�3��*�6� �'�'�(R�(R�(R�S�S�S���B�t�A�w�K�K�(�2�(�2�!+�!8�	�����&�#�&�&�
k�J�,@�,L�PZ�Pd�Pp� �'�'��k�(B�C�C�C��b�b��a��k�k�Z�5I�U_�Ui�j�j�j�j��&�)�,�,�
q�*�2F�2R�V`�Vj�Vv� �'�'��k�(B�C�C�C�#�B�B�t�A�w�K�K�:�;O�[e�[o�p�p�p�p��T�3�	�8�<�
9�
9���f�a�(�(�9��U�"7�"7�"7�"7�$�"7�"7�"7�7�7�8�8�8�8�9��&�$�'�'�
2��D��G�R�R��Q��[�[�0�1�1�+/��9=���e�T�"�"�,	F��%�)�[�!9�:�:�+
F�4��>�#�>�$�s�)�>�>�>�>�>�>�>��E�3�'�'�%
F�
�5�8�V�BT�0U�0U�%
F�=���e�Y�/�/�-�B�c�B�d�3�i�B�B�B�B�B�B�B�'-�O�O��E�5�)�)�
F�=���e�[�1�1�/�B�c�B�d�3�i�B�B�B�B�B�B�B�'/�O�O��E�=�1�1�
F�*��"�$�&�#�"�(���;�;�
F�@���e�U�+�+�0��/�/�E��e�W�-�-�>��=�=�E�#�#U�#U�#U�#U�}�#U�#U�#U�U�U��"7��"E���		1��#�#�C��J�J�/�/�/���'k�'k�'k�'k�ej�'k�'k�'k����F�
�
1�"&�x��T�	�':�O�"L�"L��&��0�0��0�0�0��rj)rcrr )rmr�rrvs `@@rhrsrssl�����"%����i�#�i�$�s�)�i�i�i�i�i�i�i�i�V�2�j�>�>�+�+�+rjc�.�tjdd|��S)zU
    Normalizes the given name. This can be applied to either a model *or* enum.
    z[^a-zA-Z0-9.\-_]r�)�re�sub)rHs rhr�r�s���6�%�s�D�1�1�1rjc�"�eZdZdZdeddfd�ZdS)rz?
    Utility exception used to exclude fields from schema.
    rr]Nc��||_dSrN)r)�selfrs  rh�__init__zSkipField.__init__�s
������rj)r�r�r�rr�r�rsrjrhrr�s@�����������������rjrr rN)�r�r�collectionsr�dataclassesrrrrr�decimalr	rr
�	ipaddressrrr
rrr�pathlibr�typingrrrrrrrrrrrrrrr r!r"r#rDr$�typing_extensionsr%r&r�r(r)r*r+r,r-r.r/r0r1r2r3r4�jsonr5�networksr6r7�typesr8r9r:r;r<r=r>r?r@rArBrCrDrErFrGrHrIrJrKrLrMrNrOrPrQrRrS�utilsrTrUrVrWr�rY�default_prefix�default_ref_template�TypeModelOrEnum�TypeModelSetr�rir�r�r�r�r\rirjr�r�r��__annotations__r�r�r{r�r�r�rzr�r�r|rrr6r�rhrWrUrc�	frozensetrE�json_schemerr�r�rVr�rlrxrsr��	Exceptionrrsrjrh�<module>r�s��	�	�	�	�	�����#�#�#�#�#�#�$�$�$�$�$�$�4�4�4�4�4�4�4�4�4�4�4�4�������������f�f�f�f�f�f�f�f�f�f�f�f�f�f�f�f�����������������������������������������������(������0�0�0�0�0�0�0�0�������������������������������#�"�"�"�"�"�&�&�&�&�&�&�&�&�������������������������������������������*
�
�
�
�
�
�
�
�
�
�
�
�
�
�
�
�
�
�
�
�
�
�;�:�:�:�:�:�:�:�:�:�� �&�&�&�&�&�&�������!��.����[�)�4��:�5�6���?�#��
$��I�&�
$�/7�
�/C�
$�SW�X[�]`�X`�Sa�
$�	�
$�
$�
$�
$� ��!%� $�,�2�2�2��U�4��,�d�;�.?�?�@�A�2��2��C�=�	2�
�#��2���
�
2��2�
�#�s�(�^�2�2�2�2�n� $�,�	#�#���k�"�D��$5�5�6�#��#���
�#��	#�

�#�s�(�^�#�#�#�#�L%�%��%�t�%�PU�VZ�[^�`c�[c�Vd�fj�Vj�Pk�%�%�%�%�4� $�,�+/�01�01�01��01��01���#�-�.�	01�
��
�01��
01��<�(�01��4��S��>�4��S��>�3�s�8�3�4�01�01�01�01�f�e�W�%�
��=�+�.��=�+�.��c�9��P��%��c�5��u�T�3�Y�/?�)?�#@�#�E�F��K�L����
�=�,�-�	�=�,�-�	�=�)�$�	�=�)�$��M�<�0�T��e�E�#�u�T�5��s��3C�-C�'D�c�"I�J�C�O�P�����
��t�C��H�~�����B5�l�5�t�O�S�<P�7Q�5�5�5�5�6��d�;�&7��x�P\�G]��iu�����(�j����Q]�����:���(<��L��]i�����$	���k�1B�(C�	��	�	�	�	�J��J�3�J�J�J�J�#� $�t0�t0�t0��t0��t0���#�-�.�	t0�
�t0��
t0���
�t0��t0��4��S��>�4��S��>�3�s�8�3�4�t0�t0�t0�t0�t� $�,�+/�"&�/+�/+�/+��/+��/+���#�-�.�	/+�
��
�/+��
/+��<�(�/+��J��/+��4��S��>�4��S��>�3�s�8�3�4�/+�/+�/+�/+�p!%�
32�32�32����32��32���#�-�.�	32�
�32���
�
32��32��4��S��>�4��S��>�3�s�8�3�4�32�32�32�32�lLP����d�4�j��H�Z�4H��TX�Y\�^a�Ya�Tb�����@#� $�X-�X-�X-��X-��X-���#�-�.�	X-�
�X-��
X-���
�X-��X-��4��S��>�4��S��>�3�s�8�3�4�X-�X-�X-�X-�|
�H��/�/�0�
��K�8�8�9�	�H��/�/�0�	�H��/�/�0���\�:�:�;��8�}�=�=�>��8�}�=�=�>��X��A�A�B��X��A�A�B��8�v�6�6�7��8�v�6�6�7��x�7�3�3�4��6�8�
��
�X��2�2�3�	�F�I����6�9�
��
�V�X����v�x� �!�	�H��/�/�0�	�F�H���	�G�b�)�)�*�
�W�r�*�*�+��7�R��
=�
=�>���2�d�C�C�D�1A��u�U�3��S�#�X��#6�7��<�=����6 �=�9�9�����t�C��H�~��$�����G��G�(�3�-�G�s�G�^b�G�gk�lo�qt�lt�gu�G�G�G�G�#� $�}O�}O�}O��}O��}O���#�-�.�	}O�
�}O��
}O���
�}O��}O��4��S��>�4��S��>�3�s�8�3�4�}O�}O�}O�}O�@��c�3�h���
��Wa�����,%��%��%�%�%�%�,:=�f�e�X�W^�`j�8k��t�C��#�t�)�!4�4�5�k�k�k�Z_�����!*��8;��RV��	�#�Y�����:u,��u,��u,�u�UY�Z]�U^�`c�dg�`h�Uh�Oi�u,�u,�u,�u,�p2��2��2�2�2�2������	�����rj