zmc
2023-08-08 e792e9a60d958b93aef96050644f369feb25d61b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
U
 ý°dm;ã@sÔddlmZddlZddlZddlmZddlmZdZe     d¡Z
e     d    ¡Z e     d
ej ej B¡Zd Zd Zd jeedZeedœZdddddddddg    ZdZdd dd„eDƒ¡dZded Zd!eded"Zd#Ze     d$¡Ze     d%ed&¡Ze     d%ed&¡Ze     d%ed&¡Ze     d%edd'…d&¡Ze     d(ed)¡Z d*eeefZ!e     e!ej ej B¡Z"e#d+ƒZ$e#d,ƒZ%e$e%Bd-hBZ&e&d.d/hBZ'e'd0hBZ(Z)Gd1d2„d2e *d2d3ej+e,fd4ej+e,fd5ej+e,fd6ej+e-fd7ej+e,fd8ej+e,fd9ej+e,fg¡ƒZ.ej/d:d;d:d<œd=d>„ƒZ0ej/d?d;d?d<œd@d>„ƒZ0dAd;dAd<œdBd>„Z0d:d:dCœdDdE„Z1ej/d?dAd?dFœdGdH„ƒZ2ej/d:dAd:dFœdIdH„ƒZ2dAdAdAdFœdJdH„Z2d:dKdLœdMdN„Z3d:d:dOœdPdQ„Z4d:d2dRœdSdT„Z5dS)Ué)Ú annotationsNé)ÚLocationParseErroré)Úto_str)ÚhttpÚhttpsNz%[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}))ÚhexZipv4)r    Úls32z(?:%(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|] }|t‘qS©)Ú_subs)Ú.0Úxr r úGd:\z\workplace\vscode\pyvenv\venv\Lib\site-packages\urllib3/util/url.pyÚ
<listcomp>4srú)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 !$&'()*+,;=ú:ú@ú/ú?c    sœeZdZdZdddddddddœ‡fdd„ Zeddœd    d
„ƒZed dœd d „ƒZeddœdd„ƒZeddœdd„ƒZ    ed dœdd„ƒZ
d dœdd„Z ‡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.
    Nú
str | Nonez
int | None©ÚschemeÚauthÚhostÚportÚpathÚqueryÚfragmentc
s@|r| d¡sd|}|dk    r&| ¡}tƒ ||||||||¡S)Nr)Ú
startswithÚlowerÚsuperÚ__new__)Úclsrrr r!r"r#r$©Ú    __class__r rr(ds
 
z Url.__new__)ÚreturncCs|jS)z@For backwards-compatibility with urlparse. We're nice like that.)r ©Úselfr r rÚhostnametsz Url.hostnameÚstrcCs&|jpd}|jdk    r"|d|j7}|S)z)Absolute path including the query string.rNr)r"r#)r.Úurir r rÚ request_uriys
 
zUrl.request_uricCs2|j}|j}|dks|dkr |S|›d|›SdS)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)r.Úuserinfor3r r rÚ    authorityƒs
    z Url.authoritycCs,|jdkrdS|jr&|j›d|j›S|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!r-r r rr3“s
 
z
Url.netlocc    Cs¢|\}}}}}}}d}|dk    r*||d7}|dk    r>||d7}|dk    rN||7}|dk    rf|dt|ƒ7}|dk    rv||7}|dk    rŠ|d|7}|dk    rž|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ú#)r0)    r.rrr r!r"r#r$Úurlr r rr8¡s"    zUrl.urlcCs|jS©N)r8r-r r rÚ__str__Ñsz Url.__str__)NNNNNNN) Ú__name__Ú
__module__Ú __qualname__Ú__doc__r(Úpropertyr/r2r5r3r8r:Ú __classcell__r r r*rrPs(ø      /rrrr r!r"r#r$r0ztyping.Container[str])Ú    componentÚ allowed_charsr,cCsdSr9r ©rArBr r rÚ_encode_invalid_charsÕsrDÚNonecCsdSr9r rCr r rrDÜsrc    CsÎ|dkr |St|ƒ}t dd„|¡\}}| dd¡}|| d¡k}tƒ}tdt|ƒƒD]n}|||d…}t|ƒ}|r~|dks’|d    krœ|     ¡|krœ||7}qV| 
dt |ƒd
d… ¡  d
¡  ¡¡qV|     ¡S) zfPercent-encodes a URI component without reapplying
    onto an already percent-encoded component.
    NcSs| d¡ ¡S)Nr)ÚgroupÚupper)Úmatchr r rÚ<lambda>òóz'_encode_invalid_chars.<locals>.<lambda>zutf-8Ú surrogatepassó%rré€r)rÚ _PERCENT_REÚsubnÚencodeÚcountÚ    bytearrayÚrangeÚlenÚordÚdecodeÚextendr    ÚzfillrG)    rArBÚpercent_encodingsÚ    uri_bytesÚis_percent_encodedÚencoded_componentÚiÚbyteÚbyte_ordr r rrDãs,ÿ  ÿ
ÿ*)r"r,cCs‚| d¡}g}|D].}|dkr q|dkr4| |¡q|r| ¡q| d¡rd|rX|drd| dd¡| d¡rx| d¡d |¡S)NrÚ.z..rr6)z/.z/..)ÚsplitÚappendÚpopr%ÚinsertÚendswithÚjoin)r"ÚsegmentsÚoutputÚsegmentr r rÚ_remove_path_dot_segmentss
 
 
 
rj)r rr,cCsdSr9r ©r rr r rÚ_normalize_host%srlcCsdSr9r rkr r rrl*scCsÖ|rÒ|tkrÒt |¡}|r¨t |¡}|rž| d¡\}}|||…}| d¡rb|dkrb|dd…}n |dd…}t|tƒ}|d|…     ¡›d|›||d…›S|     ¡Sn*t
 |¡sÒt d  dd„|  d¡Dƒ¡d    ƒS|S)
Nrz%25éú%ó.cSsg|] }t|ƒ‘qSr )Ú _idna_encode)rÚlabelr r rrFsz#_normalize_host.<locals>.<listcomp>r`Úascii)Ú_NORMALIZABLE_SCHEMESÚ_IPV6_ADDRZ_RErHÚ _ZONE_ID_REÚsearchÚspanr%rDÚ_UNRESERVED_CHARSr&Ú_IPV4_RErrfra)r rÚis_ipv6rHÚstartÚendÚzone_idr r rrl/s(
 
 
&
 
þÚbytes)Únamer,cCs‚| ¡stz ddl}Wntk
r2tdƒd‚YnXz|j| ¡dddWS|jk
rrtd|›dƒd‚YnX| ¡ d¡S)Nrz-Unable to parse URL without the 'idna' moduleT)ÚstrictÚ
std3_ruleszName 'z' is not a valid IDNA labelrr)ÚisasciiÚidnaÚ ImportErrorrrPr&Ú    IDNAError)rrƒr r rrpLs$ ÿþ
ÿþrp)Útargetr,cCsTt |¡}|st|›dƒ‚| ¡\}}t|tƒ}|dk    rPt|tƒ}|d|7}|S)zÝPercent-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_RErHrÚgroupsrDÚ _PATH_CHARSÚ _QUERY_CHARS)r†rHr"r#Zencoded_targetr r rÚ_encode_target_s
 
 
 r‹)r8r,c
Cs¬|s
tƒS|}t |¡s d|}zt |¡ ¡\}}}}}|dkpN| ¡tk}|r\| ¡}|rª| d¡\}}    }
|pvd}t     |
¡ ¡\} } |rœ|rœt
|t ƒ}| dkr´d} n
d\}} } | dk    rät | ƒ} d| krØdksènt |ƒ‚nd} t| |ƒ} |r|rt|ƒ}t
|tƒ}|r&|r&t
|tƒ}|r<|r<t
|tƒ}Wn2ttfk
rp}zt |ƒ|‚W5d}~XYnX|s–|dk    sŒ|dk    r’d}nd}t||| | |||dS)    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//Nrr6)NNNriÿÿr)rÚ
_SCHEME_RErvÚ_URI_RErHrˆr&rsÚ
rpartitionÚ _HOST_PORT_RErDÚ_USERINFO_CHARSÚintrrlrjr‰rŠÚ_FRAGMENT_CHARSÚ
ValueErrorÚAttributeError)r8Ú
source_urlrr5r"r#r$Ú normalize_urirÚ_Ú    host_portr r!Zport_intÚer r rÚ    parse_urlqs^
 
 
 
 
 
 
 ùrš)6Ú
__future__rÚreÚtypingÚ
exceptionsrÚutilrrsÚcompilerNrŒÚUNICODEÚDOTALLrZ    _IPV4_PATZ_HEX_PATÚformatZ    _LS32_PATr Ú _variationsZ_UNRESERVED_PATrfZ    _IPV6_PATZ _ZONE_ID_PATZ_IPV6_ADDRZ_PATZ _REG_NAME_PATr‡ryZ_IPV6_RErtZ_BRACELESS_IPV6_ADDRZ_REruZ_HOST_PORT_PATrÚsetrxZ_SUB_DELIM_CHARSrr‰rŠr’Ú
NamedTupleÚOptionalr0r‘rÚoverloadrDrjrlrpr‹ršr r r rÚ<module>sš   
 
 
ú    
î 
ýÿ 
       ùþÿ$