fL is8UdZddlmZddlZddlZddlmZddlm Z ddl m Z ddl m Z mZmZmZmZmZddlmZmZmZmZdd lmZmZmZmZmZdd lmZdd lm Z!dd l"m#Z#m$Z$dd l%m&Z&ddl'm(Z(m)Z)ddl*m+Z+ddl,m-Z-ddl.m/Z/ddl0m1Z1er ddl2a2dZ3de4d<nda2gdZ5ejlGddZ7GddZ8GddZ9e dXdZ:Gdd e8Z;Gd!d"e;Z<Gd#d$e;Z=Gd%d&e;Z>Gd'd(e;Z?Gd)d*e;Z@Gd+d,e;ZAGd-d.e9ZBGd/d0e;ZCGd1d2e;ZDGd3d4e;ZEGd5d6e9ZFGd7d8e;ZGGd9d:e9ZHGd;de;ZJGd?d@e;ZKGdAdBe;ZLdYdCZMereeNdDfZOn GdEdFZOGdGdHe(jZQdIZRde4dJ<dKZSde4dL<dMZTde4dN<ereRZUeSZVeTZWnGdOdPZUGdQdRZVGdSdTZWdZdUZXeXZYdVZZ d[dWZ[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 AnnotatedAnyClassVar) MultiHostHostPydanticCustomError$PydanticSerializationUnexpectedValueSchemaSerializer 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 AnyHttpUrlFileUrlFtpUrlHttpUrl WebsocketUrlAnyWebsocketUrlUrlConstraintsEmailStr NameEmail IPvAnyAddressIPvAnyInterface IPvAnyNetwork PostgresDsn CockroachDsnAmqpDsnRedisDsnMongoDsnKafkaDsnNatsDsnvalidate_emailMySQLDsn MariaDBDsn ClickHouseDsn SnowflakeDsnceZdZUdZdZded<dZded<dZded<dZd ed <dZ ded <dZ d ed <dZ ded <ddZ e ddZddZy)r+aUrl 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`. preserve_empty_path: Whether to preserve empty URL paths. Defaults to `None`. N int | None max_lengthzlist[str] | Noneallowed_schemesz bool | None host_required str | None default_host default_port default_pathpreserve_empty_pathc t|j|jt|jnd|j|j |j |j|jfSN) hashr?r@tuplerArCrDrErFselfs W/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/pydantic/networks.py__hash__zUrlConstraints.__hash__\sd/3/C/C/Od**+UY""!!!!!!((   ct|Dcic](}t||jx}|j|*c}Scc}w)zeFetch a key / value mapping of constraints to values that are not None. Used for core schema updates.)rgetattrname)rLfieldvalues rMdefined_constraintsz"UrlConstraints.defined_constraintsis>06d|peQUW\WaWaIb@b?o E!ppps>>c||}|ddk(r|dn|}|ddvx}rtd|dd|jjD] \}}|||< |S) Ntype function-wrapschema)urlzmulti-host-urlz"'UrlConstraints' cannot annotate 'z'.zinvalid-annotated-type)code)rrUitems)rLsourcehandlerrYschema_to_mutateannotated_typeconstraint_keyconstraint_values rM__get_pydantic_core_schema__z+UrlConstraints.__get_pydantic_core_schema__ns 06f~/P6(+V\-f5=VV V> V#4^4DBGNf 150H0H0N0N0P @ ,N,/? ^ , @ rOreturnint)rezdict[str, Any])r]rr^rrecore_schema.CoreSchema)__name__ __module__ __qualname____doc__r?__annotations__r@rArCrDrErFrNpropertyrUrcrOrMr+r+Fsq "J !(,O%,!%M;%#L*##L*##L*#'++  qq rOr+ceZdZUeZded<ded<d#dZed$dZed%dZ ed%dZ ed%d Z d%d Z ed&d Z ed%d Zed%d Zd'dZed%dZd$dZd$dZd$dZd$dZd(dZd)dZd)dZd)dZd)dZd)dZd*dZd*dZeddddddd d+dZed,dZ e d-d Z!e d.d!Z"e#e$jJe$jL"Z'y)/_BaseUrlClassVar[UrlConstraints] _constraints_CoreUrl_urlcjt|jj|j|_yrH_build_type_adapter __class__validate_pythonrtrLrZs rM__init__z_BaseUrl.__init__#'7GGLQQ rOc.|jjS)zoThe scheme part of the URL. e.g. `https` in `https://user:pass@host:port/path?query#fragment` rtschemerKs rMrz_BaseUrl.scheme yyrOc.|jjS)z{The username part of the URL, or `None`. e.g. `user` in `https://user:pass@host:port/path?query#fragment` )rtusernamerKs rMrz_BaseUrl.username yy!!!rOc.|jjS)z{The password part of the URL, or `None`. e.g. `pass` in `https://user:pass@host:port/path?query#fragment` )rtpasswordrKs rMrz_BaseUrl.passwordrrOc.|jjS)uThe 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` rthostrKs rMrz _BaseUrl.hostsyy~~rOc6|jjS)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` )rt unicode_hostrKs rMrz_BaseUrl.unicode_hostsyy%%''rOc.|jjS)zwThe port part of the URL, or `None`. e.g. `port` in `https://user:pass@host:port/path?query#fragment` )rtportrKs rMrz _BaseUrl.port yy~~rOc.|jjS)zxThe path part of the URL, or `None`. e.g. `/path` in `https://user:pass@host:port/path?query#fragment` rtpathrKs rMrz _BaseUrl.pathrrOc.|jjS)zyThe query part of the URL, or `None`. e.g. `query` in `https://user:pass@host:port/path?query#fragment` rtqueryrKs rMrz_BaseUrl.query yyrOc6|jjS)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` rt query_paramsrKs rMrz_BaseUrl.query_params yy%%''rOc.|jjS)zThe fragment part of the URL, or `None`. e.g. `fragment` in `https://user:pass@host:port/path?query#fragment` rtfragmentrKs rMrz_BaseUrl.fragmentrrOc6|jjS)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` rtunicode_stringrKs rMrz_BaseUrl.unicode_strings yy''))rOct|SzThe URL's encoded string representation via __str__(). This returns the punycode-encoded host version of the URL as a string. strrKs rMencoded_stringz_BaseUrl.encoded_string 4yrOc,t|jSzDThe URL as a string, this will punycode encode the host if required.rrtrKs rM__str__z_BaseUrl.__str__499~rOc`|jjdt|jdSN()rxrhrrtrKs rM__repr__z_BaseUrl.__repr__)..))*!C N+=Q??rOc8|j|jSrHrxrtrLmemos rM __deepcopy__z_BaseUrl.__deepcopy__~~dii((rOch|j|juxr|j|jk(SrHrrLothers rM__eq__z_BaseUrl.__eq__'~~0LTYY%**5LLrOch|j|juxr|j|jkSrHrrs rM__lt__z_BaseUrl.__lt__'~~0KTYY5KKrOch|j|juxr|j|jkDSrHrrs rM__gt__z_BaseUrl.__gt__rrOch|j|juxr|j|jkSrHrrs rM__le__z_BaseUrl.__le__rrOch|j|juxr|j|jk\SrHrrs rM__ge__z_BaseUrl.__ge__rrOc,t|jSrHrIrtrKs rMrNz_BaseUrl.__hash__DIIrOc>tt|jSrHlenrrtrKs rM__len__z_BaseUrl.__len__3tyy>""rON)rrrrrrc H|tj||||||||S)aBuild 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 )rrrrrrrr)rsbuild) clsrrrrrrrrs rMrz_BaseUrl.builds58 NN!!!   rOc t||std|dt|d|d|jdk(r t |S|SNz Expected `z ` but got `z` with value `'z-'` - serialized value may not be as expected.json isinstancerrWmoderrrZinfos rM serialize_urlz_BaseUrl.serialize_url.R#s#6SET#YKseKxy  99 s8O rOc fd}tj|tjdi|jjtj |j ddS)Nct|r|St|tr t|}||}j}||_|SrH)rrpr__new__rtvhcore_urlinstancer]s rMwrap_valz7_BaseUrl.__get_pydantic_core_schema__..wrap_val<sH!V$!X&FtH~~f-H$HMOrOTalwaysinfo_arg when_usedrY serializationrn)rno_info_wrap_validator_function url_schemarrrU$plain_serializer_function_ser_schemarrr]r^rs ` rMrcz%_BaseUrl.__get_pydantic_core_schema__8sX :: ))QC,<,<,P,PQ%JJ!!DH  rOc0|ddk(r|dn|}||SNrWrXrYrnrrr^ inner_schemas rM__get_pydantic_json_schema__z%_BaseUrl.__get_pydantic_json_schema__N( 1rezlist[tuple[str, str]]rdictrerrrreboolrd)rrrrBrrBrrrr>rrBrrBrrBrerrZrrzcore_schema.SerializationInforez str | Self)r]ztype[_BaseUrl]r^rrergrrgr^z._schema_generation_shared.GetJsonSchemaHandlerrer )(rhrirjr+rrrlr{rmrrrrrrrrrrrrrrrrrrrrrNr classmethodrrrcrrr any_schemato_string_ser_schema__pydantic_serializer__rnrOrMrprp~s-;-=L*= NR  """"((""*@)MLLMM# $# #& &  &  &  & & & & &  & & P # .B   *%0%;i% %%//E{/E/ETtT_TtTtTv/wxrOrpc eZdZUeZded<ded<ddZeddZeddZ eddZ dd Z edd Z dd Z dd Zdd ZddZddZd dZd!dZd"dZd"dZeddddddddd d#dZed$dZe d%dZe d&dZeej:ej<Zy)'_BaseMultiHostUrlrqrr_CoreMultiHostUrlrtcjt|jj|j|_yrHrvrzs rMr{z_BaseMultiHostUrl.__init__^r|rOc.|jjS)zkThe scheme part of the URL. e.g. `https` in `https://foo.com,bar.com/path?query#fragment` r~rKs rMrz_BaseMultiHostUrl.schemearrOc.|jjS)ztThe path part of the URL, or `None`. e.g. `/path` in `https://foo.com,bar.com/path?query#fragment` rrKs rMrz_BaseMultiHostUrl.pathirrOc.|jjS)zuThe query part of the URL, or `None`. e.g. `query` in `https://foo.com,bar.com/path?query#fragment` rrKs rMrz_BaseMultiHostUrl.queryqrrOc6|jjS)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` rrKs rMrz_BaseMultiHostUrl.query_paramsyrrOc.|jjS)z{The fragment part of the URL, or `None`. e.g. `fragment` in `https://foo.com,bar.com/path?query#fragment` rrKs rMrz_BaseMultiHostUrl.fragmentrrOc6|jjS)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. )rthostsrKs rMr z_BaseMultiHostUrl.hostss"yy  rOct|SrrrKs rMrz _BaseMultiHostUrl.encoded_stringrrOc6|jjS)zXThe URL as a unicode string, unlike `__str__()` this will not punycode encode the hosts.rrKs rMrz _BaseMultiHostUrl.unicode_stringsyy''))rOc,t|jSrrrKs rMrz_BaseMultiHostUrl.__str__rrOc`|jjdt|jdSrrrKs rMrz_BaseMultiHostUrl.__repr__rrOc8|j|jSrHrrs rMrz_BaseMultiHostUrl.__deepcopy__rrOch|j|juxr|j|jk(SrHrrs rMrz_BaseMultiHostUrl.__eq__rrOc,t|jSrHrrKs rMrNz_BaseMultiHostUrl.__hash__rrOc>tt|jSrHrrKs rMrz_BaseMultiHostUrl.__len__rrON)r rrrrrrrc J|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` ) rr rrrrrrr)rr) rrr rrrrrrrs rMrz_BaseMultiHostUrl.builds;B  # #!!!   rOc t||std|dt|d|d|jdk(r t |S|Srrrs rMrz_BaseMultiHostUrl.serialize_urlrrOc fd}tj|tjdi|jjtj |j ddS)Nct|r|St|tr t|}||}j}||_|SrH)rrrrrtrs rMrz@_BaseMultiHostUrl.__get_pydantic_core_schema__..wrap_valsI!V$!./FtH~~f-H$HMOrOTrrrrn)rrmulti_host_url_schemarrrUrrrs ` rMrcz._BaseMultiHostUrl.__get_pydantic_core_schema__sX :: 44\s7G7G7[7[\%JJ!!DH  rOc0|ddk(r|dn|}||Srrnrs rMrz._BaseMultiHostUrl.__get_pydantic_json_schema__rrOr)rZz+str | _CoreMultiHostUrl | _BaseMultiHostUrlrerrrr)rezlist[MultiHostHost]rrrd)rrr zlist[MultiHostHost] | NonerrBrrBrrBrr>rrBrrBrrBrerr)r]ztype[_BaseMultiHostUrl]r^rrergr) rhrirjr+rrrlr{rmrrrrrr rrrrrrrNrrrrrcrrrrrrrnrOrMrrZs-;-=L*= R  (""!&*@)M# -1## #, , * ,  ,  , , , , , ,  , , \ , 7K   *%0%;i% %%//E{/E/ETtT_TtTtTv/wxrOrct|SrHr!)rs rMrwrws s rOceZdZdZy)r$aBase 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)rhrirjrkrnrOrMr$r$srOr$c&eZdZdZeddgZy)r%zcA type that will accept any http or https URL. * TLD not required * Host not required httphttpsr@Nrhrirjrkr+rrrnrOrMr%r%2s "672CDLrOr%c(eZdZdZedddgZy)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. #rrr?r@Nr!rnrOrMr(r(<sKZ"TFGCTULrOr(c&eZdZdZeddgZy)r*z_A type that will accept any ws or wss URL. * TLD not required * Host not required wswssr Nr!rnrOrMr*r*s "4-@LrOr*c(eZdZdZedddgZy)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!rnrOrMr)r)s"TD%=QLrOr)c$eZdZdZedgZy)r&zCA type that will accept any file URL. * Host not required filer Nr!rnrOrMr&r&s "6(;LrOr&c$eZdZdZedgZy)r'zUA type that will accept ftp URL. * TLD not required * Host not required ftpr Nr!rnrOrMr'r's "5':LrOr'c:eZdZdZedgdZeddZy)r1a: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+pygresqlrAr@c.|jjSzThe required URL host.rrKs rMrzPostgresDsn.hostyy~~rONrrhrirjrkr+rrrmrrnrOrMr1r1s09v"   LrOr1c:eZdZdZedgdZeddZy)r2ztA type that will accept any Cockroach DSN. * User info required * TLD not required * Host required T) cockroachdbzcockroachdb+psycopg2zcockroachdb+asyncpgr0c.|jjSr2rrKs rMrzCockroachDsn.hostr3rONrr4rnrOrMr2r2s/" LrOr2c&eZdZdZeddgZy)r3zsA type that will accept any AMQP DSN. * User info required * TLD not required * Host not required amqpamqpsr Nr!rnrOrMr3r3s"672CDLrOr3c@eZdZdZeddgddddZed d Zy ) r4zA type that will accept any Redis DSN. * User info required * TLD not required * Host required (e.g., `rediss://:pass@localhost`) redisrediss localhostiz/0T)r@rCrDrErAc.|jjSr2rrKs rMrz RedisDsn.host8r3rONrr4rnrOrMr4r4(s;" (+  LrOr4c(eZdZdZeddgdZy)r5aA 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`). !!! warning If a port isn't specified, the default MongoDB port `27017` will be used. If this behavior is undesirable, you can use the following: ```python from typing import Annotated from pydantic import UrlConstraints from pydantic_core import MultiHostUrl MongoDsnNoDefaultPort = Annotated[ MultiHostUrl, UrlConstraints(allowed_schemes=['mongodb', 'mongodb+srv']), ] ``` mongodbz mongodb+srviir@rDNr!rnrOrMr5r5>s0"9m2L[`aLrOr5c(eZdZdZedgddZy)r6ztA type that will accept any Kafka DSN. * User info required * TLD not required * Host not required kafkar>i#r@rCrDNr!rnrOrMr6r6Zs"7)+dhiLrOr6c*eZdZdZegdddZy)r7aLA 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 )natstlsr&r'r>i~rENr!rnrOrMr7r7es"4;]aLrOr7c*eZdZdZegdddZy)r9ztA 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)r@rDrANr!rnrOrMr9r9ss "   LrOr9c(eZdZdZegddZy)r:zvA type that will accept any MariaDB DSN. * User info required * TLD not required * Host not required )mariadbzmariadb+mariadbconnectorzmariadb+pymysqlrKrBNr!rnrOrMr:r:s"RLrOr:c*eZdZdZegdddZy)r;zyA type that will accept any ClickHouse DSN. * User info required * TLD not required * Host not required )zclickhouse+nativezclickhouse+asynchzclickhouse+http clickhouse clickhouses clickhousedbr>i(#rENr!rnrOrMr;r;s " ! LrOr;c8eZdZdZedgdZeddZy)r<ztA type that will accept any Snowflake DSN. * User info required * TLD not required * Host required snowflakeT)r@rAc.|jjSr2rrKs rMrzSnowflakeDsn.hostr3rONrr4rnrOrMr<r<s/"$ L rOr<c ddlatdjdddk(s tdy#t$r}td|d}~wwxYw)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 rMimport_email_validatorr\s_j $ % / / 4Q 73 >ghh ? jabhiijs2 A  AA .c^eZdZdZe ddZe ddZeddZy) 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' ``` czttj|jtjSrH)r\r no_info_after_validator_function _validate str_schemar_source_handlers rMrcz%EmailStr.__get_pydantic_core_schema__s* # $?? {OeOeOgh hrOc<||}|jdd|S)NstringemailrWformatupdaterrr^ field_schemas rMrz%EmailStr.__get_pydantic_json_schema__s'#;/L   Xg  > rOct|dS)Nr)r8r input_values rMr`zEmailStr._validates!+.q1 1rONrcz type[Any]rdrrergr)rprrer)rhrirjrkrrcrr`rnrOrMr,r,s| ,  i i+ i$  i  i  4 ?m      2  2rOr,czeZdZdZdZd dZd dZe d dZe d dZ eddZ ddZ 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 ') print(user.email) #> Fred Bloggs print(user.email.name) #> Fred Bloggs user = User(email='fred.bloggs@example.com') print(user.email) #> fred.bloggs print(user.email.name) #> fred.bloggs ``` rRrgc ||_||_yrHrs)rLrRrgs rMr{zNameEmail.__init__#s  rOct|txr1|j|jf|j|jfk(SrH)rr-rRrgrs rMrzNameEmail.__eq__'s6%+dDJJ0GEJJX]XcXcKd0ddrOc<||}|jdd|S)Nrfz name-emailrhrjrls rMrz&NameEmail.__get_pydantic_json_schema__*s'{+ ,?rOc Dttj|jtjtj tj tj|tj gddtjS)Nname_email_typezInput is not a valid NameEmail)custom_error_typecustom_error_message) json_schema python_schemar) r\rr_r`json_or_python_schemara union_schemais_instance_schemarrbs rMrcz&NameEmail.__get_pydantic_core_schema__2s|  ;; MM  - -'224)66 33C8+:P:P:RS&7)I *>>@   rOcTt|trt|\}}|||S|SrH)rrr8)rrprRrgs rMr`zNameEmail._validateGs- k3 '(5KD%tU# # rOcd|jvrd|jd|jdS|jd|jdS)N@"z" <>z 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', } ] ''' ``` rnc t|S#t$rYnwxYw t|S#t$r tddwxYw)z!Validate an IPv4 or IPv6 address.ip_any_addressz)value is not a valid IPv4 or IPv6 address)r ValueErrorr rrrTs rMrzIPvAnyAddress.__new__sU "5))   i"5)) i)*:c0i}|jdd|S)Nrf ipvanyaddressrhrjrls rMrz*IPvAnyAddress.__get_pydantic_json_schema__"L   Xo  F rOchtj|jtjSNrr no_info_plain_validator_functionr`rrbs rMrcz*IPvAnyAddress.__get_pydantic_core_schema__) ?? [-M-M-O rOc||SrHrnros rMr`zIPvAnyAddress._validate {# #rON)rTrrerrrq)rprrer rhrirjrkrrrrrcr`rnrOrMr.r.`s :  i  4 ?m       + $      $  $rOr.cjeZdZdZdZddZe d dZe d dZed dZ y) r/#Validate an IPv4 or IPv6 interface.rnc t|S#t$rYnwxYw t|S#t$r tddwxYw)rip_any_interfacez+value is not a valid IPv4 or IPv6 interface)rrr rrs rMrzIPvAnyInterface.__new__sU $U++   m$U++ m)*<>kll mrc0i}|jdd|S)Nrfipvanyinterfacerhrjrls rMrz,IPvAnyInterface.__get_pydantic_json_schema__s#L   X6G  H rOchtj|jtjSrrrbs rMrcz,IPvAnyInterface.__get_pydantic_core_schema__rrOc||SrHrnros rMr`zIPvAnyInterface._validaterrON)rTr#rerrrq)rpr#rerrrnrOrMr/r/s1  m  4 ?m       + $      $  $rOr/cjeZdZdZdZddZe d dZe d dZed dZ y) r0!Validate an IPv4 or IPv6 network.rnc t|S#t$rYnwxYw t|S#t$r tddwxYw)rip_any_networkz)value is not a valid IPv4 or IPv6 network)r rr rrs rMrzIPvAnyNetwork.__new__sU "5))   i"5)) i)*:z\s*(?:|z)?\s*z\s*)recompile) name_charsunquoted_name_groupquoted_name_group email_groups rM_build_pretty_email_regexrsP-J!*VJ"` 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)rXr\rMAX_EMAIL_LENGTHrpretty_email_regex fullmatchgroupsstripr8EmailNotValidErrorrargs normalized local_part)rTmrR unquoted_name quoted_namergpartsr[s rMr8r8s"  5z$$!  : 01A0B+N O  $$U+AD,-HHJ) {E+  KKME..u5Q   E     #5##D ;  - -! IHVYZ[Z`Z`abZcVdKe  s>B99C7 &C22C7)rz"type[_BaseUrl | _BaseMultiHostUrl]rer")rer)rezre.Pattern[str])rTrreztuple[str, str])^rk __future__r _annotations dataclasses _dataclassesrr functoolsrimportlib.metadatar ipaddressrrr r r r typingr rrr pydantic_corerrrrrrrrrstyping_extensionsrrpydantic.errorsr _internalrr _migrationrannotated_handlersrr{r type_adapterr"rXr#rl__all__ dataclassr+rprrwr$r%r(r*r)r&r'r1r2r3r4r5r6r7r9r:r;r<r\rr,Representationr-rrrr.r/r0rrrr8rh __getattr__rnrOrMrskK2" &ff::<)--7)4(%VKVO :444nYyYyxwywyt  X2EENVfNVbAfAR6R