� h\�g����� �UddlZddlZddlmZddlmZddlmZmZmZm Z ddl m Z ddl 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+dd l,m-Z-m.Z.dd l/m0Z0m1Z1m2Z2m3Z3m4Z4m5Z5m6Z6m7Z7m8Z8m9Z9m:Z:m;Z;m<Z<dd l=m>Z>ddl?m@Z@mAZAddlBmCZCmDZDmEZEmFZFmGZGmHZHmIZImJZJmKZKmLZLmMZMmNZNmOZOmPZPmQZQmRZRmSZSmTZTmUZUddlVmWZWmXZXmYZYmZZZm[Z[m\Z\m]Z]m^Z^m_Z_ddl`maZambZbmcZcer ddldmeZeddlfmgZgdZhdZie(e&de&e fZje$ejZkdedde!e<deelefddfd�Zmddddeid�de#e(e&de&d fd!end"e!eld#e!eld$e!eld%eldeeleffd&�Zoddeifd'e(e&de&d fd!end$e!eld%eldeeleff d(�Zpd�de<d*ende%eelefenffd+�Zqddeidd,�de<d!end-eejelfd$e!eld%eld.e!ekde%eelefeelefe$elffd/�Zresete fZud0eud1fd2eud3fd4eld5ffZve%e%ele(ewe%ewd6ffelfd6fexd7<d8eud9fd:eud;fd<eud=fd>eud?fd@eudAffZye%e%ele(ewe%ewd6ffelfd6fexdB<de<deeleffdC�ZzdDekdeejelffdE�Z{d�d'e&dd.e!ekdekfdF�Z|de<d.ekdekfdG�Z}dHe#e<d.ekdekfdI�Z~de#e&ddekfdJ�Zd'ejdelfdK�Z�d)ddL�de<d!end-eejelfd%eld*end$e!eld.ekde%eelefeelefe$elffdM�Z�ddeidddN�d'ejd!end-eejelfd$e!eld%eld.e!ekde!e<de%eelefeelefe$elffdO�Z�ddP�d'e&dd!end-eejelfd%eld$e!eld.ekde%eelefeelefe$elffdQ�Z�ddR�dSe&e de!e<deeleffdT�Z�d)ddL�de<d!end-eejelfd%eld*end$e!eld.ekde%eelefeelefe$elffdU�Z�edVdWdX�fedVdYdX�fedVdZdX�fedVd[dX�fe d\d]dX�fedVd^dX�fedVd_dX�fedVd`dX�fedVdadX�fedVdbdX�fedVdcdX�fe"dVd4dX�feldddVife�dVdedX�fendddfifesdddgifetddd\ife ddd\ife+dVdhdX�fe�dddiife�djidk�fe�djidk�fe�djiddl�fe�djiddl�ffZ�e%e%eeeleffd6fexdm<dVdndX�Z�doedpeelefddfdq�Z�dreld$e!eld%eld*endeeleff ds�Z�d)ddL�de<d!end-eejelfd%eld*end$e!eld.ekde%eelefeelefe$elffdt�Z�due%ed6fde<de<fdv�Z�dwedefdx�Z�eseRetePe eOiZ�eeed6ewffexdy< d�dzed{e;d|eld}ende&ef d~�Z�dzed{e;de%e&ee$elffd�Z�dreldelfd��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}rX� modify_schema).N�field� field_schema�returnc��ddlm}||��}t|j�����}d|vsd|vr|||���dS||��dS)Nr)� signaturerZ�kwargs�rZ)�inspectr^�set� parameters�keys)rYrZr[r^�sig�argss �b/home/asafur/pinokio/api/open-webui.git/app/env/lib/python3.11/site-packages/pydantic/v1/schema.py�_apply_modify_schemarh`s���"�!�!�!�!�!� �)�M� "� "�C� �s�~�"�"�$�$� %� %�D��$���(�d�*�*�� �l�%�0�0�0�0�0�0�� �l�#�#�#�#�#�T)�by_alias�title� description� ref_prefix� ref_template�modelsrVrjrkrlrmrnc� �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�)rT)�.0�models rg� <listcomp>zschema.<locals>.<listcomp>�s ��9�9�9��I�e�$�$�9�9�9rirkrl�rj�model_name_maprmrn� definitions)�get_flat_models_from_models�get_model_name_map�model_process_schema�update)rorjrkrlrmrn� clean_models� flat_modelsrwrx� output_schemart�m_schema� m_definitions�m_nested_models� model_names rg�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�$� �rirtc��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`` rvFrx)rT�get_flat_models_from_modelrzr{�get_schema_refr|) rtrjrmrnr~rwr�r�r�� nested_modelss rg� 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� �OriF�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�_� rkTrl�default) � field_inforkrU�type_r �alias�replacerl�requiredr�rN� outer_type_�encode_default)rZr��schema_s rg�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�:�:�� ���� �$� $�$ri)rjrmrn� known_modelsrwr�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�rjrwr�rmrnr��$ref)r��get_field_schema_validationsr|�field_type_schemarb) rZrjrwrmrnr��sr��validation_schema�f_schema� f_definitions�f_nested_modelss rgr[r[�s���40��6�6��A��4�U�;�;��� � ���"�#�#�#���/@� ��%�)��!�!�*�S�U�U�0�0�0�,�H�m�_��������7�7� ��������-��0�0ri� 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__)rUr�r r��extrar|�str�bytesr��getattr� isinstance� numeric_types� issubclass�boolr�r�r�r�rh)rZr�� attr_name�t�keyword�attrrYs rgr�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�<�<�<� �Ori� 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|]\}}||�� Srrrr�rs�k�vs rg� <dictcomp>z&get_model_name_map.<locals>.<dictcomp>Zs�� 4� 4� 4�T�Q��A�q� 4� 4� 4ri)rb�normalize_name�__name__�get_long_model_name�add�pop�items)r��name_model_map�conflicting_namesrtr��conflicting_models rgrzrzBs����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�4ric� �|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�)rbr�r#rr3� __fields__�values�get_flat_models_from_fields)rtr�r~�fieldss rgr�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� �ric��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 rrW�__pydantic_model__Nr�) �pydantic.v1.mainrXrbr�rUr�r�� sub_fieldsr�r�r r�)rZr�rXr~� field_types rg�get_flat_models_from_fieldr�qs���+�*�*�*�*�*� #���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�� -� -�$���� �#�#�#� �rir�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�)rbr�)r�r�r~rZs rgr�r��s>��!$���K��T�T���1�%�l�S�S�S�S� � � �ric�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])``. )rbr�)ror~rts rgryry�s7�� !$���K��9�9���1�%�8�8�8� � � �ric�L�|j�d|j���dd��S)N�__�.)� __module__� __qualname__r��rts rgr�r��s,���� 6� 6�%�"4� 6� 6� >� >�s�D� I� I�Iri)r�rmc �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. rrW�rjrwrmrnr��array��typer�T� uniqueItemsr��objectr�N�patternProperties�additionalProperties��allOf)r��minItems�maxItemsr�r�r�) r�rXrb�shaper,r1r-r.r)r+r(�field_singleton_schemar|r'r#r3� key_fieldr�r�r=� _get_patternr0r*r�rr�r��append�lenr/r�rh)rZrjrwrnr�rmr�rXrxr�� items_schemar�r�r�r�r�� sub_schemar��sf� sf_schema�sf_definitions�sf_nested_models�sub_fields_len�all_of_schemasr�rYs rgr�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� @� @� @� �[�-� /�/ri)rjrmrnr�rZc���ddlm}m}|p t��}t |t ��rBt tt |��}t||���} | it��fSt td|��}d|j j p|j i} ||��} | 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^r`rXrkrlr�r�)rarr^rbrUr r#r �enum_process_schema� __config__rkr�r��model_type_schemar|� schema_extra�callabler�rc)rtrjrwrmrnr�rZrr^r��docr�r�r�rs rgr{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�]� *�*ri)rmc ��i}g}i}t��} |j���D]�\} } t| |||||���\} } }n6#t$r)}t j|jt��Yd}~�Nd}~wwxYw|� | ��| � |��|r,| || j <| j r|� | j ����| || <| j r|� | ����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�Nrkr�)r�� propertiesr��forbidFr�)rbr�r�r[� SkipField�warnings�warn�message� UserWarningr|r�r�r�rSrrkr�r�)rtrjrwrnrmr�r r�rxr�r��fr�r�r��skip� out_schemas rgrrYs����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<�<Br`�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�� Srr)�value)rs�items rgruz'enum_process_schema.<locals>.<listcomp>�s��C�C�C����C�C�Cri)rkrlrr�) rar��cleandoc�__doc__r#rr �add_field_type_to_schemar�rh)rrZrar�rYs rgrr�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�;�;�;� �Nric �6����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| | <��|r|jn|j| d �| d <g}|D]�}t ||�|��|���\}}}|�|��|rd |vr|d d}|���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�)rs� sub_modelrwrmrns ���rgr�z5field_singleton_sub_fields_schema.<locals>.<dictcomp>�sQ���F�F�F�&�'�y�1�>�*�9�5�z�<�QV�4�4�F�F�Frir�Fr�)� propertyName�mapping� discriminatorr��oneOf�anyOf)r#rr3r�rbr�r��discriminator_key�sub_fields_mappingr�r�r r�rrRrLr�rM�hasattrr�r��discriminator_aliasr|rdr�r�)rZrjrwrnr�rmr�r�rxr�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 `` ` rg�!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�>F� b�� 9� 9�5�Kb�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�'�'�'�:��+�}�,�,ri�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_schemaz json-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)rErUrr|)r�r�r��t_schemas rgrr$ss��1�����x� �j�%� 0� 0� �J�%�4R�4R�4R�4R�7�4R�4R�4R�4R�4R� �N�N�8� $� $� $� �E�E�5S��ri�namec�X�|rd||zi}nd|�|���i}|rd|gin|S)Nr�r�r�)r9)rHrmrnr�� schema_refs rgr�r�2sM���?��j�4�/�0� � ��l�1�1��1�=�=�>� �&6� F�G�j�\� "� "�J�Fric ��ddlm}i}t��} |j} |jr9|jr |jjst| |��st|||||||���S| tus/| tus&| j tkst| ��turi|| fSt| ��rddi|| fSt!| ��rt#d|j�d����i} |j�|jjr |j| d <t)| ��r�t+d �t-| ��D����} t/d �| D����d kr#t1t3| |��|||||� ��S| dj } 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. rrWr�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)rs�xs rg� <genexpr>z)field_singleton_schema.<locals>.<genexpr>hs7����e�e��*�Q��"5�"5�<�q�w�w�1�e�e�e�e�e�eric��h|] }|j�� Srr)� __class__�rsr�s rg� <setcomp>z)field_singleton_schema.<locals>.<setcomp>js��,�,�,��� �,�,�,rir�r�rr`)rjrwrmrnr�rZr r�)r�r�r�r�r�r�z.Value not declarable with JSON Schema, field: ).r�rXrbr�r�r�r�rUr6rr�rRr!rLr�rQrNrrHr�rO�tuplerJr�r[�#multitypes_literal_field_for_schema�listrr r�r|r�rrPr{r�r�r)r�rhr�r�rKr� __bases__� ValueError)rZrjrwrnr�rmr�rXrxr�r�r�r�� enum_namer�r�� items_schemasrYr�r4r5rJrfs rgr�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�Nrir�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)rs�same_type_valuess rgrPz6multitypes_literal_field_for_schema.<locals>.<genexpr>�s1����r�r�>N���'7�!8�!8�9�r�r�r�r�r�rri)rHr��class_validators� model_configr�r�r�r�)rrWrRr�r�r3rHr"rUr_r`r�r�r�r�)r�rZ�literal_distinct_typesr��distinct_literalss rgrVrV�s��� )��.�.�� �6�6���q�{�+�2�2�1�5�5�5�5�r�r�Rh�Ro�Ro�Rq�Rq�r�r�r�� � �Z��E�+�,�,�-��/��'�� ����k��#� � � � ri�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)NrrWzdict[str, Any]c�N�i|]"\}}t|��t|����#Srr�r�r�s rgr�z"encode_default.<locals>.<dictcomp>�s.��M�M�M���A��q�!�!�>�!�#4�#4�M�M�Mric3�4K�|]}t|��V��dSrNrfrSs rgrPz!encode_default.<locals>.<genexpr>�s*����3�3�!�N�1�%�%�3�3�3�3�3�3ri)r�rXr�rr#r4�dictr�r r�int�floatr�rWrUrRrP)rcrXr��seq_argss rgr�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���$�$�$ri�_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_constraintsrb�get_annotation_with_constraintsr�rY�join)rmr�rnro� constraints�used_constraints�unused_constraintss rg�get_annotation_from_field_inforx�s����,�,�.�.�K�!$�����_�'F�z�S]�'^�'^�$� �$��/����-�.�.�.�$�'7�7��� �� k�� k� k��y�y�+�,�,� k� k� k� � � � �ric�����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)rs�as rgrPz>get_annotation_with_constraints.<locals>.go.<locals>.<genexpr>s,����;�;��:�a��,�,�;�;�;�;�;�;rirc3�.�K�|]}�|��V��dSrNrr�rsr|�gos �rgrPz>get_annotation_with_constraints.<locals>.go.<locals>.<genexpr>!�+�����"7�"7�Q�2�2�a�5�5�"7�"7�"7�"7�"7�"7ri>� max_items� min_items� unique_items)r�r�r�r�r�)r�r�c3�.�K�|]}�|��V��dSrNrrr~s �rgrPz>get_annotation_with_constraints.<locals>.go.<locals>.<genexpr>:r�rir�)r�r��kwr\c�2��t�j�f|��SrN�r�r��r�r�s �rg�constraint_funczDget_annotation_with_constraints.<locals>.go.<locals>.constraint_funcEs��������"�=�=�=ri)r�r�r�c�2��t�j�f|��SrNr�r�s �rgr�zDget_annotation_with_constraints.<locals>.go.<locals>.constraint_funcL����#�E�N�U�H�b�A�A�Aric�2��t�j�f|��SrNr�r�s �rgr�zDget_annotation_with_constraints.<locals>.go.<locals>.constraint_funcUr�ri)r�r�r�r�r�)� allow_inf_nan)� max_digits�decimal_placesc3�<�K�|]}t�|���|V��dSrN)r�)rsr�r�s �rgrPz>get_annotation_with_constraints.<locals>.go.<locals>.<genexpr>ls3�����#U�#U�!� �5�RS�@T�@T�#U�A�#U�#U�#U�#U�#U�#Uric��i|] \}}|�||�� SrNrr)rsr�r�s rgr�z?get_annotation_with_constraints.<locals>.go.<locals>.<dictcomp>qs.�����#�I�t��#��4�#�#�#ric3�<�K�|]}|t�|��fV��dSrN)r�)rsr�r�s �rgrPz>get_annotation_with_constraints.<locals>.go.<locals>.<genexpr>ss3�����'k�'k�Xa��G�J� �4R�4R�(S�'k�'k�'k�'k�'k�'kri.rr)5rOr�rrUr;r<r9rLrK�anyr%rRr"rUr�rr�r�r�r|rGrrHrrErrrr�r?r>rr r�r6r5rArIr�r@rBr�r:r8r7r�rjr �nextrlrbr#r) r��originrfr��attrsr�� numeric_typer_r�rrvs ` ���rgrz+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�� ri)rbrr )rmr�rrvs `@@rgrsrssl�����"%����i�#�i�$�s�)�i�i�i�i�i�i�i�i�V �2�j�>�>�+� +�+ric�.�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 rgr�r�~s�� �6�%�s�D� 1� 1�1ric�"�eZdZdZdeddfd�ZdS)rz? Utility exception used to exclude fields from schema. rr\Nc��||_dSrN)r)�selfrs rg�__init__zSkipField.__init__�s ���� � � ri)r�r�r�rr�r�rrrirgrr�s@�����������������rirr rN)�r�r� collectionsr� dataclassesrrrrr�decimalr rr � ipaddressr r r rrr�pathlibr�typingrrrrrrrrrrrrrrr r!r"r#rDr$�typing_extensionsr%r&�pydantic.v1.fieldsr'r(r)r*r+r,r-r.r/r0r1r2r3�pydantic.v1.jsonr4�pydantic.v1.networksr5r6�pydantic.v1.typesr7r8r9r:r;r<r=r>r?r@rArBrCrDrErFrGrHrI�pydantic.v1.typingrJrKrLrMrNrOrPrQrR�pydantic.v1.utilsrSrTrU�pydantic.v1.dataclassesrVr�rX�default_prefix�default_ref_template�TypeModelOrEnum� TypeModelSetr�rhr�r�r�r�r[rirjr�r�r��__annotations__r�r�rzr�r�r�ryr�r�r{rrr6r�rhrWrUrb� frozensetrE� json_schemerr�r�rVr�rlrxrsr�� Exceptionrrrrirg�<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�������������������������������.�-�-�-�-�-�1�1�1�1�1�1�1�1�������������������������������������������* � � � � � � � � � � � � � � � � � � � � � �F�E�E�E�E�E�E�E�E�E��+�1�1�1�1�1�1�*�*�*�*�*�*�!��.����[�)�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�%�%�%�%�2� $�,�+/�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������ �����ri
Memory