Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
networks.cpython-313.pyc629 linesDownload Raw Back to __pycache__
1�

2��jv���^�%SrSSKJr SSKrSSKrSSKJr SSKJ	r	 SSK3Jr SSKJ
r
JrJrJrJrJr SSKJrJrJrJr SS	KJrJrJrJrJr SS4KJr SSKJ r! SSK"J#r#J$r$ SS
K%J&r& SSK'J(r(J)r) SSK*J+r+ SSK,J-r- SSK.J/r/ SSK0J1r1 \(aSSK2q2Sr3S\4S'OSq2/SQr5\Rl"SS55r7"SS5r8"SS5r9\	SXSj5r:"SS \85r;"S!S"\;5r<"S#S$\;5r="S%S&\;5r>"S'S(\;5r?"S)S*\;5r@"S+S,\;5rA"S-S.\95rB"S/S0\;5rC"S1S2\;5rD"S3S4\;5rE"S5S6\95rF"S7S8\;5rG"S9S:\95rH"S;S<\;5rI"S=S>\;5rJ"S?S@\;5rK"SASB\;5rLSYSCjrM\(a\\NSD4rOO5"SESF5rO"SGSH\(R�5rQSIrRS\4SJ'SKrSS\4SL'SMrTS\4SN'\(a\RrU\SrV\TrWO"SOSP5rU"SQSR5rV"SSST5rWSZSUjrX\X"5rYSVrZS[SWjr[\+"\\5r]g)\zEThe networks module contains types for common network-related fields.�)�annotationsN)�fields)�	lru_cache)�version)�IPv4Address�
IPv4Interface�IPv4Network�IPv6Address�
IPv6Interface�IPv6Network)�
TYPE_CHECKING�	Annotated�Any�ClassVar)�
MultiHostHost�PydanticCustomError�$PydanticSerializationUnexpectedValue�SchemaSerializer�core_schema)�MultiHostUrl)�Url)�Self�	TypeAlias)�PydanticUserError�)�_repr�_schema_generation_shared)�getattr_migration)�GetCoreSchemaHandler)�JsonSchemaValue��TypeAdapterz7str | bytes | int | tuple[str | bytes | int, str | int]r�NetworkType)�AnyUrl�6AnyHttpUrl�FileUrl�FtpUrl�HttpUrl�WebsocketUrl�AnyWebsocketUrl�UrlConstraints�EmailStr�	NameEmail�
IPvAnyAddress�IPvAnyInterface�
IPvAnyNetwork�PostgresDsn�CockroachDsn�AmqpDsn�RedisDsn�MongoDsn�KafkaDsn�NatsDsn�validate_email�MySQLDsn�7MariaDBDsn�
ClickHouseDsn�SnowflakeDsnc��\rSrSr%SrSrS\S'SrS\S'SrS\S	'Sr	S8\S'Sr9S\S'SrS10\S
'SrS\S'SSjr
\SSj5rSSjrSrg)r+�Fa�Url constraints.11 12Attributes:13    max_length: The maximum length of the url. Defaults to `None`.14    allowed_schemes: The allowed schemes. Defaults to `None`.15    host_required: Whether the host is required. Defaults to `None`.16    default_host: The default host. Defaults to `None`.17    default_port: The default port. Defaults to `None`.18    default_path: The default path. Defaults to `None`.19    preserve_empty_path: Whether to preserve empty URL paths. Defaults to `None`.20N�21int | None�22max_lengthzlist[str] | None�allowed_schemeszbool | None�
host_required�23str | None�default_host�default_port�default_path�preserve_empty_pathc	���[URURb[UR5OSURUR24URURUR45$�N)	�hashr@rA�tuplerBrDrErFrG��selfs �WD:\code\apps\devtools\python\user_packages\Python313\site-packages\pydantic/networks.py�__hash__�UrlConstraints.__hash__\sd������/3�/C�/C�/O��d�*�*�+�UY��"�"��!�!��!�!��!�!��(�(�
�2526�27	28�c��[U5Vs0sH*n[XR5=ncMURU_M, sn$s snf)zeFetch a key / value mapping of constraints to values that are not None. Used for core schema updates.)r�getattr�name)rM�field�values   rN�defined_constraints�"UrlConstraints.defined_constraintsis?��06�d�|�p�|�e��QU�Wa�Wa�Ib�@b��!��29�30�E�!�|�p�p��ps31�A�Ac��U"U5nUSS:XaUSOUnUS=nS;a[SUS3SS9eURR5H	upgXtU'M U$)	N�type�
function-wrap�schema)�urlzmulti-host-urlz"'UrlConstraints' cannot annotate 'z'.zinvalid-annotated-type)�code)rrW�items)rM�source�handlerr\�schema_to_mutate�annotated_type�constraint_key�constraint_values        rN�__get_pydantic_core_schema__�+UrlConstraints.__get_pydantic_core_schema__ns�������3206�f�~��/P�6�(�+�V\��.�v�6�6�N�?X�X�#�4�^�4D�B�G�Nf��
�15�0H�0H�0N�0N�0P�,�N�/?�^�,�1Q��
rQ���return�int)rjzdict[str, Any])r`rrarrj�core_schema.CoreSchema)�__name__�33__module__�__qualname__�__firstlineno__�__doc__r@�__annotations__rArBrDrErFrGrO�propertyrWrf�__static_attributes__rhrQrNr+r+Fsq��34�"�J�35�!�(,�O�%�,�!%�M�;�%�#�L�*�#�#�L�*�#�#�L�*�#�'+���+�36��q��q�
rQr+c�T�\rSrSr%\"5rS\S'S\S'S%Sjr\S&Sj5r	\S'Sj5r37\S'S	j5r\S'S38j5rS'Sjr
\S(Sj5r\S'S
j5r\S'Sj5rS)Sjr\S'Sj5rS&SjrS&SjrS&SjrS&SjrS*SjrS+SjrS+SjrS+SjrS+SjrS+SjrS,SjrS,Sjr\SSSSSSS.S-Sjj5r \S.S j5r!\S/S!j5r"\S0S"j5r#\$"\%RL"\%RN"5S#95r(S$r)g)1�_BaseUrl�~�ClassVar[UrlConstraints]�_constraints�_CoreUrl�_urlc�j�[UR5RU5RUlgrI��_build_type_adapter�	__class__�validate_pythonr{�rMr]s  rN�__init__�_BaseUrl.__init__��#��'����7�G�G��L�Q�Q��	rQc�.�URR$)z_The scheme part of the URL.39 40e.g. `https` in `https://user:pass@host:port/path?query#fragment`41�r{�schemerLs rNr��_BaseUrl.scheme�����y�y���rQc�.�URR$)zkThe username part of the URL, or `None`.42 43e.g. `user` in `https://user:pass@host:port/path?query#fragment`44)r{�usernamerLs rNr��_BaseUrl.username�����y�y�!�!�!rQc�.�URR$)zkThe password part of the URL, or `None`.45 46e.g. `pass` in `https://user:pass@host:port/path?query#fragment`47)r{�passwordrLs rNr��_BaseUrl.password�r�rQc�.�URR$)u�The host part of the URL, or `None`.48 49If the URL must be punycode encoded, this is the encoded host, e.g if the input URL is `https://£££.com`,50`host` will be `xn--9aaa.com`51�r{�hostrLs rNr��
_BaseUrl.host�s���y�y�~�~�rQc�6�URR5$)uThe host part of the URL as a unicode string, or `None`.52 53e.g. `host` in `https://user:pass@host:port/path?query#fragment`54 55If the URL must be punycode encoded, this is the decoded host, e.g if the input URL is `https://£££.com`,56`unicode_host()` will be `£££.com`57)r{�unicode_hostrLs rNr��_BaseUrl.unicode_host�s���y�y�%�%�'�'rQc�.�URR$)zgThe port part of the URL, or `None`.58 59e.g. `port` in `https://user:pass@host:port/path?query#fragment`60)r{�portrLs rNr��
_BaseUrl.port�����y�y�~�~�rQc�.�URR$)zhThe path part of the URL, or `None`.61 62e.g. `/path` in `https://user:pass@host:port/path?query#fragment`63�r{�pathrLs rNr��
_BaseUrl.path�r�rQc�.�URR$)ziThe query part of the URL, or `None`.64 65e.g. `query` in `https://user:pass@host:port/path?query#fragment`66�r{�queryrLs rNr��_BaseUrl.query�����y�y���rQc�6�URR5$)z�The query part of the URL as a list of key-value pairs.67 68e.g. `[('foo', 'bar')]` in `https://user:pass@host:port/path?foo=bar#fragment`69�r{�query_paramsrLs rNr��_BaseUrl.query_params����70�y�y�%�%�'�'rQc�.�URR$)zoThe fragment part of the URL, or `None`.71 72e.g. `fragment` in `https://user:pass@host:port/path?query#fragment`73�r{�fragmentrLs rNr��_BaseUrl.fragment�r�rQc�6�URR5$)u�The URL as a unicode string, unlike `__str__()` this will not punycode encode the host.74 75If the URL must be punycode encoded, this is the decoded string, e.g if the input URL is `https://£££.com`,76`unicode_string()` will be `https://£££.com`77�r{�unicode_stringrLs rNr��_BaseUrl.unicode_string�s���y�y�'�'�)�)rQc��[U5$�zThe URL's encoded string representation via __str__().78 79This returns the punycode-encoded host version of the URL as a string.80��strrLs rN�encoded_string�_BaseUrl.encoded_string����81�4�y�rQc�,�[UR5$�zDThe URL as a string, this will punycode encode the host if required.�r�r{rLs rN�__str__�_BaseUrl.__str__�����4�9�9�~�rQc�b�URRS[UR5<S3$�N�(�)�rrmr�r{rLs rN�__repr__�_BaseUrl.__repr__��)���.�.�)�)�*�!�C��	�	�N�+=�Q�?�?rQc�8�URUR5$rI�rr{�rM�memos  rN�__deepcopy__�_BaseUrl.__deepcopy__�����~�~�d�i�i�(�(rQc�r�URURL=(a URUR:H$rIr��rM�others  rN�__eq__�_BaseUrl.__eq__��'���~�~����0�L�T�Y�Y�%�*�*�5L�LrQc�r�URURL=(a URUR:$rIr�r�s  rN�__lt__�_BaseUrl.__lt__��'���~�~����0�K�T�Y�Y����5K�KrQc�r�URURL=(a URUR:�$rIr�r�s  rN�__gt__�_BaseUrl.__gt__�r�rQc�r�URURL=(a URUR:*$rIr�r�s  rN�__le__�_BaseUrl.__le__�r�rQc�r�URURL=(a URUR:�$rIr�r�s  rN�__ge__�_BaseUrl.__ge__�r�rQc�,�[UR5$rI�rJr{rLs rNrO�_BaseUrl.__hash__�����D�I�I��rQc�>�[[UR55$rI��lenr�r{rLs rN�__len__�_BaseUrl.__len__����3�t�y�y�>�"�"rQN)r�r�r�r�r�r�c
�D�U"[R"UUUUUUUUS95$)a&Build a new `Url` instance from its component parts.82 83Args:84    scheme: The scheme part of the URL.85    username: The username part of the URL, or omit for no username.86    password: The password part of the URL, or omit for no password.87    host: The host part of the URL.88    port: The port part of the URL, or omit for no port.89    path: The path part of the URL, or omit for no path.90    query: The query part of the URL, or omit for no query.91    fragment: The fragment part of the URL, or omit for no fragment.92 93Returns:94    An instance of URL95)r�r�r�r�r�r�r�r�)rz�build)	�clsr�r�r�r�r�r�r�r�s	         rNr��_BaseUrl.builds5��8��N�N��!�!�����!�	
�96�	97rQc	��[X5(d[SUS[U5SUS35eURS:Xa[	U5$U$�Nz98Expected `z` but got `z` with value `'z-'` - serialized value may not be as expected.�json��99isinstancerrZ�moder��r�r]�infos   rN�
serialize_url�_BaseUrl.serialize_url.�S���#�#�#�6��S�E��T�#�Y�K��s�e�Kx�y��
��9�9����s�8�O��100rQc101��^�U4Sjn[R"U[R"S0URRD6[R102"URSSS9S9$)Nc�>�[UT5(aU$[U[5(a[U5nU"U5nTRT5nX#lU$rI)r�rvr��__new__r{��v�h�core_url�instancer`s    �rN�wrap_val�7_BaseUrl.__get_pydantic_core_schema__.<locals>.wrap_val<sL����!�V�$�$����!�X�&�&���F����t�H��~�~�f�-�H�$�M��OrQT�always��info_arg�	when_used�r\�
serializationrh)r�no_info_wrap_validator_function�103url_schemaryrW�$plain_serializer_function_ser_schemar��r�r`rars `  rNrf�%_BaseUrl.__get_pydantic_core_schema__8sX���	��:�:���)�)�Q�C�,<�,<�,P�,P�Q�%�J�J��!�!�D�H��104�	105rQc�2�USS:XaUSOUnU"U5$�NrZr[r\rh�r�rra�inner_schemas    rN�__get_pydantic_json_schema__�%_BaseUrl.__get_pydantic_json_schema__N�(��1<�F�0C��0V�{�8�,�\g���|�$�$rQ�r	�r{)r]zstr | _CoreUrl | _BaseUrlrj�None�rjr��rjrC)rjr?�rjzlist[tuple[str, str]]�r��dictrjr�r�rrj�boolri)r�r�r�rCr�rCr�r�r�r?r�rCr�rCr�rCrjr�r]rr�zcore_schema.SerializationInforjz106str | Self)r`ztype[_BaseUrl]rarrjrl�rrlraz._schema_generation_shared.GetJsonSchemaHandlerrjr )*rmrnrorpr+ryrrr�rsr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rOr��classmethodr�r�rfrrr�107any_schema�to_string_ser_schema�__pydantic_serializer__rtrhrQrNrvrv~s��-;�-=�L�*�=�108�N�R�� �� ��"��"��"��"�����(�������������(��"��"�*���@�)�M�L�L�M�M��#��109 $�#��� �#�&110��&111��	&112�113�&114��
&115��&116��&117��&118��&119�120�&121��&122�P�����123�#�124�.B�125�	�126��127�*�%�0�%�;i�%�	�%��%�/�{�/E�/E�T_�Tt�Tt�Tv�/w�x�rQrvc128���\rSrSr%\"5rS\S'S\S'SSjr\SSj5r	\SSj5r129\SS	j5rS S130jr\SSj5r
S!SjrSS
jrSSjrSSjrSSjrS"SjrS#SjrS$SjrS$Sjr\SSSSSSSSS.S%Sjj5r\S&Sj5r\S'Sj5r\S(Sj5r\"\R<"\R>"5S95r Sr!g))�_BaseMultiHostUrliZrxry�_CoreMultiHostUrlr{c�j�[UR5RU5RUlgrIr}r�s  rNr��_BaseMultiHostUrl.__init__^r�rQc�.�URR$)z[The scheme part of the URL.131 132e.g. `https` in `https://foo.com,bar.com/path?query#fragment`133r�rLs rNr��_BaseMultiHostUrl.schemear�rQc�.�URR$)zdThe path part of the URL, or `None`.134 135e.g. `/path` in `https://foo.com,bar.com/path?query#fragment`136r�rLs rNr��_BaseMultiHostUrl.pathir�rQc�.�URR$)zeThe query part of the URL, or `None`.137 138e.g. `query` in `https://foo.com,bar.com/path?query#fragment`139r�rLs rNr��_BaseMultiHostUrl.queryqr�rQc�6�URR5$)z�The query part of the URL as a list of key-value pairs.140 141e.g. `[('foo', 'bar')]` in `https://foo.com,bar.com/path?foo=bar#fragment`142r�rLs rNr��_BaseMultiHostUrl.query_paramsyr�rQc�.�URR$)zkThe fragment part of the URL, or `None`.143 144e.g. `fragment` in `https://foo.com,bar.com/path?query#fragment`145r�rLs rNr��_BaseMultiHostUrl.fragment�r�rQc�6�URR5$)a�The hosts of the `MultiHostUrl` as [`MultiHostHost`][pydantic_core.MultiHostHost] typed dicts.146 147```python148from pydantic_core import MultiHostUrl149 150mhu = MultiHostUrl('https://foo.com:123,foo:bar@bar.com/path')151print(mhu.hosts())152"""153[154    {'username': None, 'password': None, 'host': 'foo.com', 'port': 123},155    {'username': 'foo', 'password': 'bar', 'host': 'bar.com', 'port': 443}156]157```158Returns:159    A list of dicts, each representing a host.160)r{�hostsrLs rNr6�_BaseMultiHostUrl.hosts�s��"�y�y��� � rQc��[U5$r�r�rLs rNr�� _BaseMultiHostUrl.encoded_string�r�rQc�6�URR5$)zXThe URL as a unicode string, unlike `__str__()` this will not punycode encode the hosts.r�rLs rNr�� _BaseMultiHostUrl.unicode_string�s���y�y�'�'�)�)rQc�,�[UR5$r�r�rLs rNr��_BaseMultiHostUrl.__str__�r�rQc�b�URRS[UR5<S3$r�r�rLs rNr��_BaseMultiHostUrl.__repr__�r�rQc�8�URUR5$rIr�r�s  rNr��_BaseMultiHostUrl.__deepcopy__�r�rQc�r�URURL=(a URUR:H$rIr�r�s  rNr��_BaseMultiHostUrl.__eq__�r�rQc�,�[UR5$rIr�rLs rNrO�_BaseMultiHostUrl.__hash__�r�rQc�>�[[UR55$rIr�rLs rNr��_BaseMultiHostUrl.__len__�r�rQN)r6r�r�r�r�r�r�r�c	�F�U"[R"UUUUUUUUU	S9	5$)a�Build a new `MultiHostUrl` instance from its component parts.161 162This method takes either `hosts` - a list of `MultiHostHost` typed dicts, or the individual components163`username`, `password`, `host` and `port`.164 165Args:166    scheme: The scheme part of the URL.167    hosts: Multiple hosts to build the URL from.168    username: The username part of the URL.169    password: The password part of the URL.170    host: The host part of the URL.171    port: The port part of the URL.172    path: The path part of the URL.173    query: The query part of the URL, or omit for no query.174    fragment: The fragment part of the URL, or omit for no fragment.175 176Returns:177    An instance of `MultiHostUrl`178)	r�r6r�r�r�r�r�r�r�)r(r�)179r�r�r6r�r�r�r�r�r�r�s180          rNr��_BaseMultiHostUrl.build�s;��B��#�#���!�!�����!�181
�182�	183rQc	��[X5(d[SUS[U5SUS35eURS:Xa[	U5$U$r�r�r�s   rNr��_BaseMultiHostUrl.serialize_url�r�rQc184��^�U4Sjn[R"U[R"S0URRD6[R185"URSSS9S9$)Nc�>�[UT5(aU$[U[5(a[U5nU"U5nTRT5nX#lU$rI)r�r'r�r�r{r�s    �rNr�@_BaseMultiHostUrl.__get_pydantic_core_schema__.<locals>.wrap_val�sM����!�V�$�$����!�.�/�/���F����t�H��~�~�f�-�H�$�M��OrQTrrrrh)rr186�multi_host_url_schemaryrWrr�r
s `  rNrf�._BaseMultiHostUrl.__get_pydantic_core_schema__�sX���	��:�:���4�4�\�s�7G�7G�7[�7[�\�%�J�J��!�!�D�H��187�	188rQc�2�USS:XaUSOUnU"U5$rrhrs    rNr�._BaseMultiHostUrl.__get_pydantic_json_schema__rrQrr)r]z+str | _CoreMultiHostUrl | _BaseMultiHostUrlrjrrrr)rjzlist[MultiHostHost]rrri)r�r�r6zlist[MultiHostHost] | Noner�rCr�rCr�rCr�r?r�rCr�rCr�rCrjrr )r`ztype[_BaseMultiHostUrl]rarrjrlr!)"rmrnrorpr+ryrrr�rsr�r�r�r�r�r6r�r�r�r�r�r�rOr�r"r�r�rfrrrr#r$r%rtrhrQrNr'r'Zs���-;�-=�L�*�=�189��R�� �� ���������(��"��"�!�&�*��@�)�M��#��190-1�#�#���� �#�,191��,192�*�	,193�194�,195��
,196��,197��,198��,199��,200��,201�202�,203��,204�\�����205�,�206�7K�207�	�208��209�*�%�0�%�;i�%�	�%��%�/�{�/E�/E�T_�Tt�Tt�Tv�/w�x�rQr'c��[U5$rIr!)r�s rNr~r~s
���s��rQc��\rSrSrSrSrg)r$ia�Base type for all URLs.210 211* Any scheme allowed212* Top-level domain (TLD) not required213* Host not required214 215Assuming an input URL of `http://samuel:pass@example.com:8000/the/path/?query=here#fragment=is;this=bit`,216the types export the following properties:217 218- `scheme`: the URL scheme (`http`), always set.219- `host`: the URL host (`example.com`).220- `username`: optional username if included (`samuel`).221- `password`: optional password if included (`pass`).222- `port`: optional port (`8000`).223- `path`: optional path (`/the/path/`).224- `query`: optional URL query (for example, `GET` arguments or "search string", such as `query=here`).225- `fragment`: optional fragment (`fragment=is;this=bit`).226rhN)rmrnrorprqrtrhrQrNr$r$s��rQr$c�(�\rSrSrSr\"SS/S9rSrg)r%i2zWA type that will accept any http or https URL.227 228* TLD not required229* Host not required230�http�https�rArhN�rmrnrorprqr+ryrtrhrQrNr%r%2s���"�6�7�2C�D�LrQr%c�*�\rSrSrSr\"SSS/S9rSrg)	r(i<u�	A type that will accept any http or https URL.231 232* TLD not required233* Host not required234* Max length 2083235 236```python237from pydantic import BaseModel, HttpUrl, ValidationError238 239class MyModel(BaseModel):240    url: HttpUrl241 242m = MyModel(url='http://www.example.com')  # (1)!243print(m.url)244#> http://www.example.com/245 246try:247    MyModel(url='ftp://invalid.url')248except ValidationError as e:249    print(e)250    '''251    1 validation error for MyModel252    url253      URL scheme should be 'http' or 'https' [type=url_scheme, input_value='ftp://invalid.url', input_type=str]254    '''255 256try:257    MyModel(url='not a url')258except ValidationError as e:259    print(e)260    '''261    1 validation error for MyModel262    url263      Input should be a valid URL, relative URL without a base [type=url_parsing, input_value='not a url', input_type=str]264    '''265```266 2671. Note: mypy would prefer `m = MyModel(url=HttpUrl('http://www.example.com'))`, but Pydantic will convert the string to an HttpUrl instance anyway.268 269"International domains" (e.g. a URL where the host or TLD includes non-ascii characters) will be encoded via270[punycode](https://en.wikipedia.org/wiki/Punycode) (see271[this article](https://www.xudongz.com/blog/2017/idn-phishing/) for a good description of why this is important):272 273```python274from pydantic import BaseModel, HttpUrl275 276class MyModel(BaseModel):277    url: HttpUrl278 279m1 = MyModel(url='http://puny£code.com')280print(m1.url)281#> http://xn--punycode-eja.com/282m2 = MyModel(url='https://www.аррӏе.com/')283print(m2.url)284#> https://www.xn--80ak6aa92e.com/285m3 = MyModel(url='https://www.example.珠宝/')286print(m3.url)287#> https://www.example.xn--pbt977c/288```289 290 291!!! warning "Underscores in Hostnames"292    In Pydantic, underscores are allowed in all parts of a domain except the TLD.293    Technically this might be wrong - in theory the hostname cannot have underscores, but subdomains can.294 295    To explain this; consider the following two cases:296 297    - `exam_ple.co.uk`: the hostname is `exam_ple`, which should not be allowed since it contains an underscore.298    - `foo_bar.example.com` the hostname is `example`, which should be allowed since the underscore is in the subdomain.299 300    Without having an exhaustive list of TLDs, it would be impossible to differentiate between these two. Therefore301    underscores are allowed, but you can always do further validation in a validator if desired.302 303    Also, Chrome, Firefox, and Safari all currently accept `http://exam_ple.com` as a URL, so we're in good304    (or at least big) company.305�#rVrW�r@rArhNrYrhrQrNr(r(<s��K�Z"�T�F�G�CT�U�LrQr(c�(�\rSrSrSr\"SS/S9rSrg)r*i�zSA type that will accept any ws or wss URL.306 307* TLD not required308* Host not required309�ws�wssrXrhNrYrhrQrNr*r*�s���"�4��-�@�LrQr*c�*�\rSrSrSr\"SSS/S9rSrg)	r)i�zeA type that will accept any ws or wss URL.310 311* TLD not required312* Host not required313* Max length 2083314r[r^r_r\rhNrYrhrQrNr)r)�s���"�T�D�%�=�Q�LrQr)c�&�\rSrSrSr\"S/S9rSrg)r&i�z;A type that will accept any file URL.315 316* Host not required317�filerXrhNrYrhrQrNr&r&�s���318"�6�(�;�LrQr&c�&�\rSrSrSr\"S/S9rSrg)r'i�zIA type that will accept ftp URL.319 320* TLD not required321* Host not required322�ftprXrhNrYrhrQrNr'r'�s���"�5�'�:�LrQr'c�>�\rSrSrSr\"S/SQS9r\S	Sj5rSr	g)323r1i�a~A type that will accept any Postgres DSN.324 325* User info required326* TLD not required327* Host required328* Supports multiple hosts329 330If further validation is required, these properties can be used by validators to enforce specific behaviour:331 332```python333from pydantic import (334    BaseModel,335    HttpUrl,336    PostgresDsn,337    ValidationError,338    field_validator,339)340 341class MyModel(BaseModel):342    url: HttpUrl343 344m = MyModel(url='http://www.example.com')345 346# the repr() method for a url will display all properties of the url347print(repr(m.url))348#> HttpUrl('http://www.example.com/')349print(m.url.scheme)350#> http351print(m.url.host)352#> www.example.com353print(m.url.port)354#> 80355 356class MyDatabaseModel(BaseModel):357    db: PostgresDsn358 359    @field_validator('db')360    def check_db_name(cls, v):361        assert v.path and len(v.path) > 1, 'database must be provided'362        return v363 364m = MyDatabaseModel(db='postgres://user:pass@localhost:5432/foobar')365print(m.db)366#> postgres://user:pass@localhost:5432/foobar367 368try:369    MyDatabaseModel(db='postgres://user:pass@localhost:5432')370except ValidationError as e:371    print(e)372    '''373    1 validation error for MyDatabaseModel374    db375      Assertion failed, database must be provided376    assert (None)377     +  where None = PostgresDsn('postgres://user:pass@localhost:5432').path [type=assertion_error, input_value='postgres://user:pass@localhost:5432', input_type=str]378    '''379```380T)	�postgres�381postgresqlzpostgresql+asyncpgzpostgresql+pg8000zpostgresql+psycopgzpostgresql+psycopg2zpostgresql+psycopg2cffizpostgresql+py-postgresqlzpostgresql+pygresql�rBrAc�.�URR$�zThe required URL host.r�rLs rNr��PostgresDsn.host����y�y�~�~�rQrhNr�382rmrnrorprqr+ryrsr�rtrhrQrNr1r1�s0��9�v"��383384�
�L����rQr1c�>�\rSrSrSr\"S/SQS9r\S	Sj5rSr	g)385r2izdA type that will accept any Cockroach DSN.386 387* User info required388* TLD not required389* Host required390T)�cockroachdbzcockroachdb+psycopg2zcockroachdb+asyncpgrhc�.�URR$rjr�rLs rNr��CockroachDsn.hostrlrQrhNrrmrhrQrNr2r2s/���"��391��L����rQr2c�(�\rSrSrSr\"SS/S9rSrg)r3izcA type that will accept any AMQP DSN.392 393* User info required394* TLD not required395* Host not required396�amqp�amqpsrXrhNrYrhrQrNr3r3s���"�6�7�2C�D�LrQr3c�D�\rSrSrSr\"SS/SSSSS	9r\S
S397j5rSr	g)r4i(z�A type that will accept any Redis DSN.398 399* User info required400* TLD not required401* Host required (e.g., `rediss://:pass@localhost`)402�redis�rediss�	localhosti�z/0T)rArDrErFrBc�.�URR$rjr�rLs rNr��
RedisDsn.host8rlrQrhNrrmrhrQrNr4r4(s;���"� �(�+� �����L����rQr4c�*�\rSrSrSr\"SS/SS9rSrg)	r5i>a�A type that will accept any MongoDB DSN.403 404* User info not required405* Database name not required406* Port not required407* User info may be passed without user part (e.g., `mongodb://mongodb0.example.com:27017`).408 409!!! warning410    If a port isn't specified, the default MongoDB port `27017` will be used. If this behavior is411    undesirable, you can use the following:412 413    ```python414    from typing import Annotated415 416    from pydantic_core import MultiHostUrl417 418    from pydantic import UrlConstraints419 420    MongoDsnNoDefaultPort = Annotated[421        MultiHostUrl,422        UrlConstraints(allowed_schemes=['mongodb', 'mongodb+srv']),423    ]424    ```425�mongodbzmongodb+srvi�i�rArErhNrYrhrQrNr5r5>s���2"�9�m�2L�[`�a�LrQr5c�*�\rSrSrSr\"S/SSS9rSrg)	r6i[zdA type that will accept any Kafka DSN.426 427* User info required428* TLD not required429* Host not required430�kafkarxi�#�rArDrErhNrYrhrQrNr6r6[s���"�7�)�+�dh�i�LrQr6c�,�\rSrSrSr\"/SQSSS9rSrg)	r7ifa8A type that will accept any NATS DSN.431 432NATS is a connective technology built for the ever increasingly hyper-connected world.433It is a single technology that enables applications to securely communicate across434any combination of cloud vendors, on-premise, edge, web and mobile, and devices.435More: https://nats.io436)�nats�tlsr^r_rxi~r�rhNrYrhrQrNr7r7fs���"�4�;�]a��LrQr7c�,�\rSrSrSr\"/SQSSS9rSrg)	r9itzdA type that will accept any MySQL DSN.437 438* User info required439* TLD not required440* Host not required441)�mysqlzmysql+mysqlconnectorzmysql+aiomysqlz
mysql+asyncmyz
mysql+mysqldbz
mysql+pymysqlz
mysql+cymysqlzmysql+pyodbc��T)rArErBrhNrYrhrQrNr9r9ts ���"�	442���
�LrQr9c�*�\rSrSrSr\"/SQSS9rSrg)r:i�zfA type that will accept any MariaDB DSN.443 444* User info required445* TLD not required446* Host not required447)�mariadbzmariadb+mariadbconnectorzmariadb+pymysqlr�r}rhNrYrhrQrNr:r:�s���"�R���LrQr:c�,�\rSrSrSr\"/SQSSS9rSrg)	r;i�ziA type that will accept any ClickHouse DSN.448 449* User info required450* TLD not required451* Host not required452)zclickhouse+nativezclickhouse+asynchzclickhouse+http�453clickhouse�clickhouses�clickhousedbrxi(#r�rhNrYrhrQrNr;r;�s ���"�454�!���LrQr;c�<�\rSrSrSr\"S/SS9r\S	Sj5rSr	g)455r<i�zdA type that will accept any Snowflake DSN.456 457* User info required458* TLD not required459* Host required460�	snowflakeT)rArBc�.�URR$rjr�rLs rNr��SnowflakeDsn.host�rlrQrhNrrmrhrQrNr<r<�s/���"�$�
���L�461���rQr<c��SSKq[S5RS5SS:Xd[S5eg![an[S5UeSnAff=f)NrzEemail-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 rN�import_email_validatorr��s_��j���$�%�/�/��4�Q�7�3�>��g�h�h�?���j��a�b�hi�i��j�s�3�462A�A	�	A.c�l�\rSrSrSr\SSj5r\S	Sj5r\S463Sj5rSr	g)r,i�a�464Info:465    To use this type, you need to install the optional466    [`email-validator`](https://github.com/JoshData/python-email-validator) package:467 468    ```bash469    pip install email-validator470    ```471 472Validate email addresses.473 474```python475from pydantic import BaseModel, EmailStr476 477class Model(BaseModel):478    email: EmailStr479 480print(Model(email='contact@mail.com'))481#> email='contact@mail.com'482```483c�~�[5 [R"UR[R"55$rI)r�r� no_info_after_validator_function�	_validate�484str_schema�r��_source�_handlers   rNrf�%EmailStr.__get_pydantic_core_schema__�s*��
#�$��?�?��
�
�{�Oe�Oe�Og�h�hrQc�6�U"U5nURSSS9 U$)N�string�email�rZ�format��update�r�rra�field_schemas    rNr�%EmailStr.__get_pydantic_json_schema__�s'��#�;�/�L����X�g��>��rQc��[U5S$)Nr)r8�r��input_values  rNr��EmailStr._validate�s��!�+�.�q�1�1rQrhN�r�z	type[Any]r�rrjrlr!)r�r�rjr�)485rmrnrorprqr"rfrr�rtrhrQrNr,r,�s|��	�,486�	i��	i�+�	i�$�		i�487�	i�488�	 �4�	 �?m�	 �
�	 �489�	 �490�	2�491�	2rQr,c��\rSrSrSrSrSSjrS
Sjr\SSj5r	\SSj5r492\SSj5rSS	jrS493r
g)r-i�ad494Info:495    To use this type, you need to install the optional496    [`email-validator`](https://github.com/JoshData/python-email-validator) package:497 498    ```bash499    pip install email-validator500    ```501 502Validate a name and email address combination, as specified by503[RFC 5322](https://datatracker.ietf.org/doc/html/rfc5322#section-3.4).504 505The `NameEmail` has two properties: `name` and `email`.506In case the `name` is not provided, it's inferred from the email address.507 508```python509from pydantic import BaseModel, NameEmail510 511class User(BaseModel):512    email: NameEmail513 514user = User(email='Fred Bloggs <fred.bloggs@example.com>')515print(user.email)516#> Fred Bloggs <fred.bloggs@example.com>517print(user.email.name)518#> Fred Bloggs519 520user = User(email='fred.bloggs@example.com')521print(user.email)522#> fred.bloggs <fred.bloggs@example.com>523print(user.email.name)524#> fred.bloggs525```526�rTr�c��XlX lgrIr�)rMrTr�s   rNr��NameEmail.__init__$s���	��527rQc��[U[5=(a1 URUR4URUR4:H$rI)r�r-rTr�r�s  rNr��NameEmail.__eq__(s6���%��+�d����D�J�J�0G�E�J�J�X]�Xc�Xc�Kd�0d�drQc�6�U"U5nURSSS9 U$)Nr�z528name-emailr�r�r�s    rNr�&NameEmail.__get_pydantic_json_schema__+s'���{�+������,��?��rQc�F�[5 [R"UR[R"[R529"5[R"[R"U5[R530"5/SSS9[R"5S95$)N�name_email_typezInput is not a valid NameEmail)�custom_error_type�custom_error_message)�json_schema�
python_schemar	)	r�rr�r��json_or_python_schemar��union_schema�is_instance_schemar$r�s   rNrf�&NameEmail.__get_pydantic_core_schema__3s|��	� ��;�;��M�M��-�-�'�2�2�4�)�6�6� �3�3�C�8�+�:P�:P�:R�S�&7�)I��531*�>�>�@�
�532�	533rQc�Z�[U[5(a[U5up#U"X#5$U$rI)r�r�r8)r�r�rTr�s    rNr��NameEmail._validateHs,���k�3�'�'�(��5�K�D��t�#�#��rQc��SUR;aSURSURS3$URSURS3$)N�@�"z" <�>z <r�rLs rNr��NameEmail.__str__PsF���$�)�)���t�y�y�k��T�Z�Z�L��2�2��)�)��B�t�z�z�l�!�,�,rQ)r�rTN)rTr�r�r�rr!r�)r�z534Self | strrjrr)rmrnrorprq�	__slots__r�r�r"rrfr�r�rtrhrQrNr-r-�s���!�F �I��e���0��;i��	�����535��536�'�537�538 �	539��540�(����-rQr-zIPv4Address | IPv6Address�IPvAnyAddressTypezIPv4Interface | IPv6Interface�IPvAnyInterfaceTypezIPv4Network | IPv6Network�IPvAnyNetworkTypec�z�\rSrSrSrSrS	Sjr\S541Sj5r\SSj5r	\SSj5r542Srg)
r.iaa*Validate an IPv4 or IPv6 address.543 544```python545from pydantic import BaseModel546from pydantic.networks import IPvAnyAddress547 548class IpModel(BaseModel):549    ip: IPvAnyAddress550 551print(IpModel(ip='127.0.0.1'))552#> ip=IPv4Address('127.0.0.1')553 554try:555    IpModel(ip='http://www.example.com')556except ValueError as e:557    print(e.errors())558    '''559    [560        {561            'type': 'ip_any_address',562            'loc': ('ip',),563            'msg': 'value is not a valid IPv4 or IPv6 address',564            'input': 'http://www.example.com',565        }566    ]567    '''568```569rhc��[U5$![a Of=f[U5$![a
 [SS5ef=f)z!Validate an IPv4 or IPv6 address.�ip_any_addressz)value is not a valid IPv4 or IPv6 address)r�570ValueErrorr571r�r�rVs  rNr��IPvAnyAddress.__new__�sU��
�"�5�)�)���
��
��
i�"�5�)�)���
i�)�*:�<g�h�h�
i���572
�573��574)�Ac�*�0nURSSS9 U$)Nr��
ipvanyaddressr�r�r�s    rNr�*IPvAnyAddress.__get_pydantic_json_schema__��"���L����X�o��F��rQc�f�[R"UR[R"5S9$�Nr�r� no_info_plain_validator_functionr�r$r�s   rNrf�*IPvAnyAddress.__get_pydantic_core_schema__��)���?�?��
�
�[�-M�-M�-O��
rQc��U"U5$rIrhr�s  rNr��IPvAnyAddress._validate��
���{�#�#rQN)rVrrjr�r!r�)r�rrjr��rmrnrorprqr�r�r"rrfr�rtrhrQrNr.r.as���	�:�	�575	i�576�	 �4�	 �?m�	 �
�	 �577�	 �578�	��	�+�	�$�		�579�	�580�	$�581�	$rQr.c�z�\rSrSrSrSrS	Sjr\S582Sj5r\SSj5r	\SSj5r583Srg)
r/i��#Validate an IPv4 or IPv6 interface.rhc��[U5$![a Of=f[U5$![a
 [SS5ef=f)r��ip_any_interfacez+value is not a valid IPv4 or IPv6 interface)rr�rrr�s  rNr��IPvAnyInterface.__new__�sU��
�$�U�+�+���
��
��
m�$�U�+�+���
m�)�*<�>k�l�l�
m�r�c�*�0nURSSS9 U$)Nr��ipvanyinterfacer�r�r�s    rNr�,IPvAnyInterface.__get_pydantic_json_schema__�s#���L����X�6G��H��rQc�f�[R"UR[R"5S9$r�r�r�s   rNrf�,IPvAnyInterface.__get_pydantic_core_schema__�r�rQc��U"U5$rIrhr�s  rNr��IPvAnyInterface._validate�r�rQN)rVr#rjr�r!r�)r�r#rjr�r�rhrQrNr/r/�s���1��	�584	m�585�	 �4�	 �?m�	 �
�	 �586�	 �587�	��	�+�	�$�		�588�	�589�	$�590�	$rQr/c�z�\rSrSrSrSrS	Sjr\S591Sj5r\SSj5r	\SSj5r592Srg)
r0i��!Validate an IPv4 or IPv6 network.rhc��[U5$![a Of=f[U5$![a
 [SS5ef=f)r��ip_any_networkz)value is not a valid IPv4 or IPv6 network)r	r�rrr�s  rNr��IPvAnyNetwork.__new__�sU��
�"�5�)�)���
��
��
i�"�5�)�)���
i�)�*:�<g�h�h�
i�r�c�*�0nURSSS9 U$)Nr��
ipvanynetworkr�r�r�s    rNr�*IPvAnyNetwork.__get_pydantic_json_schema__�r�rQc�f�[R"UR[R"5S9$r�r�r�s   rNrf�*IPvAnyNetwork.__get_pydantic_core_schema__�r�rQc��U"U5$rIrhr�s  rNr��IPvAnyNetwork._validate�r�rQN)rVr#rjr�r!r�)r�r#rjr�r�rhrQrNr0r0�s���/��	�	i�593�	 �4�	 �?m�	 �
�	 �594�	 �595�	��	�+�	�$�		�596�	�597�	$�598�	$rQr0c	�`�SnSUSUS3nSnSn[R"SUSUS	US59935$)Nz[\w!#$%&\'*+\-/=?^_`{|}~]z((?:z+\s+)*z+)z"((?:[^"]|\")+)"z<(.+)>z\s*(?:�|z)?\s*z\s*)�re�compile)�600name_chars�unquoted_name_group�quoted_name_group�email_groups    rN�_build_pretty_email_regexr�sP��-�J�!�*��V�J�<�r�B��+���K�
�:�:�� 3�4�A�6G�5H��k�]�Z]�^�_�_rQic601��[c602[5 [U5[:�a[	SSSS[S305e[603R
U5nSnU(aUR5up4nU=(d UnUR5n[R"USS9nURnUceU=(d URnX%4$![Ra+n[	SSS[URS	505UeSnAff=f)604a)Email address validation using [email-validator](https://pypi.org/project/email-validator/).605 606Returns:607    A tuple containing the local part of the email (or the name for "pretty" email addresses)608        and the normalized email.609 610Raises:611    PydanticCustomError: If the email is invalid.612 613Note:614    Note that:615 616    * Raw IP address (literal) domain parts are not allowed.617    * `"John Doe <local_part@domain.com>"` style "pretty" email addresses are processed.618    * Spaces are striped from the beginning and end of addresses, but no error is raised.619N�value_errorz,value is not a valid email address: {reason}�reasonzLength must not exceed z charactersF)�check_deliverabilityr)r�r�r��MAX_EMAIL_LENGTHr�pretty_email_regex�	fullmatch�groups�stripr8�EmailNotValidErrorr��args�620normalized�621local_part)rV�mrT�
unquoted_name�quoted_namer��partsr�s        rNr8r8s��"��� �622�5�z�$�$�!��:�
�0�1A�0B�+�N�O�623�	624�	�$�$�U�+�A��D��,-�H�H�J�)�
�E��+����K�K�M�E���.�.�u�5�Q��
���E������#�5�#�#�D��;����-�-��!��I�H�VY�Z[�Z`�Z`�ab�Zc�Vd�Ke�625��	���s�	C�D�&D�D)r�z"type[_BaseUrl | _BaseMultiHostUrl]rjr")rjr)rjzre.Pattern[str])rVr�rjztuple[str, str])^rq�626__future__r�_annotations�dataclasses�_dataclassesr�r�	functoolsr�importlib.metadatar�	ipaddressrrr	r627rr�typingr
rrr�
pydantic_corerrrrrrr(rrz�typing_extensionsrr�pydantic.errorsr�	_internalrr�628_migrationr�annotated_handlersrr�r �type_adapterr"r�r#rr�__all__�	dataclassr+rvr'r~r$r%r(r*r)r&r'r1r2r3r4r5r6r7r9r:r;r<r�r�r,�Representationr-r�r�r�r.r/r0rr	rr8rm�__getattr__rhrQrN�<module>r(sk��K�2�"�	���&�f�f�:�:���<�)�-�-�7�)�4�(�%���V�K��V��O���:���4�4��4�nYy�Yy�xwy�wy�t�����X��2E��E�NV�f�NV�bA�f�A�R�6�R�<�f�<�;�V�;�N�#�N�b�6��.E�f�E��v��,b� �b�:j�v�j�����v��0����F��,�6��&i����c��"�H�*2�*2�ZV-��$�$�V-�r ;��9�:�!@��Y�@�:��9�:��%�M�)�O�%�M�@$�@$�D%$�%$�N'$�'$�T`�/�0�����629-�` ��)�rQ
codekingpro/portable-devtools · Team Ai