� g\�g������UdZddlmZddlZddlZddlmZddlm Z ddl m Z ddl m Z mZmZmZmZmZddlmZmZmZdd lmZmZmZmZmZdd lmZdd lmZ dd l!m"Z"m#Z#m$Z$dd l%m&Z&ddl'm(Z(m)Z)ddl*m+Z+ddl,m-Z-ddl.m/Z/ddl0m1Z1er ddl2a2dZ3de4d<nda2gd�Z5ej6Gd�d����Z7Gd�d��Z8Gd�d��Z9e dad"���Z:Gd#�d$e8��Z;Gd%�d&e;��Z<Gd'�d(e;��Z=Gd)�d*e;��Z>Gd+�d,e;��Z?Gd-�d.e;��Z@Gd/�d0e;��ZAGd1�d2e9��ZBGd3�d4e;��ZCGd5�d6e;��ZDGd7�d8e;��ZEGd9�d:e9��ZFGd;�d<e;��ZGGd=�d>e9��ZHGd?�d@e;��ZIGdA�dBe;��ZJGdC�dDe;��ZKGdE�dFe;��ZLdbdH�ZMer e"eNdIfZOn GdJ�dK��ZOGdL�dMe(jP��ZQdNZRde4dO<dPZSde4dQ<dRZTde4dS<ereRZUeSZVeTZWn'GdT�dU��ZUGdV�dW��ZVGdX�dY��ZWdcd[�ZXeX��ZYd\ZZ ddd`�Z[e+e\��Z]dS)ezEThe networks module contains types for common network-related fields.�)� annotationsN��fields)� lru_cache)�version)� IPv4Address� IPv4Interface� IPv4Network� IPv6Address� IPv6Interface� IPv6Network)� TYPE_CHECKING�Any�ClassVar)� MultiHostHost�PydanticCustomError�$PydanticSerializationUnexpectedValue�SchemaSerializer� core_schema)� MultiHostUrl)�Url)� Annotated�Self� TypeAlias)�PydanticUserError�)�_repr�_schema_generation_shared)�getattr_migration)�GetCoreSchemaHandler)�JsonSchemaValue�� TypeAdapterz7str | bytes | int | tuple[str | bytes | int, str | int]r� NetworkType)�AnyUrl� AnyHttpUrl�FileUrl�FtpUrl�HttpUrl� WebsocketUrl�AnyWebsocketUrl�UrlConstraints�EmailStr� NameEmail� IPvAnyAddress�IPvAnyInterface� IPvAnyNetwork� PostgresDsn� CockroachDsn�AmqpDsn�RedisDsn�MongoDsn�KafkaDsn�NatsDsn�validate_email�MySQLDsn� MariaDBDsn� ClickHouseDsn� SnowflakeDsnc��eZdZUdZdZded<dZded<dZded<dZd ed <dZ ded <dZ d ed <dd�Z e dd���Z dd�ZdS)r,a�Url constraints. Attributes: max_length: The maximum length of the url. Defaults to `None`. allowed_schemes: The allowed schemes. Defaults to `None`. host_required: Whether the host is required. Defaults to `None`. default_host: The default host. Defaults to `None`. default_port: The default port. Defaults to `None`. default_path: The default path. Defaults to `None`. N� int | None� max_lengthzlist[str] | None�allowed_schemesz bool | None� host_required� str | None� default_host� default_port� default_path�return�intc��t|j|j�t|j��nd|j|j|j|jf��S�N)�hashr@rA�tuplerBrDrErF��selfs �a/home/asafur/pinokio/api/open-webui.git/app/env/lib/python3.11/site-packages/pydantic/networks.py�__hash__zUrlConstraints.__hash__ZsR�����/3�/C�/O��d�*�+�+�+�UY��"��!��!��!�  �  �  � ��dict[str, Any]c�>�����fd�t���D��S)zeFetch a key / value mapping of constraints to values that are not None. Used for core schema updates.c�N��i|]!}t�|j��x��|j���"SrJ)�getattr�name)�.0�fieldrN�values ��rO� <dictcomp>z6UrlConstraints.defined_constraints.<locals>.<dictcomp>is6���p�p�p�e��QU�W\�Wa�Ib�Ib�@b��?o�� �E�?o�?o�?orQr)rNrYs`@rO�defined_constraintsz"UrlConstraints.defined_constraintsfs*����q�p�p�p�p�v�d�|�|�p�p�p�prQ�sourcer�handlerr �core_schema.CoreSchemac���||��}|ddkr|dn|}|ddvx}rtd|�d�d����|j���D] \}}|||<� |S) N�type� function-wrap�schema)�urlzmulti-host-urlz"'UrlConstraints' cannot annotate 'z'.zinvalid-annotated-type)�code)rr[�items)rNr\r]rb�schema_to_mutate�annotated_type�constraint_key�constraint_values rO�__get_pydantic_core_schema__z+UrlConstraints.__get_pydantic_core_schema__ks��������� 06�f�~��/P�/P�6�(�+�+�V\��-�f�5�=V�V� V�>� �#�G�^�G�G�G�Nf���� �15�0H�0N�0N�0P�0P� @� @� ,�N�,�/?� �^� ,� ,�� rQ�rGrH)rGrR)r\rr]r rGr^)�__name__� __module__� __qualname__�__doc__r@�__annotations__rArBrDrErFrP�propertyr[rj�rQrOr,r,Fs�������� � �"�J�!�!�!�!�(,�O�,�,�,�,�!%�M�%�%�%�%�#�L�#�#�#�#�#�L�#�#�#�#�#�L�#�#�#�#�  �  �  �  ��q�q�q��X�q� � � � � � rQr,c�&�eZdZUe��Zded<ded<dDd �ZedEd ���ZedFd ���Z edFd���Z edFd���Z dFd�Z edGd���Z edFd���ZedFd���ZdHd�ZedFd���ZdEd�ZdEd�ZdEd�ZdId�ZdJd"�ZdJd#�ZdJd$�ZdJd%�ZdJd&�ZdKd(�ZdKd)�Zed*d*d*d*d*d*d+�dLd4���ZedMd8���ZedNd>���Z edOdB���Z!e"e#j$e#j%���C����Z&d*S)P�_BaseUrl�ClassVar[UrlConstraints]� _constraints�_CoreUrl�_urlrc�str | _CoreUrl | _BaseUrlrG�Nonec�h�t|j���|��j|_dSrJ��_build_type_adapter� __class__�validate_pythonrx�rNrcs rO�__init__z_BaseUrl.__init__�(��'���7�7�G�G��L�L�Q�� � � rQ�strc��|jjS)zoThe scheme part of the URL. e.g. `https` in `https://user:pass@host:port/path?query#fragment` �rx�schemerMs rOr�z_BaseUrl.scheme���� �y��rQrCc��|jjS)z{The username part of the URL, or `None`. e.g. `user` in `https://user:pass@host:port/path?query#fragment` )rx�usernamerMs rOr�z_BaseUrl.username���� �y�!�!rQc��|jjS)z{The password part of the URL, or `None`. e.g. `pass` in `https://user:pass@host:port/path?query#fragment` )rx�passwordrMs rOr�z_BaseUrl.password�r�rQc��|jjS)u�The host part of the URL, or `None`. If the URL must be punycode encoded, this is the encoded host, e.g if the input URL is `https://£££.com`, `host` will be `xn--9aaa.com` �rx�hostrMs rOr�z _BaseUrl.host�s���y�~�rQc�4�|j���S)u/The host part of the URL as a unicode string, or `None`. e.g. `host` in `https://user:pass@host:port/path?query#fragment` If the URL must be punycode encoded, this is the decoded host, e.g if the input URL is `https://£££.com`, `unicode_host()` will be `£££.com` )rx� unicode_hostrMs rOr�z_BaseUrl.unicode_host�s���y�%�%�'�'�'rQr?c��|jjS)zwThe port part of the URL, or `None`. e.g. `port` in `https://user:pass@host:port/path?query#fragment` )rx�portrMs rOr�z _BaseUrl.port���� �y�~�rQc��|jjS)zxThe path part of the URL, or `None`. e.g. `/path` in `https://user:pass@host:port/path?query#fragment` �rx�pathrMs rOr�z _BaseUrl.path�r�rQc��|jjS)zyThe query part of the URL, or `None`. e.g. `query` in `https://user:pass@host:port/path?query#fragment` �rx�queryrMs rOr�z_BaseUrl.query���� �y��rQ�list[tuple[str, str]]c�4�|j���S)z�The query part of the URL as a list of key-value pairs. e.g. `[('foo', 'bar')]` in `https://user:pass@host:port/path?foo=bar#fragment` �rx� query_paramsrMs rOr�z_BaseUrl.query_params���� �y�%�%�'�'�'rQc��|jjS)zThe fragment part of the URL, or `None`. e.g. `fragment` in `https://user:pass@host:port/path?query#fragment` �rx�fragmentrMs rOr�z_BaseUrl.fragment�r�rQc�4�|j���S)uThe URL as a unicode string, unlike `__str__()` this will not punycode encode the host. If the URL must be punycode encoded, this is the decoded string, e.g if the input URL is `https://£££.com`, `unicode_string()` will be `https://£££.com` �rx�unicode_stringrMs rOr�z_BaseUrl.unicode_string�s�� �y�'�'�)�)�)rQc�*�t|j��S�zDThe URL as a string, this will punycode encode the host if required.�r�rxrMs rO�__str__z_BaseUrl.__str__�����4�9�~�~�rQc�J�|jj�dt|j���d�S�N�(�)�r~rlr�rxrMs rO�__repr__z_BaseUrl.__repr__��&���.�)�?�?�C�� �N�N�?�?�?�?rQ�memo�dictrc�6�|�|j��SrJ�r~rx�rNr�s rO� __deepcopy__z_BaseUrl.__deepcopy__�����~�~�d�i�(�(�(rQ�otherr�boolc�>�|j|juo|j|jkSrJr��rNr�s rO�__eq__z_BaseUrl.__eq__�����~���0�L�T�Y�%�*�5L�LrQc�>�|j|juo|j|jkSrJr�r�s rO�__lt__z_BaseUrl.__lt__�����~���0�K�T�Y���5K�KrQc�>�|j|juo|j|jkSrJr�r�s rO�__gt__z_BaseUrl.__gt__�r�rQc�>�|j|juo|j|jkSrJr�r�s rO�__le__z_BaseUrl.__le__�r�rQc�>�|j|juo|j|jkSrJr�r�s rO�__ge__z_BaseUrl.__ge__�r�rQrHc�*�t|j��SrJ�rKrxrMs rOrPz_BaseUrl.__hash__�����D�I���rQc�D�tt|j����SrJ��lenr�rxrMs rO�__len__z_BaseUrl.__len__�����3�t�y�>�>�"�"�"rQN)r�r�r�r�r�r�r�r�r�r�r�r�r�r�c �L�|tj||||||||�����S)a�Build a new `Url` instance from its component parts. Args: scheme: The scheme part of the URL. username: The username part of the URL, or omit for no username. password: The password part of the URL, or omit for no password. host: The host part of the URL. port: The port part of the URL, or omit for no port. path: The path part of the URL, or omit for no path. query: The query part of the URL, or omit for no query. fragment: The fragment part of the URL, or omit for no fragment. Returns: An instance of URL )r�r�r�r�r�r�r�r�)rw�build) �clsr�r�r�r�r�r�r�r�s rOr�z_BaseUrl.build�sD��8�s� �N��!�!�����!� � � �  �  � rQ�info�core_schema.SerializationInfo� str | Selfc ��t||��s&td|�dt|���d|�d����|jdkrt |��S|S�Nz Expected `z ` but got `z` with value `'z-'` - serialized value may not be as expected.�json�� isinstancerr`�moder��r�rcr�s rO� serialize_urlz_BaseUrl.serialize_url$�i���#�s�#�#� �6�y�S�y�y�T�#�Y�Y�y�y�s�y�y�y��� � �9�� � ��s�8�8�O�� rQr\�type[_BaseUrl]r]r r^c ����fd�}tj|tjdi|jj��tj|jdd������S)Nc����t|���r|St|t��rt|��}||��}�����}||_|SrJ)r�rtr��__new__rx��v�h�core_url�instancer\s �rO�wrap_valz7_BaseUrl.__get_pydantic_core_schema__.<locals>.wrap_val2sa����!�V�$�$� ����!�X�&�&� ���F�F���q��t�t�H��~�~�f�-�-�H�$�H�M��OrQT�always��info_arg� when_used�rb� serializationrr)r�no_info_wrap_validator_function� url_schemarvr[�$plain_serializer_function_ser_schemar��r�r\r]r�s ` rOrjz%_BaseUrl.__get_pydantic_core_schema__.st��� � � � � ��:� ��)�Q�Q�C�,<�,P�Q�Q�%�J��!�D�H���� � � � rQr�._schema_generation_shared.GetJsonSchemaHandlerr!c�D�|ddkr|dn|}||��S�Nr`rarbrr�r�rr]� inner_schemas rO�__get_pydantic_json_schema__z%_BaseUrl.__get_pydantic_json_schema__D�3�� 1<�F�0C��0V�0V�{�8�,�,�\g� ��w�|�$�$�$rQ�r�)rcryrGrz�rGr��rGrC)rGr?�rGr��r�r�rGr�r�rrGr�rk)r�r�r�rCr�rCr�r�r�r?r�rCr�rCr�rCrGr�rcrr�r�rGr�)r\r�r]r rGr^�rr^r]r�rGr!)'rlrmrnr,rvrpr�rqr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rPr�� classmethodr�r�rjr�rr� any_schema�to_string_ser_schema�__pydantic_serializer__rrrQrOrtrt{s8�������-;�^�-=�-=�L�=�=�=�=��N�N�N�R�R�R�R�� � � ��X� ��"�"�"��X�"��"�"�"��X�"������X��(�(�(�(������X�������X�������X��(�(�(�(��"�"�"��X�"�*�*�*�*�����@�@�@�@�)�)�)�)�M�M�M�M�L�L�L�L�L�L�L�L�M�M�M�M�M�M�M�M�����#�#�#�#�� $�#��� �#�& �& �& �& �& ��[�& �P�����[��� � � ��[� �*�%�%�%��[�%�/�.�/E�{�/E�Tt�T_�Tt�Tv�Tv�/w�/w�/w�x�x���rQrtc ��eZdZUe��Zded<ded<d?d �Zed@d ���ZedAd ���Z edAd���Z dBd�Z edAd���Z dCd�Z d@d�Zd@d�Zd@d�ZdDd�ZdEd�ZdFd �ZdFd!�Zed"d"d"d"d"d"d"d"d#�dGd/���ZedHd3���ZedId9���ZedJd=���Zeejej���>����Zd"S)K�_BaseMultiHostUrlrurv�_CoreMultiHostUrlrxrc�+str | _CoreMultiHostUrl | _BaseMultiHostUrlrGrzc�h�t|j���|��j|_dSrJr|r�s rOr�z_BaseMultiHostUrl.__init__Tr�rQr�c��|jjS)zkThe scheme part of the URL. e.g. `https` in `https://foo.com,bar.com/path?query#fragment` r�rMs rOr�z_BaseMultiHostUrl.schemeWr�rQrCc��|jjS)ztThe path part of the URL, or `None`. e.g. `/path` in `https://foo.com,bar.com/path?query#fragment` r�rMs rOr�z_BaseMultiHostUrl.path_r�rQc��|jjS)zuThe query part of the URL, or `None`. e.g. `query` in `https://foo.com,bar.com/path?query#fragment` r�rMs rOr�z_BaseMultiHostUrl.querygr�rQr�c�4�|j���S)z�The query part of the URL as a list of key-value pairs. e.g. `[('foo', 'bar')]` in `https://foo.com,bar.com/path?query#fragment` r�rMs rOr�z_BaseMultiHostUrl.query_paramsor�rQc��|jjS)z{The fragment part of the URL, or `None`. e.g. `fragment` in `https://foo.com,bar.com/path?query#fragment` r�rMs rOr�z_BaseMultiHostUrl.fragmentvr�rQ�list[MultiHostHost]c�4�|j���S)a%The hosts of the `MultiHostUrl` as [`MultiHostHost`][pydantic_core.MultiHostHost] typed dicts. ```python from pydantic_core import MultiHostUrl mhu = MultiHostUrl('https://foo.com:123,foo:bar@bar.com/path') print(mhu.hosts()) """ [ {'username': None, 'password': None, 'host': 'foo.com', 'port': 123}, {'username': 'foo', 'password': 'bar', 'host': 'bar.com', 'port': 443} ] ``` Returns: A list of dicts, each representing a host. )rx�hostsrMs rOrz_BaseMultiHostUrl.hosts~s��"�y��� � � rQc�4�|j���S)zXThe URL as a unicode string, unlike `__str__()` this will not punycode encode the hosts.r�rMs rOr�z _BaseMultiHostUrl.unicode_string�s���y�'�'�)�)�)rQc�*�t|j��Sr�r�rMs rOr�z_BaseMultiHostUrl.__str__�r�rQc�J�|jj�dt|j���d�Sr�r�rMs rOr�z_BaseMultiHostUrl.__repr__�r�rQr�r�rc�6�|�|j��SrJr�r�s rOr�z_BaseMultiHostUrl.__deepcopy__�r�rQr�rr�c�>�|j|juo|j|jkSrJr�r�s rOr�z_BaseMultiHostUrl.__eq__�r�rQrHc�*�t|j��SrJr�rMs rOrPz_BaseMultiHostUrl.__hash__�r�rQc�D�tt|j����SrJr�rMs rOr�z_BaseMultiHostUrl.__len__�r�rQN)rr�r�r�r�r�r�r�r�r�list[MultiHostHost] | Noner�r�r�r�r?r�r�r�c �N�|tj||||||||| �� � ��S)aBuild a new `MultiHostUrl` instance from its component parts. This method takes either `hosts` - a list of `MultiHostHost` typed dicts, or the individual components `username`, `password`, `host` and `port`. Args: scheme: The scheme part of the URL. hosts: Multiple hosts to build the URL from. username: The username part of the URL. password: The password part of the URL. host: The host part of the URL. port: The port part of the URL. path: The path part of the URL. query: The query part of the URL, or omit for no query. fragment: The fragment part of the URL, or omit for no fragment. Returns: An instance of `MultiHostUrl` ) r�rr�r�r�r�r�r�r�)r r�) r�r�rr�r�r�r�r�r�r�s rOr�z_BaseMultiHostUrl.build�sI��B�s� � #���!�!�����!� � � �  �  � rQr�r�r�c ��t||��s&td|�dt|���d|�d����|jdkrt |��S|Sr�r�r�s rOr�z_BaseMultiHostUrl.serialize_url�r�rQr\�type[_BaseMultiHostUrl]r]r r^c ����fd�}tj|tjdi|jj��tj|jdd������S)Nc����t|���r|St|t��rt|��}||��}�����}||_|SrJ)r�rr�r�rxr�s �rOr�z@_BaseMultiHostUrl.__get_pydantic_core_schema__.<locals>.wrap_val�sb����!�V�$�$� ����!�.�/�/� ���F�F���q��t�t�H��~�~�f�-�-�H�$�H�M��OrQTr�r�r�rr)rr��multi_host_url_schemarvr[r�r�r�s ` rOrjz._BaseMultiHostUrl.__get_pydantic_core_schema__�st��� � � � � ��:� ��4�\�\�s�7G�7[�\�\�%�J��!�D�H���� � � � rQrr�r!c�D�|ddkr|dn|}||��Sr�rrr�s rOr�z._BaseMultiHostUrl.__get_pydantic_json_schema__�r�rQr�)rcr rGrzr�r�r�)rGrr�rrk)r�r�rrr�rCr�rCr�rCr�r?r�rCr�rCr�rCrGrr)r\rr]r rGr^r)rlrmrnr,rvrpr�rqr�r�r�r�r�rr�r�r�r�r�rPr�rr�r�rjr�rrrrrrrrQrOrrPsa�������-;�^�-=�-=�L�=�=�=�=�����R�R�R�R�� � � ��X� ������X�������X��(�(�(�(��"�"�"��X�"�!�!�!�!�&*�*�*�*�����@�@�@�@�)�)�)�)�M�M�M�M�����#�#�#�#�� -1�#�#���� �#�, �, �, �, �, ��[�, �\�����[��� � � ��[� �*�%�%�%��[�%�/�.�/E�{�/E�Tt�T_�Tt�Tv�Tv�/w�/w�/w�x�x���rQrr��"type[_BaseUrl | _BaseMultiHostUrl]rGr#c� �t|��SrJr")r�s rOr}r}s�� �s� � �rQc��eZdZdZdS)r%a�Base type for all URLs. * Any scheme allowed * Top-level domain (TLD) not required * Host not required Assuming an input URL of `http://samuel:pass@example.com:8000/the/path/?query=here#fragment=is;this=bit`, the types export the following properties: - `scheme`: the URL scheme (`http`), always set. - `host`: the URL host (`example.com`). - `username`: optional username if included (`samuel`). - `password`: optional password if included (`pass`). - `port`: optional port (`8000`). - `path`: optional path (`/the/path/`). - `query`: optional URL query (for example, `GET` arguments or "search string", such as `query=here`). - `fragment`: optional fragment (`fragment=is;this=bit`). N)rlrmrnrorrrQrOr%r%s���������rQr%c�.�eZdZdZeddg���ZdS)r&zcA type that will accept any http or https URL. * TLD not required * Host not required �http�https�rAN�rlrmrnror,rvrrrQrOr&r&!s1�������� "�>�6�7�2C�D�D�D�L�L�LrQr&c�0�eZdZdZedddg���ZdS)r)u� A type that will accept any http or https URL. * TLD not required * Host not required * Max length 2083 ```python from pydantic import BaseModel, HttpUrl, ValidationError class MyModel(BaseModel): url: HttpUrl m = MyModel(url='http://www.example.com') # (1)! print(m.url) #> http://www.example.com/ try: MyModel(url='ftp://invalid.url') except ValidationError as e: print(e) ''' 1 validation error for MyModel url URL scheme should be 'http' or 'https' [type=url_scheme, input_value='ftp://invalid.url', input_type=str] ''' try: MyModel(url='not a url') except ValidationError as e: print(e) ''' 1 validation error for MyModel url Input should be a valid URL, relative URL without a base [type=url_parsing, input_value='not a url', input_type=str] ''' ``` 1. Note: mypy would prefer `m = MyModel(url=HttpUrl('http://www.example.com'))`, but Pydantic will convert the string to an HttpUrl instance anyway. "International domains" (e.g. a URL where the host or TLD includes non-ascii characters) will be encoded via [punycode](https://en.wikipedia.org/wiki/Punycode) (see [this article](https://www.xudongz.com/blog/2017/idn-phishing/) for a good description of why this is important): ```python from pydantic import BaseModel, HttpUrl class MyModel(BaseModel): url: HttpUrl m1 = MyModel(url='http://puny£code.com') print(m1.url) #> http://xn--punycode-eja.com/ m2 = MyModel(url='https://www.аррӏе.com/') print(m2.url) #> https://www.xn--80ak6aa92e.com/ m3 = MyModel(url='https://www.example.珠宝/') print(m3.url) #> https://www.example.xn--pbt977c/ ``` !!! warning "Underscores in Hostnames" In Pydantic, underscores are allowed in all parts of a domain except the TLD. Technically this might be wrong - in theory the hostname cannot have underscores, but subdomains can. To explain this; consider the following two cases: - `exam_ple.co.uk`: the hostname is `exam_ple`, which should not be allowed since it contains an underscore. - `foo_bar.example.com` the hostname is `example`, which should be allowed since the underscore is in the subdomain. Without having an exhaustive list of TLDs, it would be impossible to differentiate between these two. Therefore underscores are allowed, but you can always do further validation in a validator if desired. Also, Chrome, Firefox, and Safari all currently accept `http://exam_ple.com` as a URL, so we're in good (or at least big) company. �#r'r(�r@rANr*rrrQrOr)r)+s6������K�K�Z"�>�T�F�G�CT�U�U�U�L�L�LrQr)c�.�eZdZdZeddg���ZdS)r+z_A type that will accept any ws or wss URL. * TLD not required * Host not required �ws�wssr)Nr*rrrQrOr+r+|s0�������� "�>�4��-�@�@�@�L�L�LrQr+c�0�eZdZdZedddg���ZdS)r*zuA type that will accept any ws or wss URL. * TLD not required * Host not required * Max length 2083 r,r/r0r-Nr*rrrQrOr*r*�s2��������"�>�T�D�%�=�Q�Q�Q�L�L�LrQr*c�,�eZdZdZedg���ZdS)r'zCA type that will accept any file URL. * Host not required �filer)Nr*rrrQrOr'r'�s.�������� "�>�6�(�;�;�;�L�L�LrQr'c�,�eZdZdZedg���ZdS)r(zUA type that will accept ftp URL. * TLD not required * Host not required �ftpr)Nr*rrrQrOr(r(�s.�������� "�>�5�'�:�:�:�L�L�LrQr(c�H�eZdZdZedgd����Zed d���ZdS) r2a:A type that will accept any Postgres DSN. * User info required * TLD not required * Host required * Supports multiple hosts If further validation is required, these properties can be used by validators to enforce specific behaviour: ```python from pydantic import ( BaseModel, HttpUrl, PostgresDsn, ValidationError, field_validator, ) class MyModel(BaseModel): url: HttpUrl m = MyModel(url='http://www.example.com') # the repr() method for a url will display all properties of the url print(repr(m.url)) #> HttpUrl('http://www.example.com/') print(m.url.scheme) #> http print(m.url.host) #> www.example.com print(m.url.port) #> 80 class MyDatabaseModel(BaseModel): db: PostgresDsn @field_validator('db') def check_db_name(cls, v): assert v.path and len(v.path) > 1, 'database must be provided' return v m = MyDatabaseModel(db='postgres://user:pass@localhost:5432/foobar') print(m.db) #> postgres://user:pass@localhost:5432/foobar try: MyDatabaseModel(db='postgres://user:pass@localhost:5432') except ValidationError as e: print(e) ''' 1 validation error for MyDatabaseModel db Assertion failed, database must be provided assert (None) + where None = PostgresDsn('postgres://user:pass@localhost:5432').path [type=assertion_error, input_value='postgres://user:pass@localhost:5432', input_type=str] ''' ``` T) �postgres� postgresqlzpostgresql+asyncpgzpostgresql+pg8000zpostgresql+psycopgzpostgresql+psycopg2zpostgresql+psycopg2cffizpostgresql+py-postgresqlzpostgresql+pygresql�rBrArGr�c��|jjS�zThe required URL host.r�rMs rOr�zPostgresDsn.host�����y�~�rQNr��rlrmrnror,rvrqr�rrrQrOr2r2�si������9�9�v"�>��  �  �  � � � �L������X���rQr2c�H�eZdZdZedgd����Zed d���ZdS) r3ztA type that will accept any Cockroach DSN. * User info required * TLD not required * Host required T)� cockroachdbzcockroachdb+psycopg2zcockroachdb+asyncpgr9rGr�c��|jjSr;r�rMs rOr�zCockroachDsn.hostr<rQNr�r=rrrQrOr3r3�sh��������"�>�� � � ����L������X���rQr3c�.�eZdZdZeddg���ZdS)r4zsA type that will accept any AMQP DSN. * User info required * TLD not required * Host not required �amqp�amqpsr)Nr*rrrQrOr4r4 s1��������"�>�6�7�2C�D�D�D�L�L�LrQr4c�N�eZdZdZeddgdddd���Zed d ���Zd S)r5z�A type that will accept any Redis DSN. * User info required * TLD not required * Host required (e.g., `rediss://:pass@localhost`) �redis�rediss� localhosti�z/0T)rArDrErFrBrGr�c��|jjSr;r�rMs rOr�z RedisDsn.host'r<rQNr�r=rrrQrOr5r5sj��������"�>� �(�+� ���� ���L������X���rQr5c�0�eZdZdZeddgd���ZdS)r6z�A type that will accept any MongoDB DSN. * User info not required * Database name not required * Port not required * User info may be passed without user part (e.g., `mongodb://mongodb0.example.com:27017`). �mongodbz mongodb+srvi�i�rArENr*rrrQrOr6r6-s4��������"�>�9�m�2L�[`�a�a�a�L�L�LrQr6c�0�eZdZdZedgdd���ZdS)r7ztA type that will accept any Kafka DSN. * User info required * TLD not required * Host not required �kafkarGi�#�rArDrENr*rrrQrOr7r79s3��������"�>�7�)�+�dh�i�i�i�L�L�LrQr7c�2�eZdZdZegd�dd���ZdS)r8aLA type that will accept any NATS DSN. NATS is a connective technology built for the ever increasingly hyper-connected world. It is a single technology that enables applications to securely communicate across any combination of cloud vendors, on-premise, edge, web and mobile, and devices. More: https://nats.io )�nats�tlsr/r0rGi~rNNr*rrrQrOr8r8Ds>��������"�>�4�4�4�;�]a����L�L�LrQr8c�2�eZdZdZegd�dd���ZdS)r:ztA type that will accept any MySQL DSN. * User info required * TLD not required * Host not required )�mysqlzmysql+mysqlconnectorzmysql+aiomysqlz mysql+asyncmyz mysql+mysqldbz mysql+pymysqlz mysql+cymysqlz mysql+pyodbc�� T)rArErBNr*rrrQrOr:r:RsG��������"�>�  �  �  ��� � � �L�L�LrQr:c�0�eZdZdZegd�d���ZdS)r;zvA type that will accept any MariaDB DSN. * User info required * TLD not required * Host not required )�mariadbzmariadb+mariadbconnectorzmariadb+pymysqlrTrKNr*rrrQrOr;r;js<��������"�>�R�R�R�����L�L�LrQr;c�2�eZdZdZeddgdd���ZdS)r<zyA type that will accept any ClickHouse DSN. * User info required * TLD not required * Host not required zclickhouse+nativezclickhouse+asynchrGi(#rNNr*rrrQrOr<r<xs?��������"�>�,�.A�B� �����L�L�LrQr<c�F�eZdZdZedgd���Zed d���ZdS) r=ztA type that will accept any Snowflake DSN. * User info required * TLD not required * Host required � snowflakeT)rArBrGr�c��|jjSr;r�rMs rOr�zSnowflakeDsn.host�r<rQNr�r=rrrQrOr=r=�s^��������"�>�$� �����L� �����X���rQr=rzc��� ddlan"#t$r}td��|�d}~wwxYwtd���d��ddkstd���dS)NrzCemail-validator is not installed, run `pip install pydantic[email]`zemail-validator�.�2zKemail-validator version >= 2.0 required, run pip install -U email-validator)�email_validator� ImportErrorr� partition)�es rO�import_email_validatorrb�s���h������� �h�h�h��_�`�`�fg�g�����h���� �$� %� %� /� /�� 4� 4�Q� 7�3� >� >��g�h�h�h� ?� >s�� &�!�&.c�Z�eZdZdZedd���Zedd ���Zedd���ZdS)r-a Info: To use this type, you need to install the optional [`email-validator`](https://github.com/JoshData/python-email-validator) package: ```bash pip install email-validator ``` Validate email addresses. ```python from pydantic import BaseModel, EmailStr class Model(BaseModel): email: EmailStr print(Model(email='contact@mail.com')) #> email='contact@mail.com' ``` �_source� type[Any]�_handlerr rGr^c�t�t��tj|jtj����SrJ)rbr� no_info_after_validator_function� _validate� str_schema�r�rdrfs rOrjz%EmailStr.__get_pydantic_core_schema__�s.�� #� $� $� $��?�� �{�Oe�Og�Og�h�h� hrQrr]r�r!c�J�||��}|�dd���|S)N�string�email�r`�format��update�r�rr]� field_schemas rOr�z%EmailStr.__get_pydantic_json_schema__�s2��#�7�;�/�/�L� � � �X�g� � >� >� >�� rQ� input_valuer�c�,�t|��dS)Nr)r9�r�rus rOrizEmailStr._validate�s��!�+�.�.�q�1� 1rQN�rdrerfr rGr^r)rur�rGr�)rlrmrnrorrjr�rirrrQrOr-r-�s������� � �, � i� i� i� �� i� � � � � �� � � 2� 2� 2� �� 2� 2� 2rQr-c�v�eZdZdZdZdd�Zdd �Zedd���Zed d���Z ed!d���Z d"d�Z dS)#r.a� Info: To use this type, you need to install the optional [`email-validator`](https://github.com/JoshData/python-email-validator) package: ```bash pip install email-validator ``` Validate a name and email address combination, as specified by [RFC 5322](https://datatracker.ietf.org/doc/html/rfc5322#section-3.4). The `NameEmail` has two properties: `name` and `email`. In case the `name` is not provided, it's inferred from the email address. ```python from pydantic import BaseModel, NameEmail class User(BaseModel): email: NameEmail user = User(email='Fred Bloggs <fred.bloggs@example.com>') print(user.email) #> Fred Bloggs <fred.bloggs@example.com> print(user.email.name) #> Fred Bloggs user = User(email='fred.bloggs@example.com') print(user.email) #> fred.bloggs <fred.bloggs@example.com> print(user.email.name) #> fred.bloggs ``` �rVrnrVr�rnc�"�||_||_dSrJrz)rNrVrns rOr�zNameEmail.__init__�s���� ��� � � rQr�rrGr�c�h�t|t��o|j|jf|j|jfkSrJ)r�r.rVrnr�s rOr�zNameEmail.__eq__�s0���%��+�+�d���D�J�0G�E�J�X]�Xc�Kd�0d�drQrr^r]r�r!c�J�||��}|�dd���|S)Nrmz name-emailrorqrss rOr�z&NameEmail.__get_pydantic_json_schema__s2���w�{�+�+� �����,��?�?�?��rQrdrerfr c �4�t��tj|jtjtj��tjtj|��tj��gdd���tj�������S)N�name_email_typezInput is not a valid NameEmail)�custom_error_type�custom_error_message)� json_schema� python_schemar�) rbrrhri�json_or_python_schemarj� union_schema�is_instance_schemarrks rOrjz&NameEmail.__get_pydantic_core_schema__ s��� � � � ��;� �M� � -�'�2�4�4�)�6� �3�C�8�8�+�:P�:R�:R�S�&7�)I���� *�>�@�@� � � �  �  � rQru� Self | strrc�l�t|t��rt|��\}}|||��S|SrJ)r�r�r9)r�rurVrns rOrizNameEmail._validates=�� �k�3� '� '� �(��5�5�K�D�%��3�t�U�#�#� #�� rQc�^�d|jvrd|j�d|j�d�S|j�d|j�d�S)N�@�"z" <�>z <rzrMs rOr�zNameEmail.__str__'sG�� �$�)� � �2�t�y�2�2�T�Z�2�2�2� 2��)�,�,�t�z�,�,�,�,rQN)rVr�rnr�rrrx)rur�rGrr�) rlrmrnro� __slots__r�r�rr�rjrir�rrrQrOr.r.�s�������!�!�F �I�����e�e�e�e������[��� � � ��[� �(�����[��-�-�-�-�-�-rQr.zIPv4Address | IPv6Address�IPvAnyAddressTypezIPv4Interface | IPv6Interface�IPvAnyInterfaceTypezIPv4Network | IPv6Network�IPvAnyNetworkTypec�f�eZdZdZdZdd�Zedd ���Zedd���Zedd���Z dS)r/a�Validate an IPv4 or IPv6 address. ```python from pydantic import BaseModel from pydantic.networks import IPvAnyAddress class IpModel(BaseModel): ip: IPvAnyAddress print(IpModel(ip='127.0.0.1')) #> ip=IPv4Address('127.0.0.1') try: IpModel(ip='http://www.example.com') except ValueError as e: print(e.errors()) ''' [ { 'type': 'ip_any_address', 'loc': ('ip',), 'msg': 'value is not a valid IPv4 or IPv6 address', 'input': 'http://www.example.com', } ] ''' ``` rrrYrrGr�c�� t|��S#t$rYnwxYw t|��S#t$rtdd���wxYw)z!Validate an IPv4 or IPv6 address.�ip_any_addressz)value is not a valid IPv4 or IPv6 address)r� ValueErrorr r�r�rYs rOr�zIPvAnyAddress.__new__Xsz�� �"�5�)�)�)��� � � ��� ���� i�"�5�)�)�)��� i� i� i�)�*:�<g�h�h�h� i������ ��1�A rr^r]r�r!c�8�i}|�dd���|S)Nrm� ipvanyaddressrorqrss rOr�z*IPvAnyAddress.__get_pydantic_json_schema__d�(���L� � � �X�o� � F� F� F�� rQrdrerfr c�Z�tj|jtj�����S�Nr��r� no_info_plain_validator_functionrirrks rOrjz*IPvAnyAddress.__get_pydantic_core_schema__l�.�� �?�� �[�-M�-O�-O���� rQruc��||��SrJrrrws rOrizIPvAnyAddress._validatev����3�{�#�#� #rQN)rYrrGr�rrx)rurrGr�� rlrmrnror�r�rr�rjrirrrQrOr/r/8s������� � �:� � i� i� i� i� � � � � �� � � � � � �� � � $� $� $� �� $� $� $rQr/c�f�eZdZdZdZdd�Zedd ���Zedd���Zedd���Z dS)r0�#Validate an IPv4 or IPv6 interface.rrrYr$rGr�c�� t|��S#t$rYnwxYw t|��S#t$rtdd���wxYw)r��ip_any_interfacez+value is not a valid IPv4 or IPv6 interface)r r�r rr�s rOr�zIPvAnyInterface.__new__sz�� �$�U�+�+�+��� � � ��� ���� m�$�U�+�+�+��� m� m� m�)�*<�>k�l�l�l� m���r�rr^r]r�r!c�8�i}|�dd���|S)Nrm�ipvanyinterfacerorqrss rOr�z,IPvAnyInterface.__get_pydantic_json_schema__�s)���L� � � �X�6G� � H� H� H�� rQrdrerfr c�Z�tj|jtj�����Sr�r�rks rOrjz,IPvAnyInterface.__get_pydantic_core_schema__�r�rQruc��||��SrJrrrws rOrizIPvAnyInterface._validate�r�rQN)rYr$rGr�rrx)rur$rGr�r�rrrQrOr0r0zs�������1�1�� � m� m� m� m� � � � � �� � � � � � �� � � $� $� $� �� $� $� $rQr0c�f�eZdZdZdZdd�Zedd ���Zedd���Zedd���Z dS)r1�!Validate an IPv4 or IPv6 network.rrrYr$rGr�c�� t|��S#t$rYnwxYw t|��S#t$rtdd���wxYw)r��ip_any_networkz)value is not a valid IPv4 or IPv6 network)r r�r rr�s rOr�zIPvAnyNetwork.__new__�sz�� �"�5�)�)�)��� � � ��� ���� i�"�5�)�)�)��� i� i� i�)�*:�<g�h�h�h� i���r�rr^r]r�r!c�8�i}|�dd���|S)Nrm� ipvanynetworkrorqrss rOr�z*IPvAnyNetwork.__get_pydantic_json_schema__�r�rQrdrerfr c�Z�tj|jtj�����Sr�r�rks rOrjz*IPvAnyNetwork.__get_pydantic_core_schema__�r�rQruc��||��SrJrrrws rOrizIPvAnyNetwork._validate�r�rQN)rYr$rGr�rrx)rur$rGr�r�rrrQrOr1r1�s�������/�/�� � i� i� i� i� � � � � �� � � � � � �� � � $� $� $� �� $� $� $rQr1�re.Pattern[str]c �\�d}d|�d|�d�}d}d}tjd|�d|�d |�d ���S) Nz[\w!#$%&\'*+\-/=?^_`{|}~]z((?:z+\s+)*z+)z"((?:[^"]|\")+)"z<(.+)>z\s*(?:�|z)?\s*z\s*)�re�compile)� name_chars�unquoted_name_group�quoted_name_group� email_groups rO�_build_pretty_email_regexr��sY��-�J�B�*�B�B�J�B�B�B��+���K� �:�^� 3�^�^�6G�^�^�k�^�^�^� _� _�_rQirYr��tuple[str, str]c ��t�t��t|��tkrt ddddt�d�i���t �|��}d}|r|���\}}}|p|}|���} tj |d���}nC#tj $r1}t dddt|j d ��i��|�d}~wwxYw|j }|�J�|p|j}||fS) aUEmail address validation using [email-validator](https://pypi.org/project/email-validator/). Returns: A tuple containing the local part of the email (or the name for "pretty" email addresses) and the normalized email. Raises: PydanticCustomError: If the email is invalid. Note: Note that: * Raw IP address (literal) domain parts are not allowed. * `"John Doe <local_part@domain.com>"` style "pretty" email addresses are processed. * Spaces are striped from the beginning and end of addresses, but no error is raised. N� value_errorz,value is not a valid email address: {reason}�reasonzLength must not exceed z charactersF)�check_deliverabilityr)r^rbr��MAX_EMAIL_LENGTHr�pretty_email_regex� fullmatch�groups�stripr9�EmailNotValidErrorr��args� normalized� local_part)rY�mrV� unquoted_name� quoted_namern�partsras rOr9r9�sB��"��� � � � �5�z�z�$�$�$�!� � :� �N�1A�N�N�N� O� � � � �$�$�U�+�+�A��D��,�,-�H�H�J�J�)� �{�E��+� �� �K�K�M�M�E���.�u�5�Q�Q�Q���� � -����!� �I�H�VY�Z[�Z`�ab�Zc�Vd�Vd�Ke� � �� ��������� � �E� � � � � � #�5�#�D� ��;�s�B0�0C0�?,C+�+C0)r�r#rGr#)rGrz)rGr�)rYr�rGr�)^ro� __future__r� _annotations� dataclasses� _dataclassesr�r� functoolsr�importlib.metadatar� ipaddressrr r r r r �typingrrr� pydantic_corerrrrrrr rrw�typing_extensionsrrr�pydantic.errorsr� _internalrr� _migrationr�annotated_handlersr r�r!� type_adapterr#r^r$rp�__all__� dataclassr,rtrr}r%r&r)r+r*r'r(r2r3r4r5r6r7r8r:r;r<r=rbr�r-�Representationr.r�r�r�r/r0r1r�r�r�r9rl� __getattr__rrrQrO�<module>r�s���K�K�K�2�2�2�2�2�2�"�"�"�"� � � � �������������&�&�&�&�&�&�f�f�f�f�f�f�f�f�f�f�f�f�f�f�f�f�/�/�/�/�/�/�/�/�/�/���������������<�;�;�;�;�;�)�)�)�)�)�)�8�8�8�8�8�8�8�8�8�8�-�-�-�-�-�-�7�7�7�7�7�7�7�7�)�)�)�)�)�)�4�4�4�4�4�4�(�(�(�(�(�(�%�%�%�%�%�%�������V�K�V�V�V�V�V��O� � � ��:��1�1�1�1�1�1�1���1�hRy�Ry�Ry�Ry�Ry�Ry�Ry�Ry�jpy�py�py�py�py�py�py�py�f ���� ��������X����2E�E�E�E�E��E�E�E�NV�NV�NV�NV�NV�f�NV�NV�NV�bA�A�A�A�A�f�A�A�A�R�R�R�R�R�6�R�R�R�<�<�<�<�<�f�<�<�<�;�;�;�;�;�V�;�;�;�N�N�N�N�N�#�N�N�N�b�����6����.E�E�E�E�E�f�E�E�E������v����, b� b� b� b� b� � b� b� b�j�j�j�j�j�v�j�j�j� � � � � �� � � ������v����0 � � � � �� � � � � � � � �F� � � ������6����&i�i�i�i��.2���c��"�H�H�*2�*2�*2�*2�*2�*2�*2�*2�ZV-�V-�V-�V-�V-��$�V-�V-�V-�r ;��:�:�:�:�!@��@�@�@�@�:��:�:�:�:��V$�%�M�)�O�%�M�M�@$�@$�@$�@$�@$�@$�@$�@$�D%$�%$�%$�%$�%$�%$�%$�%$�N'$�'$�'$�'$�'$�'$�'$�'$�T`�`�`�`�/�.�0�0����� -�-�-�-�` ���)�)� � � rQ
Memory