
    ,h                    8   U d Z ddlmZ ddlZddlZddlmZ ddlm	Z	 ddl
mZ ddlmZmZmZmZmZmZ ddlmZmZmZmZ dd	lmZmZmZmZmZ dd
lmZ ddlm Z! ddl"m#Z#m$Z$ ddl%m&Z& ddl'm(Z(m)Z) ddl*m+Z+ ddl,m-Z- ddl.m/Z/ ddl0m1Z1 erddl2a2dZ3de4d<   nda2g dZ5ejl                   G d d             Z7 G d d      Z8 G d d      Z9e	dXd       Z: G d d e8      Z; G d! d"e;      Z< G d# d$e;      Z= G d% d&e;      Z> G d' d(e;      Z? G d) d*e;      Z@ G d+ d,e;      ZA G d- d.e9      ZB G d/ d0e;      ZC G d1 d2e;      ZD G d3 d4e;      ZE G d5 d6e9      ZF G d7 d8e;      ZG G d9 d:e9      ZH G d; d<e;      ZI G d= d>e;      ZJ G d? d@e;      ZK G dA dBe;      ZLdYdCZMereeNdDf   ZOn
 G dE dF      ZO G dG dHe(j                        ZQdIZRde4dJ<   dKZSde4dL<   dMZTde4dN<   ereRZUeSZVeTZWn G dO dP      ZU G dQ dR      ZV G dS dT      ZWdZdUZX eX       ZYdVZZ	 d[dWZ[ e+e\      Z]y)\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
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                      e Zd ZU dZdZded<   dZded<   dZded<   dZd	ed
<   dZ	ded<   dZ
d	ed<   ddZedd       ZddZy)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_lengthzlist[str] | Noneallowed_schemeszbool | Nonehost_required
str | Nonedefault_hostdefault_portdefault_pathc                    t        | j                  | j                  t        | j                        nd | j                  | j
                  | j                  | j                  f      S N)hashr?   r@   tuplerA   rC   rD   rE   selfs    S/var/www/html/Resume-Scraper/venv/lib/python3.12/site-packages/pydantic/networks.py__hash__zUrlConstraints.__hash__Z   s[    /3/C/C/Od**+UY""!!!!!!	
 		
    c                    t        |       D ci c](  }t        | |j                        x}|j                  |* c}S c c}w )zeFetch a key / value mapping of constraints to values that are not None. Used for core schema updates.)r   getattrname)rK   fieldvalues      rL   defined_constraintsz"UrlConstraints.defined_constraintsf   s>     06d|peQUW\WaWaIb@b?o

E!ppps   >>c                     ||      }|d   dk(  r|d   n|}|d   dvx}rt        d| dd      | j                  j                         D ]
  \  }}|||<    |S )	Ntypefunction-wrapschema)urlzmulti-host-urlz"'UrlConstraints' cannot annotate 'z'.zinvalid-annotated-type)code)r   rT   items)rK   sourcehandlerrX   schema_to_mutateannotated_typeconstraint_keyconstraint_values           rL   __get_pydantic_core_schema__z+UrlConstraints.__get_pydantic_core_schema__k   s    
 06f~/P6(+V\-f5=VVV>V#4^4DBGNf  150H0H0N0N0P 	@,N,/?^,	@rN   returnint)rd   zdict[str, Any])r\   r   r]   r   rd   core_schema.CoreSchema)__name__
__module____qualname____doc__r?   __annotations__r@   rA   rC   rD   rE   rM   propertyrT   rb    rN   rL   r+   r+   F   sf    	 "J
!(,O%,!%M;%#L*##L*##L*#

 q qrN   r+   c                     e Zd ZU  e       Zded<   ded<   d#dZed$d       Zed%d       Z	ed%d       Z
ed%d	       Zd%d
Zed&d       Zed%d       Zed%d       Zd'dZed%d       Zd$dZd$dZd$dZd$dZd(dZd)dZd)dZd)dZd)dZd)dZd*dZd*dZeddddddd	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 d+d       Zed,d       Z e	 	 	 	 	 	 d-d        Z!e	 	 	 	 	 	 d.d!       Z" e# e$jJ                   e$jL                         "            Z'y)/_BaseUrlClassVar[UrlConstraints]_constraints_CoreUrl_urlc                j    t        | j                        j                  |      j                  | _        y rG   _build_type_adapter	__class__validate_pythonrs   rK   rY   s     rL   __init__z_BaseUrl.__init__   #    '7GGLQQ	rN   c                .    | j                   j                  S )zoThe scheme part of the URL.

        e.g. `https` in `https://user:pass@host:port/path?query#fragment`
        rs   schemerJ   s    rL   r~   z_BaseUrl.scheme        yyrN   c                .    | j                   j                  S )z{The username part of the URL, or `None`.

        e.g. `user` in `https://user:pass@host:port/path?query#fragment`
        )rs   usernamerJ   s    rL   r   z_BaseUrl.username        yy!!!rN   c                .    | j                   j                  S )z{The password part of the URL, or `None`.

        e.g. `pass` in `https://user:pass@host:port/path?query#fragment`
        )rs   passwordrJ   s    rL   r   z_BaseUrl.password   r   rN   c                .    | j                   j                  S )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`
        rs   hostrJ   s    rL   r   z_BaseUrl.host   s     yy~~rN   c                6    | j                   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`
        )rs   unicode_hostrJ   s    rL   r   z_BaseUrl.unicode_host   s     yy%%''rN   c                .    | j                   j                  S )zwThe port part of the URL, or `None`.

        e.g. `port` in `https://user:pass@host:port/path?query#fragment`
        )rs   portrJ   s    rL   r   z_BaseUrl.port        yy~~rN   c                .    | j                   j                  S )zxThe path part of the URL, or `None`.

        e.g. `/path` in `https://user:pass@host:port/path?query#fragment`
        rs   pathrJ   s    rL   r   z_BaseUrl.path   r   rN   c                .    | j                   j                  S )zyThe query part of the URL, or `None`.

        e.g. `query` in `https://user:pass@host:port/path?query#fragment`
        rs   queryrJ   s    rL   r   z_BaseUrl.query        yyrN   c                6    | j                   j                         S )zThe 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`
        rs   query_paramsrJ   s    rL   r   z_BaseUrl.query_params       
 yy%%''rN   c                .    | j                   j                  S )zThe fragment part of the URL, or `None`.

        e.g. `fragment` in `https://user:pass@host:port/path?query#fragment`
        rs   fragmentrJ   s    rL   r   z_BaseUrl.fragment   r   rN   c                6    | j                   j                         S )u  The 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`
        rs   unicode_stringrJ   s    rL   r   z_BaseUrl.unicode_string   s     yy''))rN   c                    t        |       S zThe URL's encoded string representation via __str__().

        This returns the punycode-encoded host version of the URL as a string.
        strrJ   s    rL   encoded_stringz_BaseUrl.encoded_string       
 4yrN   c                ,    t        | j                        S zDThe URL as a string, this will punycode encode the host if required.r   rs   rJ   s    rL   __str__z_BaseUrl.__str__       499~rN   c                `    | j                   j                   dt        | j                        dS N()rw   rg   r   rs   rJ   s    rL   __repr__z_BaseUrl.__repr__   )    ..))*!C		N+=Q??rN   c                8    | j                  | j                        S rG   rw   rs   rK   memos     rL   __deepcopy__z_BaseUrl.__deepcopy__       ~~dii((rN   c                h    | j                   |j                   u xr | j                  |j                  k(  S rG   r   rK   others     rL   __eq__z_BaseUrl.__eq__   '    ~~0LTYY%**5LLrN   c                h    | j                   |j                   u xr | j                  |j                  k  S rG   r   r   s     rL   __lt__z_BaseUrl.__lt__   '    ~~0KTYY5KKrN   c                h    | j                   |j                   u xr | j                  |j                  kD  S rG   r   r   s     rL   __gt__z_BaseUrl.__gt__   r   rN   c                h    | j                   |j                   u xr | j                  |j                  k  S rG   r   r   s     rL   __le__z_BaseUrl.__le__   r   rN   c                h    | j                   |j                   u xr | j                  |j                  k\  S rG   r   r   s     rL   __ge__z_BaseUrl.__ge__   r   rN   c                ,    t        | j                        S rG   rH   rs   rJ   s    rL   rM   z_BaseUrl.__hash__       DIIrN   c                >    t        t        | j                              S rG   lenr   rs   rJ   s    rL   __len__z_BaseUrl.__len__       3tyy>""rN   N)r   r   r   r   r   r   c               H     | t        j                  ||||||||            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   )rr   build)	clsr~   r   r   r   r   r   r   r   s	            rL   r   z_BaseUrl.build  s5    8 NN!!!	
 	
rN   c           	         t        ||       st        d|  dt        |       d| d      |j                  dk(  rt	        |      S |S Nz
Expected `z` but got `z` with value `'z-'` - serialized value may not be as expected.json
isinstancer   rV   moder   r   rY   infos      rL   serialize_urlz_BaseUrl.serialize_url+  R    #s#6SET#YKseKxy  99s8O
rN   c           	         fd}t        j                  |t        j                  di | j                  j                  t        j
                  | j                  dd            S )Nc                    t        |       r| S t        | t              rt        |       }  ||       }j                        }||_        |S rG   )r   ro   r   __new__rs   vhcore_urlinstancer\   s       rL   wrap_valz7_BaseUrl.__get_pydantic_core_schema__.<locals>.wrap_val9  sH    !V$!X&FtH~~f-H$HMOrN   Talwaysinfo_arg	when_usedrX   serializationrm   )r   no_info_wrap_validator_function
url_schemarq   rT   $plain_serializer_function_ser_schemar   r   r\   r]   r   s    `  rL   rb   z%_BaseUrl.__get_pydantic_core_schema__5  sX    	 ::))QC,<,<,P,PQ%JJ!!DH
 	
rN   c                0    |d   dk(  r|d   n|} ||      S NrV   rW   rX   rm   r   r   r]   inner_schemas       rL   __get_pydantic_json_schema__z%_BaseUrl.__get_pydantic_json_schema__K  (     1<F0C0V{8,\g|$$rN   r   )rY   zstr | _CoreUrl | _BaseUrlrd   Nonerd   r   rd   rB   )rd   r>   rd   zlist[tuple[str, str]]r   dictrd   r   r   r   rd   boolrc   )r~   r   r   rB   r   rB   r   r   r   r>   r   rB   r   rB   r   rB   rd   r   rY   r   r   zcore_schema.SerializationInford   z
str | Self)r\   ztype[_BaseUrl]r]   r   rd   rf   r   rf   r]   z._schema_generation_shared.GetJsonSchemaHandlerrd   r    )(rg   rh   ri   r+   rq   rk   rz   rl   r~   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   rM   r   classmethodr   r   rb   r   r   r   
any_schemato_string_ser_schema__pydantic_serializer__rm   rN   rL   ro   ro   {   s   -;-=L*=
NR     " " " "  (      ( " "*@)MLLMM# 
  $# #&
 &
 	&

 &
 &
 &
 &
 &
 &
 
&
 &
P   
#
.B
	
 
* %0%;i%	% % //E{/E/ETtT_TtTtTv/wxrN   ro   c            
         e Zd ZU  e       Zded<   ded<   ddZedd       Zedd       Z	edd       Z
dd	Zedd
       ZddZddZddZddZddZd dZd!dZd"dZd"dZeddddddddd	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 d#d       Zed$d       Ze	 	 	 	 	 	 d%d       Ze	 	 	 	 	 	 d&d       Z e ej:                   ej<                                     Zy)'_BaseMultiHostUrlrp   rq   _CoreMultiHostUrlrs   c                j    t        | j                        j                  |      j                  | _        y rG   ru   ry   s     rL   rz   z_BaseMultiHostUrl.__init__[  r{   rN   c                .    | j                   j                  S )zkThe scheme part of the URL.

        e.g. `https` in `https://foo.com,bar.com/path?query#fragment`
        r}   rJ   s    rL   r~   z_BaseMultiHostUrl.scheme^  r   rN   c                .    | j                   j                  S )ztThe path part of the URL, or `None`.

        e.g. `/path` in `https://foo.com,bar.com/path?query#fragment`
        r   rJ   s    rL   r   z_BaseMultiHostUrl.pathf  r   rN   c                .    | j                   j                  S )zuThe query part of the URL, or `None`.

        e.g. `query` in `https://foo.com,bar.com/path?query#fragment`
        r   rJ   s    rL   r   z_BaseMultiHostUrl.queryn  r   rN   c                6    | j                   j                         S )zThe query part of the URL as a list of key-value pairs.

        e.g. `[('foo', 'bar')]` in `https://foo.com,bar.com/path?foo=bar#fragment`
        r   rJ   s    rL   r   z_BaseMultiHostUrl.query_paramsv  r   rN   c                .    | j                   j                  S )z{The fragment part of the URL, or `None`.

        e.g. `fragment` in `https://foo.com,bar.com/path?query#fragment`
        r   rJ   s    rL   r   z_BaseMultiHostUrl.fragment}  r   rN   c                6    | j                   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.
        )rs   hostsrJ   s    rL   r  z_BaseMultiHostUrl.hosts  s    " yy  rN   c                    t        |       S r   r   rJ   s    rL   r   z _BaseMultiHostUrl.encoded_string  r   rN   c                6    | j                   j                         S )zXThe URL as a unicode string, unlike `__str__()` this will not punycode encode the hosts.r   rJ   s    rL   r   z _BaseMultiHostUrl.unicode_string  s    yy''))rN   c                ,    t        | j                        S r   r   rJ   s    rL   r   z_BaseMultiHostUrl.__str__  r   rN   c                `    | j                   j                   dt        | j                        dS r   r   rJ   s    rL   r   z_BaseMultiHostUrl.__repr__  r   rN   c                8    | j                  | j                        S rG   r   r   s     rL   r   z_BaseMultiHostUrl.__deepcopy__  r   rN   c                h    | j                   |j                   u xr | j                  |j                  k(  S rG   r   r   s     rL   r   z_BaseMultiHostUrl.__eq__  r   rN   c                ,    t        | j                        S rG   r   rJ   s    rL   rM   z_BaseMultiHostUrl.__hash__  r   rN   c                >    t        t        | j                              S rG   r   rJ   s    rL   r   z_BaseMultiHostUrl.__len__  r   rN   N)r  r   r   r   r   r   r   r   c       	        J     | t        j                  |||||||||		            S )a  Build 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~   r  r   r   r   r   r   r   r   )r  r   )
r   r~   r  r   r   r   r   r   r   r   s
             rL   r   z_BaseMultiHostUrl.build  s;    B ##!!!

 	
rN   c           	         t        ||       st        d|  dt        |       d| d      |j                  dk(  rt	        |      S |S r   r   r   s      rL   r   z_BaseMultiHostUrl.serialize_url  r   rN   c           	         fd}t        j                  |t        j                  di | j                  j                  t        j
                  | j                  dd            S )Nc                    t        |       r| S t        | t              rt        |       }  ||       }j                        }||_        |S rG   )r   r  r   r   rs   r   s       rL   r   z@_BaseMultiHostUrl.__get_pydantic_core_schema__.<locals>.wrap_val  sI    !V$!./FtH~~f-H$HMOrN   Tr   r   r   rm   )r   r   multi_host_url_schemarq   rT   r   r   r   s    `  rL   rb   z._BaseMultiHostUrl.__get_pydantic_core_schema__  sX    	 ::44\s7G7G7[7[\%JJ!!DH
 	
rN   c                0    |d   dk(  r|d   n|} ||      S r   rm   r   s       rL   r   z._BaseMultiHostUrl.__get_pydantic_json_schema__  r   rN   r   )rY   z+str | _CoreMultiHostUrl | _BaseMultiHostUrlrd   r   r   r   r   )rd   zlist[MultiHostHost]r   r   rc   )r~   r   r  zlist[MultiHostHost] | Noner   rB   r   rB   r   rB   r   r>   r   rB   r   rB   r   rB   rd   r   r   )r\   ztype[_BaseMultiHostUrl]r]   r   rd   rf   r   ) rg   rh   ri   r+   rq   rk   rz   rl   r~   r   r   r   r   r  r   r   r   r   r   r   rM   r   r   r   r   rb   r   r   r   r   r   r   rm   rN   rL   r  r  W  s   -;-=L*=
R        ( " "!&*@)M# 
 -1## #,
 ,
 *	,

 ,
 ,
 ,
 ,
 ,
 ,
 ,
 
,
 ,
\   
,
7K
	
 
* %0%;i%	% % //E{/E/ETtT_TtTtTv/wxrN   r  c                    t        |       S rG   r!   )r   s    rL   rv   rv     s    srN   c                      e Zd ZdZy)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)rg   rh   ri   rj   rm   rN   rL   r$   r$     s    rN   r$   c                  &    e Zd ZdZ eddg      Zy)r%   zcA type that will accept any http or https URL.

    * TLD not required
    * Host not required
    httphttpsr@   Nrg   rh   ri   rj   r+   rq   rm   rN   rL   r%   r%   /  s     "672CDLrN   r%   c                  (    e Zd ZdZ edddg      Zy)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?   r@   Nr   rm   rN   rL   r(   r(   9  s    KZ "TFGCTULrN   r(   c                  &    e Zd ZdZ eddg      Zy)r*   z_A type that will accept any ws or wss URL.

    * TLD not required
    * Host not required
    wswssr  Nr   rm   rN   rL   r*   r*     s     "4-@LrN   r*   c                  (    e Zd ZdZ edddg      Zy)r)   zuA type that will accept any ws or wss URL.

    * TLD not required
    * Host not required
    * Max length 2083
    r"  r%  r&  r#  Nr   rm   rN   rL   r)   r)     s     "TD%=QLrN   r)   c                  $    e Zd ZdZ edg      Zy)r&   zCA type that will accept any file URL.

    * Host not required
    filer  Nr   rm   rN   rL   r&   r&     s    
 "6(;LrN   r&   c                  $    e Zd ZdZ edg      Zy)r'   zUA type that will accept ftp URL.

    * TLD not required
    * Host not required
    ftpr  Nr   rm   rN   rL   r'   r'     s     "5':LrN   r'   c                  :    e Zd ZdZ edg d      Zedd       Zy)r1   a:  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
postgresqlzpostgresql+asyncpgzpostgresql+pg8000zpostgresql+psycopgzpostgresql+psycopg2zpostgresql+psycopg2cffizpostgresql+py-postgresqlzpostgresql+pygresqlrA   r@   c                .    | j                   j                  S zThe required URL host.r   rJ   s    rL   r   zPostgresDsn.host       yy~~rN   Nr   rg   rh   ri   rj   r+   rq   rl   r   rm   rN   rL   r1   r1     s0    9v "

L  rN   r1   c                  :    e Zd ZdZ edg d      Zedd       Zy)r2   ztA type that will accept any Cockroach DSN.

    * User info required
    * TLD not required
    * Host required
    T)cockroachdbzcockroachdb+psycopg2zcockroachdb+asyncpgr/  c                .    | j                   j                  S r1  r   rJ   s    rL   r   zCockroachDsn.host  r2  rN   Nr   r3  rm   rN   rL   r2   r2     s/     "
L  rN   r2   c                  &    e Zd ZdZ eddg      Zy)r3   zsA type that will accept any AMQP DSN.

    * User info required
    * TLD not required
    * Host not required
    amqpamqpsr  Nr   rm   rN   rL   r3   r3     s     "672CDLrN   r3   c                  @    e Zd ZdZ eddgdddd      Zedd	       Zy
)r4   zA 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)r@   rC   rD   rE   rA   c                .    | j                   j                  S r1  r   rJ   s    rL   r   zRedisDsn.host5  r2  rN   Nr   r3  rm   rN   rL   r4   r4   %  s;     " (+ L  rN   r4   c                  (    e Zd ZdZ eddgd      Zy)r5   zA 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+srvii  r@   rD   Nr   rm   rN   rL   r5   r5   ;  s     "9m2L[`aLrN   r5   c                  (    e Zd ZdZ edgdd      Zy)r6   ztA type that will accept any Kafka DSN.

    * User info required
    * TLD not required
    * Host not required
    kafkar=  i#  r@   rC   rD   Nr   rm   rN   rL   r6   r6   G  s     "7)+dhiLrN   r6   c                  *    e Zd ZdZ eg ddd      Zy)r7   aL  A 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%  r&  r=  i~  rD  Nr   rm   rN   rL   r7   r7   R  s     "4;]aLrN   r7   c                  *    e Zd ZdZ eg ddd      Zy)r9   ztA type that will accept any MySQL DSN.

    * User info required
    * TLD not required
    * Host not required
    )mysqlzmysql+mysqlconnectorzmysql+aiomysqlzmysql+asyncmyzmysql+mysqldbzmysql+pymysqlzmysql+cymysqlzmysql+pyodbc  T)r@   rD   rA   Nr   rm   rN   rL   r9   r9   `  s      "	
 LrN   r9   c                  (    e Zd ZdZ eg dd      Zy)r:   zvA type that will accept any MariaDB DSN.

    * User info required
    * TLD not required
    * Host not required
    )mariadbzmariadb+mariadbconnectorzmariadb+pymysqlrJ  rA  Nr   rm   rN   rL   r:   r:   x  s     "RLrN   r:   c                  *    e Zd ZdZ eg ddd      Zy)r;   zyA type that will accept any ClickHouse DSN.

    * User info required
    * TLD not required
    * Host not required
    )zclickhouse+nativezclickhouse+asynchzclickhouse+http
clickhouseclickhousesclickhousedbr=  i(#  rD  Nr   rm   rN   rL   r;   r;     s      "
 !LrN   r;   c                  8    e Zd ZdZ edgd      Zedd       Zy)r<   ztA type that will accept any Snowflake DSN.

    * User info required
    * TLD not required
    * Host required
    	snowflakeT)r@   rA   c                .    | j                   j                  S r1  r   rJ   s    rL   r   zSnowflakeDsn.host  r2  rN   Nr   r3  rm   rN   rL   r<   r<     s/     "$L
  rN   r<   c                     	 dd l a t        d      j                  d      d   dk(  st        d      y # t        $ r} t        d      | d } ~ ww xY w)Nr   zCemail-validator is not installed, run `pip install pydantic[email]`zemail-validator.2zKemail-validator version >= 2.0 required, run pip install -U email-validator)email_validatorImportErrorr   	partition)es    rL   import_email_validatorr[    s_    h $%//4Q73>ghh ?  h_`fgghs   2 	AAA.c                  ^    e Zd ZdZe	 	 	 	 	 	 dd       Ze	 	 	 	 	 	 dd       Zedd       Zy)	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'
        ```
        c                z    t                t        j                  | j                  t        j                               S rG   )r[  r    no_info_after_validator_function	_validate
str_schemar   _source_handlers      rL   rb   z%EmailStr.__get_pydantic_core_schema__  s*     #$??{OeOeOghhrN   c                <     ||      }|j                  dd       |S )NstringemailrV   formatupdater   r   r]   field_schemas       rL   r   z%EmailStr.__get_pydantic_json_schema__  s'     #;/LXg>rN   c                   t        |      d   S )Nr   )r8   r   input_values     rL   r_  zEmailStr._validate  s    !+.q11rN   Nrb  z	type[Any]rc  r   rd   rf   r   )ro  r   rd   r   )rg   rh   ri   rj   r   rb   r   r_  rm   rN   rL   r,   r,     s|    	, 
	i	i +	i $		i 
	i 
	 4	 ?m	 	  
	  
	2 
	2rN   r,   c                  z    e Zd ZdZdZd
dZddZe	 	 	 	 	 	 dd       Ze	 	 	 	 	 	 dd       Z	edd       Z
ddZy	)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
    ```
    rQ   rf  c                     || _         || _        y rG   rr  )rK   rQ   rf  s      rL   rz   zNameEmail.__init__  s    	
rN   c                    t        |t              xr1 | j                  | j                  f|j                  |j                  fk(  S rG   )r   r-   rQ   rf  r   s     rL   r   zNameEmail.__eq__  s6    %+dDJJ0GEJJX]XcXcKd0ddrN   c                <     ||      }|j                  dd       |S )Nre  z
name-emailrg  ri  rk  s       rL   r   z&NameEmail.__get_pydantic_json_schema__  s'     {+,?rN   c                D   t                t        j                  | j                  t        j                  t        j
                         t        j                  t        j                  |       t        j
                         gdd      t        j                                     S )Nname_email_typezInput is not a valid NameEmail)custom_error_typecustom_error_message)json_schemapython_schemar   )	r[  r   r^  r_  json_or_python_schemar`  union_schemais_instance_schemar   ra  s      rL   rb   z&NameEmail.__get_pydantic_core_schema__  s|     	 ;;MM--'224)66 33C8+:P:P:RS&7)I
 *>>@
 	
rN   c               T    t        |t              rt        |      \  }} | ||      S |S rG   )r   r   r8   )r   ro  rQ   rf  s       rL   r_  zNameEmail._validate4  s-    k3'(5KD%tU##rN   c                    d| j                   v rd| j                    d| j                   dS | j                    d| j                   dS )N@"z" <>z <rr  rJ   s    rL   r   zNameEmail.__str__<  sF    $))tyykTZZL22))Btzzl!,,rN   N)rQ   r   rf  r   r   r   rp  )ro  z
Self | strrd   r   r   )rg   rh   ri   rj   	__slots__rz   r   r   r   rb   r_  r   rm   rN   rL   r-   r-     s    !F  Ie 0;i	  

 '
 
 	
 
(  -rN   r-   zIPv4Address | IPv6AddressIPvAnyAddressTypezIPv4Interface | IPv6InterfaceIPvAnyInterfaceTypezIPv4Network | IPv6NetworkIPvAnyNetworkTypec                  j    e Zd ZdZdZddZe	 	 	 	 	 	 d	d       Ze	 	 	 	 	 	 d
d       Zedd       Z	y)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',
                }
            ]
            '''
        ```
        rm   c                    	 t        |      S # t        $ r Y nw xY w	 t        |      S # t        $ r t        dd      w xY w)z!Validate an IPv4 or IPv6 address.ip_any_addressz)value is not a valid IPv4 or IPv6 address)r   
ValueErrorr
   r   r   rS   s     rL   r   zIPvAnyAddress.__new__m  sU    "5)) i"5)) i)*:<ghhi   
 	
( >c                0    i }|j                  dd       |S )Nre  ipvanyaddressrg  ri  rk  s       rL   r   z*IPvAnyAddress.__get_pydantic_json_schema__y  "     LXoFrN   c                h    t        j                  | j                  t        j                               S Nr   r    no_info_plain_validator_functionr_  r   ra  s      rL   rb   z*IPvAnyAddress.__get_pydantic_core_schema__  )     ??[-M-M-O rN   c                    | |      S rG   rm   rn  s     rL   r_  zIPvAnyAddress._validate      {##rN   N)rS   r   rd   r  r   rp  )ro  r   rd   r  
rg   rh   ri   rj   r  r   r   r   rb   r_  rm   rN   rL   r.   r.   M  s    	: 	
	i 
	 4	 ?m	 	  
	  
		 +	 $		 
	 
	$ 
	$rN   r.   c                  j    e Zd ZdZdZddZe	 	 	 	 	 	 d	d       Ze	 	 	 	 	 	 d
d       Zedd       Z	y)r/   #Validate an IPv4 or IPv6 interface.rm   c                    	 t        |      S # t        $ r Y nw xY w	 t        |      S # t        $ r t        dd      w xY w)r  ip_any_interfacez+value is not a valid IPv4 or IPv6 interface)r   r  r   r   r  s     rL   r   zIPvAnyInterface.__new__  sU    $U++ m$U++ m)*<>kllmr  c                0    i }|j                  dd       |S )Nre  ipvanyinterfacerg  ri  rk  s       rL   r   z,IPvAnyInterface.__get_pydantic_json_schema__  s#     LX6GHrN   c                h    t        j                  | j                  t        j                               S r  r  ra  s      rL   rb   z,IPvAnyInterface.__get_pydantic_core_schema__  r  rN   c                    | |      S rG   rm   rn  s     rL   r_  zIPvAnyInterface._validate  r  rN   N)rS   r#   rd   r  r   rp  )ro  r#   rd   r  r  rm   rN   rL   r/   r/     s    1	
	m 
	 4	 ?m	 	  
	  
		 +	 $		 
	 
	$ 
	$rN   r/   c                  j    e Zd ZdZdZddZe	 	 	 	 	 	 d	d       Ze	 	 	 	 	 	 d
d       Zedd       Z	y)r0   !Validate an IPv4 or IPv6 network.rm   c                    	 t        |      S # t        $ r Y nw xY w	 t        |      S # t        $ r t        dd      w xY w)r  ip_any_networkz)value is not a valid IPv4 or IPv6 network)r	   r  r   r   r  s     rL   r   zIPvAnyNetwork.__new__  sU    "5)) i"5)) i)*:<ghhir  c                0    i }|j                  dd       |S )Nre  ipvanynetworkrg  ri  rk  s       rL   r   z*IPvAnyNetwork.__get_pydantic_json_schema__  r  rN   c                h    t        j                  | j                  t        j                               S r  r  ra  s      rL   rb   z*IPvAnyNetwork.__get_pydantic_core_schema__  r  rN   c                    | |      S rG   rm   rn  s     rL   r_  zIPvAnyNetwork._validate  r  rN   N)rS   r#   rd   r  r   rp  )ro  r#   rd   r  r  rm   rN   rL   r0   r0     s    /		i 
	 4	 ?m	 	  
	  
		 +	 $		 
	 
	$ 
	$rN   r0   c            	     ^    d} d|  d|  d}d}d}t        j                  d| 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       rL   _build_pretty_email_regexr    sP    -J!*VJ<rB+K:: 34A6G5Hk]Z]^__rN   i   c           
        t         
t                t        |       t        kD  rt	        ddddt         di      t
        j                  |       }d}|r|j                         \  }}} |xs |}| j                         }	 t        j                  |d      }|j                  }|J |xs |j                  }||fS # t         j                  $ r+}t	        dddt        |j                  d	         i      |d}~ww xY w)
aU  Email 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}reasonzLength must not exceed z charactersF)check_deliverabilityr   )rW  r[  r   MAX_EMAIL_LENGTHr   pretty_email_regex	fullmatchgroupsstripr8   EmailNotValidErrorr   args
normalized
local_part)rS   mrQ   unquoted_namequoted_namerf  partsrZ  s           rL   r8   r8     s   "  
5z$$!:01A0B+NO
 	
 	$$U+AD,-HHJ){E+KKME..u5Q E#5##D; -- !IHVYZ[Z`Z`abZcVdKe
	s   >B9 9C7&C22C7)r   z"type[_BaseUrl | _BaseMultiHostUrl]rd   r"   )rd   r   )rd   zre.Pattern[str])rS   r   rd   ztuple[str, str])^rj   
__future__r   _annotationsdataclasses_dataclassesr  r   	functoolsr   importlib.metadatar   	ipaddressr   r   r	   r
   r   r   typingr   r   r   r   pydantic_corer   r   r   r   r   r   r  r   rr   typing_extensionsr   r   pydantic.errorsr   	_internalr   r   
_migrationr   annotated_handlersr   rz  r    type_adapterr"   rW  r#   rk   __all__	dataclassr+   ro   r  rv   r$   r%   r(   r*   r)   r&   r'   r1   r2   r3   r4   r5   r6   r7   r9   r:   r;   r<   r[  r   r,   Representationr-   r  r  r  r.   r/   r0   r  r  r  r8   rg   __getattr__rm   rN   rL   <module>r     sk   K 2 " 	   & f f : :  < ) - - 7 ) 4 ( %VKV O: 1 1 1hYy Yyxwy wyt  X 2E ENVf NVbA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 *2ZV-$$ V-r  ; 9 :!@ Y @: 9 :%M)O%M@$ @$D%$ %$N'$ '$T` /0  
-`  )rN   