o |nhe;@s~ddlmZddlZddlZddlmZddlmZdZe dZ e d Z e d ej ej BZd Zd Zd jeedZeedZgdZdZddddeDdZdedZdededZdZe dZe dedZe dedZe dedZe dedddZe d ed!Z d"eeefZ!e e!ej ej BZ"e#d#Z$e#d$Z%e$e%Bd%hBZ&e&d&d'hBZ'e'd(hBZ(Z)Gd)d*d*e*d*d+ej+e,fd,ej+e,fd-ej+e,fd.ej+e-fd/ej+e,fd0ej+e,fd1ej+e,fgZ.ej/dMd7d8Z0ej/dNd:d8Z0dOdZ1ej/dQd?d@Z2ej/dRdAd@Z2dSdBd@Z2dTdEdFZ3dUdHdIZ4dVdKdLZ5dS)W) annotationsN)LocationParseError)to_str)httphttpsNz%[a-fA-F0-9]{2}z^(?:[a-zA-Z][a-zA-Z0-9+-]*:|/)zS^(?:([a-zA-Z][a-zA-Z0-9+.-]*):)?(?://([^\\/?#]*))?([^?#]*)(?:\?([^#]*))?(?:#(.*))?$z(?:[0-9]{1,3}\.){3}[0-9]{1,3}z[0-9A-Fa-f]{1,4}z(?:{hex}:{hex}|{ipv4}))hexipv4)r ls32) z(?:%(hex)s:){6}%(ls32)sz::(?:%(hex)s:){5}%(ls32)sz%(?:%(hex)s)?::(?:%(hex)s:){4}%(ls32)sz2(?:(?:%(hex)s:)?%(hex)s)?::(?:%(hex)s:){3}%(ls32)sz6(?:(?:%(hex)s:){0,2}%(hex)s)?::(?:%(hex)s:){2}%(ls32)sz/(?:(?:%(hex)s:){0,3}%(hex)s)?::%(hex)s:%(ls32)sz'(?:(?:%(hex)s:){0,4}%(hex)s)?::%(ls32)sz&(?:(?:%(hex)s:){0,5}%(hex)s)?::%(hex)sz(?:(?:%(hex)s:){0,6}%(hex)s)?::zCABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789._\-~z(?:|cCsg|]}|tqS)_subs).0xr r H/usr/local/bin/dhwp/env/lib/python3.10/site-packages/urllib3/util/url.py 4r)z (?:%25|%)(?:[z]|%[a-fA-F0-9]{2})+z\[z)?\]z!(?:[^\[\]%:/?#]|%[a-fA-F0-9]{2})*z!^(/[^?#]*)(?:\?([^#]*))?(?:#.*)?$^$(z)\]$z)^(%s|%s|%s)(?::0*?(|0|[1-9][0-9]{0,4}))?$zBABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789._-~z !$&'()*+,;=:@/?cseZdZdZ       ddfd d ZedddZedddZedddZedddZ edddZ dddZ Z S) Urlz Data structure for representing an HTTP URL. Used as a return value for :func:`parse_url`. Both the scheme and host are normalized as they are both case-insensitive according to RFC 3986. Nscheme str | Noneauthhostport int | Nonepathqueryfragmentc s@|r |ds d|}|dur|}t||||||||S)Nr) startswithlowersuper__new__)clsrr r!r"r$r%r& __class__r rr*ds  z Url.__new__returncC|jS)z@For backwards-compatibility with urlparse. We're nice like that.)r!selfr r rhostnametsz Url.hostnamestrcCs&|jpd}|jdur|d|j7}|S)z)Absolute path including the query string.rNr)r$r%)r1urir r r request_uriys  zUrl.request_uricCs.|j}|j}|dus|dur|S|d|S)z Authority component as defined in RFC 3986 3.2. This includes userinfo (auth), host and port. i.e. userinfo@host:port Nr)r netloc)r1userinfor6r r r authoritys  z Url.authoritycCs,|jdurdS|jr|jd|jS|jS)z Network location including host and port. If you need the equivalent of urllib.parse's ``netloc``, use the ``authority`` property instead. Nr)r!r"r0r r rr6s z Url.netlocc Cs|\}}}}}}}d}|dur||d7}|dur||d7}|dur'||7}|dur3|dt|7}|dur;||7}|durE|d|7}|durO|d|7}|S)a2 Convert self into a url This function should more or less round-trip with :func:`.parse_url`. The returned url may not be exactly the same as the url inputted to :func:`.parse_url`, but it should be equivalent by the RFC (e.g., urls with a blank port will have : removed). Example: .. code-block:: python import urllib3 U = urllib3.util.parse_url("https://google.com/mail/") print(U.url) # "https://google.com/mail/" print( urllib3.util.Url("https", "username:password", "host.com", 80, "/path", "query", "fragment" ).url ) # "https://username:password@host.com:80/path?query#fragment" Nz://rrr#)r3) r1rr r!r"r$r%r&urlr r rr;s"    zUrl.urlcCr/N)r;r0r r r__str__sz Url.__str__)NNNNNNN)rrr rr!rr"r#r$rr%rr&r)r.r)r.r3) __name__ __module__ __qualname____doc__r*propertyr2r5r8r6r;r= __classcell__r r r,rrPs*     /rrr r!r"r$r%r& componentr3 allowed_charstyping.Container[str]r.cCdSr<r rDrEr r r_encode_invalid_charsrINonecCrGr<r rHr r rrIrJrc Cs|dur|St|}tdd|\}}|dd}||dk}t}tdt|D]7}|||d}t|}|r?|dksI|d krN| |vrN||7}q+| dt |d d d  q+| S) zfPercent-encodes a URI component without reapplying onto an already percent-encoded component. NcSs|dS)Nr)groupupper)matchr r rsz'_encode_invalid_chars..zutf-8 surrogatepass%rrr)r _PERCENT_REsubnencodecount bytearrayrangelenorddecodeextendr zfillrM) rDrEpercent_encodings uri_bytesis_percent_encodedencoded_componentibytebyte_ordr r rrIs$  *cCs|d}g}|D]}|dkrq |dkr||q |r |q |dr2|r,|dr2|dd|dr<|dd|S)Nr.z..rr9)z/.z/..)splitappendpopr'insertendswithjoin)r$segmentsoutputsegmentr r r_remove_path_dot_segmentss      rocCrGr<r r!rr r r_normalize_host%rqcCrGr<r rpr r rrq)rrcCs|rh|tvrht|}|rSt|}|rO|d\}}|||}|dr1|dkr1|dd}n|dd}t|t}|d| d|||dS| St |sht d dd| dDd S|S) Nrz%25%.cSsg|]}t|qSr ) _idna_encode)rlabelr r rrDrz#_normalize_host..reascii)_NORMALIZABLE_SCHEMES_IPV6_ADDRZ_RErN _ZONE_ID_REsearchspanr'rI_UNRESERVED_CHARSr(_IPV4_RErrkrf)r!ris_ipv6rNstartendzone_idr r rrq-s(     & namebytescCsv|s4zddl}Wn tytddwz |j|dddWS|jy3td|ddw|dS)Nrz-Unable to parse URL without the 'idna' moduleT)strict std3_ruleszName 'z' is not a valid IDNA labelrx)isasciiidna ImportErrorrrUr( IDNAError)rrr r rrvJs(   rvtargetcCsTt|}|st|d|\}}t|t}|dur(t|t}|d|7}|S)zPercent-encodes a request target so that there are no invalid characters Pre-condition for this function is that 'target' must start with '/'. If that is the case then _TARGET_RE will always produce a match. z is not a valid request URINr) _TARGET_RErNrgroupsrI _PATH_CHARS _QUERY_CHARS)rrNr$r%encoded_targetr r r_encode_target]s     rr;c Cs|stS|}t|sd|}zt|\}}}}}|dup&|tv}|r-|}|rT|d\}} } |p:d}t | \} } |rM|rMt |t }| dkrSd} nd\}} } | durtt | } d| krndksst |t |nd} t| |} |r|rt|}t |t}|r|rt |t}|r|rt |t}Wnttfy}zt ||d}~ww|s|dus|durd}nd}t||| | |||dS) a Given a url, return a parsed :class:`.Url` namedtuple. Best-effort is performed to parse incomplete urls. Fields not provided will be None. This parser is RFC 3986 and RFC 6874 compliant. The parser logic and helper functions are based heavily on work done in the ``rfc3986`` module. :param str url: URL to parse into a :class:`.Url` namedtuple. Partly backwards-compatible with :mod:`urllib.parse`. Example: .. code-block:: python import urllib3 print( urllib3.util.parse_url('http://google.com/mail/')) # Url(scheme='http', host='google.com', port=None, path='/mail/', ...) print( urllib3.util.parse_url('google.com:80')) # Url(scheme=None, host='google.com', port=80, path=None, ...) print( urllib3.util.parse_url('/foo?bar')) # Url(scheme=None, host=None, port=None, path='/foo', query='bar', ...) z//Nrr9)NNNri)rr r!r"r$r%r&)r _SCHEME_REr|_URI_RErNrr(ry rpartition _HOST_PORT_RErI_USERINFO_CHARSintrrqrorr_FRAGMENT_CHARS ValueErrorAttributeError)r; source_urlrr8r$r%r& normalize_urir _ host_portr!r"port_inter r r parse_urlosl         r)rDr3rErFr.r3)rDrKrErFr.rK)rDrrErFr.r)r$r3r.r3)r!rKrrr.rK)r!r3rrr.r3)r!rrrr.r)rr3r.r)rr3r.r3)r;r3r.r)6 __future__rretyping exceptionsrutilrrycompilerSrUNICODEDOTALLr _IPV4_PAT_HEX_PATformat _LS32_PATr _variations_UNRESERVED_PATrk _IPV6_PAT _ZONE_ID_PAT_IPV6_ADDRZ_PAT _REG_NAME_PATrr_IPV6_RErz_BRACELESS_IPV6_ADDRZ_REr{_HOST_PORT_PATrsetr~_SUB_DELIM_CHARSrrrr NamedTupleOptionalr3rroverloadrIrorqrvrrr r r rs                       $