관리-도구
편집 파일: parse.cpython-39.opt-1.pyc
a ����܅�g������������������������@���s��d�Z�ddlZddlZddlZddlZddlZddlZg�d�Zg�d�Zg�d�Z g�d�Z g�d�Zg�d�Zg�d �Z d ZdZg�d�Zd Zi�Zdd��ZdZdZdd��Zeefdd�Zeefdd�Zdd��ZG�dd��de�ZG�dd��de�ZG�dd��de�ZG�d d!��d!ee�ZG�d"d#��d#ee�Zdd$lm Z �e d%d&�Z!e d'd(�Z"e d)d*�Z#d+e!_�d,e!j$_�d-e!j%_�d.e"_�d/e"j&_�d0e"j'_�d1e"j(_�d2e"j)_�d3e"j%_�d4e#_�e"j&j�e#j&_�e"j'j�e#j'_�e"j(j�e#j(_�d5e#j*_�e"j)j�e#j)_�e"j%j�e#j%_�eZ+G�d6d%��d%e!e�Z,G�d7d'��d'e"e�Z-G�d8d)��d)e#e�Z.G�d9d:��d:e!e�Z/G�d;d<��d<e"e�Z0G�d=d>��d>e#e�Z1d?d@��Z2e2���[2d�dCdD�Z3dEdF��Z4d�dGdH�Z5dIdJ��Z6dKdL��Z7dMdN��Z8d�dOdP�Z9dQdR��Z:dSdT��Z;d�dUdV�Z<dWdX��Z=dYZ>da?dZd[��Z@e�Ad\�ZBd�d_d`�ZCd�dcdd�ZDd�dedf�ZEd�dgdh�ZFeGdi�ZHeIeH�ZJi�ZKG�djdk��dkejL�ZMd�dmdn�ZNd�dodp�ZOd�dqdr�ZPdadAddeOfdsdt�ZQdudv��ZRdwdx��ZSdydz��ZTd{d|��ZUdaVd}d~��ZWdd���ZXdaYd�d���ZZd�d���Z[d�d���Z\d�d���Z]d�d���Z^d�d���Z_da`d�d���Zad�d�d��Zbd�d�d��Zcd�d���Zdd�d���Zed�d���Zfd�d���Zgd�d���Zhd�d���Zid�d���Zjd�d���ZkdS�)�a3��Parse (absolute and relative) URLs. urlparse module is based upon the following RFC specifications. RFC 3986 (STD66): "Uniform Resource Identifiers" by T. Berners-Lee, R. Fielding and L. Masinter, January 2005. RFC 2732 : "Format for Literal IPv6 Addresses in URL's by R.Hinden, B.Carpenter and L.Masinter, December 1999. RFC 2396: "Uniform Resource Identifiers (URI)": Generic Syntax by T. Berners-Lee, R. Fielding, and L. Masinter, August 1998. RFC 2368: "The mailto URL scheme", by P.Hoffman , L Masinter, J. Zawinski, July 1998. RFC 1808: "Relative Uniform Resource Locators", by R. Fielding, UC Irvine, June 1995. RFC 1738: "Uniform Resource Locators (URL)" by T. Berners-Lee, L. Masinter, M. McCahill, December 1994 RFC 3986 is considered the current standard and any future changes to urlparse module should conform with it. The urlparse module is currently not entirely compliant with this RFC due to defacto scenarios for parsing, and for backward compatibility purposes, some parsing quirks from older RFCs are retained. The testcases in test_urlparse.py provides a good indicator of parsing behavior. The WHATWG URL Parser spec should also be considered. We are not compliant with it either due to existing user code API behavior expectations (Hyrum's Law). It serves as a useful guide when making changes. �����N)�urlparse� urlunparse�urljoin� urldefrag�urlsplit� urlunsplit� urlencode�parse_qs� parse_qsl�quote� quote_plus�quote_from_bytes�unquote�unquote_plus�unquote_to_bytes�DefragResult�ParseResult�SplitResult�DefragResultBytes�ParseResultBytes�SplitResultBytes)���ftp�http�gopher�nntp�imap�wais�file�https�shttp�mms�prospero�rtsp�rtspu�sftp�svn�svn+ssh�ws�wss)r���r���r���r���r����telnetr���r���r���r!���r���r ����snewsr"���r#���r$����rsyncr&���r'���r%����nfs�gitzgit+sshr(���r)���)r���r����hdlr"���r���r���r���r ���r#���r$����sip�sipsr!���r%����tel) r���r/����mailto�newsr*���r���r���r+���r0���r1���)r���r���r���r���r���r ���r!���r���r#���r$���r0���r1���) r���r���r/���r���r���r4���r���r���r���r ���r+���r���r"���zAabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+-.z!� )� � � ����c�������������������C���s���t�����t����dS�)z,Clear the parse cache and the quoters cache.N)�_parse_cache�clear� _safe_quoters��r<���r<����$/usr/lib64/python3.9/urllib/parse.py�clear_cachea���s����r>����ascii�strictc�����������������C���s���|�S��Nr<���)�objr<���r<���r=����_noopp���s����rC���c�����������������C���s���|���||�S�rA�����encode)rB����encoding�errorsr<���r<���r=����_encode_results���s����rH���c��������������������s���t����fdd�|�D���S�)Nc�����������������3���s"���|�]}|r|������nd�V��qdS�)r���N��decode��.0�x�rF���rG���r<���r=���� <genexpr>y��������z_decode_args.<locals>.<genexpr>)�tuple)�argsrF���rG���r<���rN���r=����_decode_argsw���s����rS���c������������������G���sV���t�|�d�t�}|�dd���D�]}|rt�|t�|krtd��q|rH|�tf�S�t|��tf�S�)Nr�������z$Cannot mix str and non-str arguments)� isinstance�str� TypeErrorrC���rS���rH���)rR���� str_input�argr<���r<���r=����_coerce_args{���s���� rZ���c�������������������@���s���e�Zd�ZdZdZddd�ZdS�) �_ResultMixinStrz>Standard approach to encoding parsed results from str to bytesr<���r?���r@���c��������������������s���|�j����fdd�|�D����S�)Nc�����������������3���s���|�]}|������V��qd�S�rA���rD���rK���rN���r<���r=���rO�������rP���z)_ResultMixinStr.encode.<locals>.<genexpr>)�_encoded_counterpart��selfrF���rG���r<���rN���r=���rE�������s����z_ResultMixinStr.encodeN)r?���r@���)�__name__� __module__�__qualname__�__doc__� __slots__rE���r<���r<���r<���r=���r[�������s���r[���c�������������������@���s���e�Zd�ZdZdZddd�ZdS�) �_ResultMixinBytesz>Standard approach to decoding parsed results from bytes to strr<���r?���r@���c��������������������s���|�j����fdd�|�D����S�)Nc�����������������3���s���|�]}|������V��qd�S�rA���rI���rK���rN���r<���r=���rO�������rP���z+_ResultMixinBytes.decode.<locals>.<genexpr>)�_decoded_counterpartr]���r<���rN���r=���rJ�������s����z_ResultMixinBytes.decodeN)r?���r@���)r_���r`���ra���rb���rc���rJ���r<���r<���r<���r=���rd�������s���rd���c�������������������@���sN���e�Zd�ZdZdZedd���Zedd���Zedd���Zed d ���Z e ej�Z dS�)�_NetlocResultMixinBasezHShared methods for the parsed result objects containing a netloc elementr<���c�����������������C���s ���|�j�d�S�)Nr����� _userinfo�r^���r<���r<���r=����username����s����z_NetlocResultMixinBase.usernamec�����������������C���s ���|�j�d�S�)NrT���rg���ri���r<���r<���r=����password����s����z_NetlocResultMixinBase.passwordc�����������������C���sD���|�j�d�}|sd�S�t|t�r dnd}|�|�\}}}|���|�|�S�)Nr����%����%)� _hostinforU���rV���� partition�lower)r^����hostname� separator�percent�zoner<���r<���r=���rq�������s���� z_NetlocResultMixinBase.hostnamec�����������������C���sj���|�j�d�}|d�urfzt|d�}W�n&�tyF���d|��}t|�d��Y�n0�d|��kr\dksfn�td��|S�)NrT���� ���z+Port could not be cast to integer value as r���i����zPort out of range 0-65535)rn����int� ValueError)r^����port�messager<���r<���r=���rx�������s���� z_NetlocResultMixinBase.portN)r_���r`���ra���rb���rc����propertyrj���rk���rq���rx����classmethod�types�GenericAlias�__class_getitem__r<���r<���r<���r=���rf�������s��� rf���c�������������������@���s(���e�Zd�ZdZedd���Zedd���ZdS�)�_NetlocResultMixinStrr<���c�����������������C���sD���|�j�}|�d�\}}}|r4|�d�\}}}|s<d�}nd��}}||fS�)N�@�:��netloc� rpartitionro����r^���r�����userinfo� have_info�hostinforj���� have_passwordrk���r<���r<���r=���rh�������s����z_NetlocResultMixinStr._userinfoc�����������������C���sl���|�j�}|�d�\}}}|�d�\}}}|rL|�d�\}}}|�d�\}}}n|�d�\}}}|sdd�}||fS�)Nr�����[�]r����r�����r^���r�����_r�����have_open_br� bracketedrq���rx���r<���r<���r=���rn�������s����z_NetlocResultMixinStr._hostinfoN�r_���r`���ra���rc���rz���rh���rn���r<���r<���r<���r=���r�������s ��� r���c�������������������@���s(���e�Zd�ZdZedd���Zedd���ZdS�)�_NetlocResultMixinBytesr<���c�����������������C���sD���|�j�}|�d�\}}}|r4|�d�\}}}|s<d�}nd��}}||fS�)N����@����:r����r����r<���r<���r=���rh�������s����z!_NetlocResultMixinBytes._userinfoc�����������������C���sl���|�j�}|�d�\}}}|�d�\}}}|rL|�d�\}}}|�d�\}}}n|�d�\}}}|sdd�}||fS�)Nr��������[����]r����r����r����r<���r<���r=���rn�������s����z!_NetlocResultMixinBytes._hostinfoNr����r<���r<���r<���r=���r��������s ��� r����)� namedtupler���zurl fragmentr���z!scheme netloc path query fragmentr���z(scheme netloc path params query fragmentz� DefragResult(url, fragment) A 2-tuple that contains the url without fragment identifier and the fragment identifier as a separate argument. z$The URL with no fragment identifier.z� Fragment identifier separated from URL, that allows indirect identification of a secondary resource by reference to a primary resource and additional identifying information. z� SplitResult(scheme, netloc, path, query, fragment) A 5-tuple that contains the different components of a URL. Similar to ParseResult, but does not split params. z%Specifies URL scheme for the request.z0 Network location where the request is made to. z@ The hierarchical path, such as the path to a file to download. z� The query component, that contains non-hierarchical data, that along with data in path component, identifies a resource in the scope of URI's scheme and network location. z� Fragment identifier, that allows indirect identification of a secondary resource by reference to a primary resource and additional identifying information. zq ParseResult(scheme, netloc, path, params, query, fragment) A 6-tuple that contains components of a parsed URL. z� Parameters for last path element used to dereference the URI in order to provide access to perform some operation on the resource. c�������������������@���s���e�Zd�ZdZdd��ZdS�)r���r<���c�����������������C���s ���|�j�r|�jd�|�j��S�|�jS�d�S�)N�#��fragment�urlri���r<���r<���r=����geturlL��s����zDefragResult.geturlN�r_���r`���ra���rc���r����r<���r<���r<���r=���r���J��s���c�������������������@���s���e�Zd�ZdZdd��ZdS�)r���r<���c�����������������C���s���t�|��S�rA����r���ri���r<���r<���r=���r����T��s����zSplitResult.geturlNr����r<���r<���r<���r=���r���R��s���c�������������������@���s���e�Zd�ZdZdd��ZdS�)r���r<���c�����������������C���s���t�|��S�rA����r���ri���r<���r<���r=���r����Y��s����zParseResult.geturlNr����r<���r<���r<���r=���r���W��s���c�������������������@���s���e�Zd�ZdZdd��ZdS�)r���r<���c�����������������C���s ���|�j�r|�jd�|�j��S�|�jS�d�S�)N����#r����ri���r<���r<���r=���r����_��s����zDefragResultBytes.geturlNr����r<���r<���r<���r=���r���]��s���r���c�������������������@���s���e�Zd�ZdZdd��ZdS�)r���r<���c�����������������C���s���t�|��S�rA���r����ri���r<���r<���r=���r����g��s����zSplitResultBytes.geturlNr����r<���r<���r<���r=���r���e��s���r���c�������������������@���s���e�Zd�ZdZdd��ZdS�)r���r<���c�����������������C���s���t�|��S�rA���r����ri���r<���r<���r=���r����l��s����zParseResultBytes.geturlNr����r<���r<���r<���r=���r���j��s���r���c������������������C���s4���t�tfttfttff}�|�D�]\}}||_||_qd�S�rA���)r���r���r���r���r���r���r\���re���)Z _result_pairsZ_decodedZ_encodedr<���r<���r=����_fix_result_transcodingp��s�����r����r���Tc����������� ������C���sf���t�|�|�\}�}}t|�||�}|\}}}�}}|tv�rHd|�v�rHt|��\}�}nd}t|||�|||�} || �S�)a���Parse a URL into 6 components: <scheme>://<netloc>/<path>;<params>?<query>#<fragment> The result is a named 6-tuple with fields corresponding to the above. It is either a ParseResult or ParseResultBytes object, depending on the type of the url parameter. The username, password, hostname, and port sub-components of netloc can also be accessed as attributes of the returned object. The scheme argument provides the default value of the scheme component when no scheme is found in url. If allow_fragments is False, no attempt is made to separate the fragment component from the previous component, which can be either path or query. Note that % escapes are not expanded. �;r���)rZ���r����uses_params�_splitparamsr���) r�����scheme�allow_fragments�_coerce_result�splitresultr�����queryr�����params�resultr<���r<���r=���r���}��s����r���c�����������������C���sR���d|�v�r,|���d|��d��}|dk�r6|�dfS�n |���d�}|�d�|��|�|d�d���fS�)N�/r����r���r���rT���)�find�rfind)r�����ir<���r<���r=���r�������s���� r����c�����������������C���sH���t�|��}dD�]"}|��||�}|dkrt||�}q|�||��|�|d���fS�)Nz/?#r���)�lenr�����min)r�����start�delim�c�wdelimr<���r<���r=����_splitnetloc���s����r����c�����������������C���s����|�r|�����rd�S�dd�l}|��dd�}|�dd�}|�dd�}|�dd�}|�d|�}||kr`d�S�dD�] }||v�rdtd |��d �d���qdd�S�)Nr���r����r���r����r�����?�NFKCz/?#@:znetloc 'z' contains invalid z#characters under NFKC normalization)�isascii�unicodedata�replace� normalizerw���)r����r�����n�netloc2r����r<���r<���r=����_checknetloc���s�����r����c�����������������C���sr���|���d�d�}|�d�\}}}|rV|r.td��|�d�\}}}|rf|�d�sftd��n|�d�\}}}t|��d�S�)Nr��������r�����Invalid IPv6 URLr����r����)r����ro���rw���� startswith�_check_bracketed_host)r�����hostname_and_port�before_bracketr����r����rq���r����rx���r<���r<���r=����_check_bracketed_netloc���s���� r����c�����������������C���sB���|���d�r t�d|��s>td��nt�|��}t|tj�r>td��d�S�)N�vz\Av[a-fA-F0-9]+\..+\ZzIPvFuture address is invalidz%An IPv4 address cannot be in brackets)r�����re�matchrw���� ipaddress� ip_addressrU����IPv4Address)rq����ipr<���r<���r=���r�������s���� r����c����������� ������C���s���t�|�|�\}�}}|��t�}�|�t�}tD�]}|��|d�}�|�|d�}q(t|�}|�||t|��t|�f}t� |d�}|r|||�S�t t�tkr�t���d�}�}} |�� d�} | dkr�|�d| ��D�]}|tvr��q�q�|�d| �����|�| d�d���}}�|�dd��dk�rXt|�d�\}}�d|v��r d |v�s4d |v��r<d|v�r<td ��d|v��rXd |v��rXt|��|�rxd|�v��rx|��dd�\}�} d|�v��r�|��dd�\}�}t|��t|||�|| �}|t|<�||�S�) a���Parse a URL into 5 components: <scheme>://<netloc>/<path>?<query>#<fragment> The result is a named 5-tuple with fields corresponding to the above. It is either a SplitResult or SplitResultBytes object, depending on the type of the url parameter. The username, password, hostname, and port sub-components of netloc can also be accessed as attributes of the returned object. The scheme argument provides the default value of the scheme component when no scheme is found in url. If allow_fragments is False, no attempt is made to separate the fragment component from the previous component, which can be either path or query. Note that % escapes are not expanded. r���Nr����r���rT���r�����//r����r����r����r����r����)rZ����lstrip�_WHATWG_C0_CONTROL_OR_SPACE�strip�_UNSAFE_URL_BYTES_TO_REMOVEr�����bool�typer9����getr�����MAX_CACHE_SIZEr>���r�����scheme_charsrp���r����rw���r�����splitr����r���) r����r����r����r�����b�key�cachedr����r����r����r����r����r����r<���r<���r=���r������sL���� "�� r���c�����������������C���s<���t�|���\}}}}}}}|r&d||f�}|t|||||f��S�)z�Put a parsed URL back together again. This may result in a slightly different, but equivalent URL, if the URL that was parsed originally had redundant delimiters, e.g. a ? with an empty query (the draft states that these are equivalent).z%s;%s)rZ���r���)� componentsr����r����r����r����r����r����r����r<���r<���r=���r�����s �����r���c�����������������C���s����t�|���\}}}}}}|s4|r$|tv�s4|dd��dkr`|rP|dd��dkrPd|�}d|pXd�|�}|rp|d�|�}|r�|d�|�}|r�|d �|�}||�S�) ak��Combine the elements of a tuple as returned by urlsplit() into a complete URL as a string. The data argument can be any five-item iterable. This may result in a slightly different, but equivalent URL, if the URL that was parsed originally had unnecessary delimiters (for example, a ? with an empty query; the RFC states that these are equivalent).Nr����r����rT���r����r���r����r����r����)rZ����uses_netloc)r����r����r����r����r����r����r����r<���r<���r=���r���#��s����� r���c�������������� ���C���s���|�s|S�|s|�S�t�|�|�\}�}}t|�d|�\}}}}}} t|||�\} }}} }}| |ks`| tvrh||�S�| tv�r�|r�|t| ||| ||f��S�|}|s�| s�|}|} |s�|}|t| ||| ||f��S�|�d�}|d�dkr�|d=�|dd��dkr�|�d�}n(||�d��}td|dd���|dd�<�g�}|D�]N}|dk�rZz|����W�n�t�yV���Y�n0�n|dk�rj�q(n |� |���q(|d�dv��r�|� d��|t| |d� |��p�d| ||f��S�) zaJoin a base URL and a possibly relative URL to form an absolute interpretation of the latter.r���r�������NrT����..�.)r����r����)rZ���r���� uses_relativer����r���r�����filter�pop� IndexError�append�join)�baser����r����r�����bscheme�bnetloc�bpath�bparams�bquery� bfragmentr����r�����pathr����r����r����� base_parts�segments� resolved_path�segr<���r<���r=���r���6��sb���� � � � � ��r���c����������� ������C���sT���t�|��\}�}d|�v�r>t|��\}}}}}}t|||||df�}nd}|�}|t||��S�)z�Removes any existing fragment from URL. Returns a tuple of the defragmented URL and the fragment. If the URL contained no fragments, the second element is the empty string. r����r���)rZ���r���r���r���) r����r�����sr�����p�a�q�frag�defragr<���r<���r=���r���{��s����r����0123456789ABCDEFabcdefc�������������� ���C���s����|�s|�j��dS�t|�t�r"|��d�}�|���d�}t|�dkr<|�S�|d�g}|j}tdu�rbdd��tD��a|dd��D�]P}z(|t|dd �����||d d����W�qn�ty����|d��||��Y�qn0�qnd� |�S�) z,unquote_to_bytes('abc%20def') -> b'abc def'.rP����utf-8rm���rT���r���Nc�����������������S���s.���i�|�]&}t�D�]}||����t�||���qqS�r<���)�_hexdigrE����bytes�fromhex)rL���r����r����r<���r<���r=���� <dictcomp>���s��� �z$unquote_to_bytes.<locals>.<dictcomp>r����) r����rU���rV���rE���r����r����� _hextobyter�����KeyErrorr����)�string�bits�resr�����itemr<���r<���r=���r������s,���� �r���z([�-]+)r����r����c�����������������C���s����t�|�t�rt|���||�S�d|�vr,|�j�|�S�|du�r8d}|du�rDd}t�|��}|d�g}|j}tdt|�d�D�],}|t||���||���|||d����qnd� |�S�) a���Replace %xx escapes by their single-character equivalent. The optional encoding and errors parameters specify how to decode percent-encoded sequences into Unicode characters, as accepted by the bytes.decode() method. By default, percent-encoded sequences are decoded with UTF-8, and invalid sequences are replaced by a placeholder character. unquote('abc%20def') -> 'abc def'. rl���Nr����r����r���rT���r����r���) rU���r����r���rJ���r�����_asciirer�����ranger����r����)r���rF���rG���r��r��r����r����r<���r<���r=���r������s ���� r���F�&c�������������� ���C���sN���i�}t�|�||||||d�}|D�]*\} } | |v�r>|| ��| ��q| g|| <�q|S�)aX��Parse a query given as a string argument. Arguments: qs: percent-encoded query string to be parsed keep_blank_values: flag indicating whether blank values in percent-encoded queries should be treated as blank strings. A true value indicates that blanks should be retained as blank strings. The default false value indicates that blank values are to be ignored and treated as if they were not included. strict_parsing: flag indicating what to do with parsing errors. If false (the default), errors are silently ignored. If true, errors raise a ValueError exception. encoding and errors: specify how to decode percent-encoded sequences into Unicode characters, as accepted by the bytes.decode() method. max_num_fields: int. If set, then throws a ValueError if there are more than n fields read by parse_qsl(). separator: str. The symbol to use for separating the query arguments. Defaults to &. Returns a dictionary. )rF���rG����max_num_fieldsrr���)r ���r����)�qs�keep_blank_values�strict_parsingrF���rG���r��rr���� parsed_result�pairs�name�valuer<���r<���r=���r ������s�����r ���c�����������������C���s.��t�|��\}�}t�|�\}}|r*t|ttf�s2td��|durXd|��|��} || k�rXtd��dd��|��|�D��} g�}| D�]�}|s�|s�qt|�dd�} t| �dkr�|r�td |f���|rt| �d ��nqtt| d��s�|rt| d�� dd �}t |||d�}||�}| d�� dd �}t |||d�}||�}|�||f��qt|S�)aX��Parse a query given as a string argument. Arguments: qs: percent-encoded query string to be parsed keep_blank_values: flag indicating whether blank values in percent-encoded queries should be treated as blank strings. A true value indicates that blanks should be retained as blank strings. The default false value indicates that blank values are to be ignored and treated as if they were not included. strict_parsing: flag indicating what to do with parsing errors. If false (the default), errors are silently ignored. If true, errors raise a ValueError exception. encoding and errors: specify how to decode percent-encoded sequences into Unicode characters, as accepted by the bytes.decode() method. max_num_fields: int. If set, then throws a ValueError if there are more than n fields read by parse_qsl(). separator: str. The symbol to use for separating the query arguments. Defaults to &. Returns a list, as G-d intended. z*Separator must be of type string or bytes.NrT���zMax number of fields exceededc�����������������S���s���g�|�]}|�qS�r<���r<���)rL����s1r<���r<���r=���� <listcomp>��rP���zparse_qsl.<locals>.<listcomp>�=r����zbad query field: %rr���r����+� rN���)rZ���rU���rV���r����rw����countr����r����r����r����r���)r��r ��r ��rF���rG���r��rr���r����r����� num_fieldsr���r� name_value�nvr ��r��r<���r<���r=���r ������s:����r ���c�����������������C���s���|���dd�}�t|�||�S�)z�Like unquote(), but also replace plus signs by spaces, as required for unquoting HTML form values. unquote_plus('%7e/abc+def') -> '~/abc def' r��r��)r����r���)r���rF���rG���r<���r<���r=���r���7��s����r���sB���ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_.-~c�������������������@���s(���e�Zd�ZdZdd��Zdd��Zdd��ZdS�) �Quoterz�A mapping from bytes (in range(0,256)) to strings. String values are percent-encoded byte values, unless the key < 128, and in the "safe" set (either the specified safe set, or default set). c�����������������C���s���t��|�|�_dS�)zsafe: bytes object.N)�_ALWAYS_SAFE�union�safe)r^���r��r<���r<���r=����__init__O��s����zQuoter.__init__c�����������������C���s���d|�j�jt|��f�S�)Nz<%s %r>)� __class__r_����dictri���r<���r<���r=����__repr__S��s����zQuoter.__repr__c�����������������C���s(���||�j�v�rt|�nd�|�}||�|<�|S�)Nz%{:02X})r���chr�format)r^���r����r��r<���r<���r=����__missing__W��s����zQuoter.__missing__N)r_���r`���ra���rb���r��r ��r#��r<���r<���r<���r=���r��G��s���r��r����c�����������������C���sb���t�|�t�r8|�s|�S�|du�rd}|du�r*d}|��||�}�n |durHtd��|durXtd��t|�|�S�)a���quote('abc def') -> 'abc%20def' Each part of a URL, e.g. the path info, the query, etc., has a different set of reserved characters that must be quoted. The quote function offers a cautious (not minimal) way to quote a string for most of these parts. RFC 3986 Uniform Resource Identifier (URI): Generic Syntax lists the following (un)reserved characters. unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~" reserved = gen-delims / sub-delims gen-delims = ":" / "/" / "?" / "#" / "[" / "]" / "@" sub-delims = "!" / "$" / "&" / "'" / "(" / ")" / "*" / "+" / "," / ";" / "=" Each of the reserved characters is reserved in some component of a URL, but not necessarily in all of them. The quote function %-escapes all characters that are neither in the unreserved chars ("always safe") nor the additional chars set via the safe arg. The default for the safe arg is '/'. The character is reserved, but in typical usage the quote function is being called on a path where the existing slash characters are to be preserved. Python 3.7 updates from using RFC 2396 to RFC 3986 to quote URL strings. Now, "~" is included in the set of unreserved characters. string and safe may be either str or bytes objects. encoding and errors must not be specified if string is a bytes object. The optional encoding and errors parameters specify how to deal with non-ASCII characters, as accepted by the str.encode method. By default, encoding='utf-8' (characters are encoded with UTF-8), and errors='strict' (unsupported characters raise a UnicodeEncodeError). Nr����r@���z,quote() doesn't support 'encoding' for bytesz*quote() doesn't support 'errors' for bytes)rU���rV���rE���rW���r ���)r���r��rF���rG���r<���r<���r=���r���]��s����' r���c�����������������C���sd���t�|�t�rd|�vs$t�|�t�r2d|�vr2t|�|||�S�t�|t�rBd}nd}t|�||�||�}�|��dd�S�)z�Like quote(), but also replace ' ' with '+', as required for quoting HTML form values. Plus signs in the original string are escaped unless they are included in safe. It also does not have safe default to '/'. r������ r��)rU���rV���r����r���r����)r���r��rF���rG����spacer<���r<���r=���r������s������ r���c��������������������s����t�|�ttf�std��|�sdS�t�|t�r6|�dd�}ntdd��|D���}|��t|��s^|����S�zt |���W�n$�t y����t|�j�t |<���Y�n0�d� ��fdd�|�D���S�)z�Like quote(), but accepts a bytes object rather than a str, and does not perform string-to-bytes encoding. It always returns an ASCII string. quote_from_bytes(b'abc def?') -> 'abc%20def%3f' z!quote_from_bytes() expected bytesr���r?����ignorec�����������������S���s���g�|�]}|d�k�r|�qS�)����r<���)rL���r����r<���r<���r=���r�����rP���z$quote_from_bytes.<locals>.<listcomp>c��������������������s���g�|�]}��|��qS�r<���r<���)rL����char��quoterr<���r=���r�����rP���)rU���r����� bytearrayrW���rV���rE����rstrip�_ALWAYS_SAFE_BYTESrJ���r;���r����r���__getitem__r����)�bsr��r<���r)��r=���r ������s���� r ���c�������������� ���C���s��t�|�d�r|����}�nNzt|��r0t|�d�t�s0t�W�n.�ty`���t���\}}}td��|��Y�n0�g�} |s�|�D�]j\} }t| t �r�|| |�} n|t | �|||�} t|t �r�|||�}n|t |�|||�}| �| d�|���qn�n |�D��]\} }t| t ��r|| |�} n|t | �|||�} t|t ��r@|||�}| �| d�|���q�t|t ��rn|||||�}| �| d�|���q�zt|�}W�n8�t�y����|t |�|||�}| �| d�|���Y�q�0�|D�]B} t| t ��r�|| |�} n|t | �|||�} | �| d�| ����q�q�d�| �S�)a^��Encode a dict or sequence of two-element tuples into a URL query string. If any values in the query arg are sequences and doseq is true, each sequence element is converted to a separate parameter. If the query arg is a sequence of two-element tuples, the order of the parameters in the output will match the order of parameters in the input. The components of a query arg may each be either a string or a bytes type. The safe, encoding, and errors parameters are passed down to the function specified by quote_via (encoding and errors only if a component is a str). �itemsr���z1not a valid non-string sequence or mapping objectr��r��) �hasattrr0��r����rU���rQ���rW����sys�exc_info�with_tracebackr����rV���r����r����)r�����doseqr��rF���rG���� quote_via�ty�va�tb�l�kr����rM����eltr<���r<���r=���r������sR���� � r���c�����������������C���s���t�jdtdd��t|��S�)Nz/urllib.parse.to_bytes() is deprecated as of 3.8r������ stacklevel)�warnings�warn�DeprecationWarning� _to_bytes�r����r<���r<���r=����to_bytes��s�����rD��c�����������������C���sH���t�|�t�rDz|��d����}�W�n&�tyB���tdt|���d���Y�n0�|�S�)zto_bytes(u"URL") --> 'URL'.�ASCIIzURL z contains non-ASCII characters)rU���rV���rE���rJ����UnicodeError�reprrC��r<���r<���r=���rB����s���� �rB��c�����������������C���s`���t�|�����}�|�dd��dkr<|�dd��dkr<|�dd�����}�|�dd��dkr\|�dd�����}�|�S�)z�Transform a string like '<URL:scheme://host/path>' into 'scheme://host/path'. The string is returned unchanged if it's not a wrapped URL. NrT����<r�����>����zURL:)rV���r����rC��r<���r<���r=����unwrap��s���� rK��c�����������������C���s���t�jdtdd��t|��S�)NzUurllib.parse.splittype() is deprecated as of 3.8, use urllib.parse.urlparse() insteadr����r=��)r?��r@��rA��� _splittyperC��r<���r<���r=���� splittype,��s�����rM��c�����������������C���sD���t�du�rt�dtj�a�t��|��}|r<|���\}}|���|fS�d|�fS�)z:splittype('type:opaquestring') --> 'type', 'opaquestring'.Nz ([^/:]+):(.*))� _typeprogr�����compile�DOTALLr�����groupsrp���)r����r����r�����datar<���r<���r=���rL��4��s���� rL��c�����������������C���s���t�jdtdd��t|��S�)NzUurllib.parse.splithost() is deprecated as of 3.8, use urllib.parse.urlparse() insteadr����r=��)r?��r@��rA��� _splithostrC��r<���r<���r=���� splithostA��s�����rT��c�����������������C���sX���t�du�rt�dtj�a�t��|��}|rP|���\}}|rH|d�dkrHd|�}||fS�d|�fS�)z;splithost('//host[:port]/path') --> 'host[:port]', '/path'.Nz//([^/#?]*)(.*)r���r����)� _hostprogr����rO��rP��r����rQ��)r����r����� host_portr����r<���r<���r=���rS��I��s���� rS��c�����������������C���s���t�jdtdd��t|��S�)NzUurllib.parse.splituser() is deprecated as of 3.8, use urllib.parse.urlparse() insteadr����r=��)r?��r@��rA��� _splituser��hostr<���r<���r=���� splituserX��s�����rZ��c�����������������C���s ���|���d�\}}}�|r|nd|�fS�)zJsplituser('user[:passwd]@host[:port]') --> 'user[:passwd]', 'host[:port]'.r����N�r����)rY���userr����r<���r<���r=���rW��_��s����rW��c�����������������C���s���t�jdtdd��t|��S�)NzWurllib.parse.splitpasswd() is deprecated as of 3.8, use urllib.parse.urlparse() insteadr����r=��)r?��r@��rA���_splitpasswd)r\��r<���r<���r=����splitpasswde��s�����r^��c�����������������C���s ���|���d�\}�}}|�|r|ndfS�)z/splitpasswd('user:passwd') -> 'user', 'passwd'.r����N�ro���)r\��r�����passwdr<���r<���r=���r]��l��s����r]��c�����������������C���s���t�jdtdd��t|��S�)NzUurllib.parse.splitport() is deprecated as of 3.8, use urllib.parse.urlparse() insteadr����r=��)r?��r@��rA��� _splitportrX��r<���r<���r=���� splitportr��s�����rb��c�����������������C���sD���t�du�rt�dtj�a�t��|��}|r<|���\}�}|r<|�|fS�|�dfS�)z*splitport('host:port') --> 'host', 'port'.Nz (.*):([0-9]*))� _portprogr����rO��rP��� fullmatchrQ��)rY��r����rx���r<���r<���r=���ra��{��s���� ra��r����c�����������������C���s���t�jdtdd��t|�|�S�)NzVurllib.parse.splitnport() is deprecated as of 3.8, use urllib.parse.urlparse() insteadr����r=��)r?��r@��rA���_splitnport)rY���defportr<���r<���r=���� splitnport���s�����rg��c�����������������C���sR���|���d�\}�}}|s|}�n0|rJzt|�}W�n�ty@���d}Y�n0�|�|fS�|�|fS�)z�Split host and port, returning numeric port. Return given default port if no ':' found; defaults to -1. Return numerical port if a valid number are found after ':'. Return None if ':' but not a valid number.r����N)r����rv���rw���)rY��rf��r����rx����nportr<���r<���r=���re�����s���� re��c�����������������C���s���t�jdtdd��t|��S�)NzVurllib.parse.splitquery() is deprecated as of 3.8, use urllib.parse.urlparse() insteadr����r=��)r?��r@��rA���_splitqueryrC��r<���r<���r=���� splitquery���s�����rj��c�����������������C���s$���|���d�\}}}|r||fS�|�dfS�)z/splitquery('/path?query') --> '/path', 'query'.r����Nr[��)r����r����r����r����r<���r<���r=���ri�����s����ri��c�����������������C���s���t�jdtdd��t|��S�)NzTurllib.parse.splittag() is deprecated as of 3.8, use urllib.parse.urlparse() insteadr����r=��)r?��r@��rA��� _splittagrC��r<���r<���r=����splittag���s�����rl��c�����������������C���s$���|���d�\}}}|r||fS�|�dfS�)z)splittag('/path#tag') --> '/path', 'tag'.r����Nr[��)r����r����r�����tagr<���r<���r=���rk�����s����rk��c�����������������C���s���t�jdtdd��t|��S�)NzUurllib.parse.splitattr() is deprecated as of 3.8, use urllib.parse.urlparse() insteadr����r=��)r?��r@��rA��� _splitattrrC��r<���r<���r=���� splitattr���s�����ro��c�����������������C���s���|���d�}|d�|dd��fS�)zksplitattr('/path;attr1=value1;attr2=value2;...') -> '/path', ['attr1=value1', 'attr2=value2', ...].r����r���rT���N)r����)r�����wordsr<���r<���r=���rn�����s���� rn��c�����������������C���s���t�jdtdd��t|��S�)NzWurllib.parse.splitvalue() is deprecated as of 3.8, use urllib.parse.parse_qsl() insteadr����r=��)r?��r@��rA���_splitvalue)�attrr<���r<���r=���� splitvalue���s�����rs��c�����������������C���s ���|���d�\}�}}|�|r|ndfS�)z-splitvalue('attr=value') --> 'attr', 'value'.r��Nr_��)rr��r����r��r<���r<���r=���rq�����s����rq��)r���T)r���)r���T)T)r����r����)FFr����r����Nr��)FFr����r����Nr��)r����r����)r����NN)r���NN)r����)r����)r����)lrb���r����r2��r|����collectionsr?��r�����__all__r����r����r�����non_hierarchical� uses_query� uses_fragmentr����r����r����r����r9���r>����_implicit_encoding�_implicit_errorsrC���rH���rS���rZ����objectr[���rd���rf���r���r����r�����_DefragResultBase�_SplitResultBase�_ParseResultBaser����r����r����r����r����r����r����� ResultBaser���r���r���r���r���r���r����r���r����r����r����r����r����r���r���r���r���r���r����r����r���rO��r��r���r ���r ���r���� frozensetr��r����r-��r;����defaultdictr��r���r���r ���r���rD��rB��rK��rM��rN��rL��rT��rU��rS��rZ��rW��r^��r]��rb��rc��ra��rg��re��rj��ri��rl��rk��ro��rn��rs��rq��r<���r<���r<���r=����<module>���s����!� � ' �� > E ��� *��� C 6 � Q