OwlCyberSecurity - MANAGER
Edit File: parse.cpython-35.pyc
��Yf!�������������������@���s���d��Z��d�d�l�Z�d�d�l�Z�d�d�l�Z�d�d�d�d�d�d�d �d �d�d�d �d�d�d�d�d�d�d�d�d�d�g�Z�d�d�d�d�d�d�d�d�d �d!�d"�d#�d$�d%�d&�d'�d(�d)�d*�g�Z�d�d�d�d�d�d+�d�d�d�d"�d �d!�d,�d#�d$�d%�d-�d'�d(�d&�d.�d/�d0�d)�d*�g�Z�d�d�d1�d#�d�d�d �d!�d$�d%�d2�d3�d"�d&�d4�g�Z�d�d1�d5�d6�d+�d�d�d,�d2�d3�g �Z�d�d�d�d�d �d!�d"�d�d$�d%�d2�d3�g�Z �d�d�d1�d�d�d6�d�d�d �d!�d,�d�d#�g �Z �d7�Z�d8�Z�i��Z �d9�d:����Z�d;�Z�d<�Z�d=�d>����Z�e�e�d?�d@���Z�e�e�dA�dB���Z�dC�dD����Z�GdE�dF����dF�e���Z�GdG�dH����dH�e���Z�GdI�dJ����dJ�e���Z�GdK�dL����dL�e�e���Z�GdM�dN����dN�e�e���Z�d�dO�l�m�Z�e�d�dP���Z�e�d�dQ���Z�e�d�dR���Z�e�Z�GdS�d����d�e�e���Z �GdT�d����d�e�e���Z!�GdU�d����d�e�e���Z"�GdV�d����d�e�e���Z#�GdW�d����d�e�e���Z$�GdX�d����d�e�e���Z%�dY�dZ����Z&�e&����[&�d�d[�d\�d���Z'�d]�d^����Z(�d�d_�d`���Z)�da�db����Z*�d�d[�dc�d���Z+�dd�d����Z,�de�d����Z-�d[�df�d���Z.�dg�d����Z/�dh�Z0�d�a1�di�d����Z2�e�j3�dj���Z4�dk�dl�dm�d���Z5�dn�dn�dk�dl�do�d ���Z6�dn�dn�dk�dl�dp�d���Z7�dk�dl�dq�d���Z8�e9�dr���Z:�e;�e:���Z<�i��Z=�Gds�dt����dt�e�j>���Z?�du�d�d�dv�d���Z@�d�d�d�dw�d ���ZA�du�dx�d���ZB�dn�d�d�d�eA�dy�d ���ZC�dz�d{����ZD�d|�d}����ZE�d�aF�d~�d����ZG�d�aH�d��d�����ZI�d��d�����ZJ�d��d�����ZK�d�aL�d��d�����ZM�d��d��d����ZN�d��d�����ZO�d��d�����ZP�d��d�����ZQ�d��d�����ZR�d�S)�ac��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. �����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��Zftp�httpZgopherZnntpZimapZwais�fileZhttpsZshttpZmmsZprosperoZrtspZrtspuZsftpZsvnzsvn+sshZwsZwssZtelnetZsnewsZrsyncZnfsZgitzgit+sshZhdlZsipZsipsZtelZmailtoZnewszAabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+-.����c���������������C���s���t��j����t�j����d�S)z,Clear the parse cache and the quoters cache.N)�_parse_cache�clear� _safe_quoters��r���r����1/opt/alt/python35/lib64/python3.5/urllib/parse.py�clear_cacheS���s���� r ����ascii�strictc�������������C���s���|��S)Nr���)�objr���r���r����_noopb���s����r$���c�������������C���s���|��j��|�|���S)N)�encode)r#����encoding�errorsr���r���r����_encode_resulte���s����r(���c����������������s ���t�������f�d�d����|��D����S)Nc�������������3���s-���|��]#�}�|�r!�|�j���������n�d��Vq�d�S)r���N)�decode)�.0�x)r&���r'���r���r���� <genexpr>k���s����z_decode_args.<locals>.<genexpr>)�tuple)�argsr&���r'���r���)r&���r'���r����_decode_argsi���s����r/���c��������������G���sw���t��|��d�t���}�x?�|��d�d����D]-�}�|�r$�t��|�t���|�k�r$�t�d�����q$�W|�rf�|��t�f�St�|����t�f�S)Nr�������z$Cannot mix str and non-str arguments)� isinstance�str� TypeErrorr$���r/���r(���)r.���Z str_input�argr���r���r����_coerce_argsm���s����r5���c���������������@���s.���e��Z�d��Z�d�Z�f��Z�d�d�d�d���Z�d�S)�_ResultMixinStrz>Standard approach to encoding parsed results from str to bytesr!���r"���c����������������s#���|��j�������f�d�d����|��D�����S)Nc�������������3���s!���|��]�}�|�j���������Vq�d��S)N)r%���)r*���r+���)r&���r'���r���r���r,�������s����z)_ResultMixinStr.encode.<locals>.<genexpr>)�_encoded_counterpart)�selfr&���r'���r���)r&���r'���r���r%�������s����z_ResultMixinStr.encodeN)�__name__� __module__�__qualname__�__doc__� __slots__r%���r���r���r���r���r6���~���s���r6���c���������������@���s.���e��Z�d��Z�d�Z�f��Z�d�d�d�d���Z�d�S)�_ResultMixinBytesz>Standard approach to decoding parsed results from bytes to strr!���r"���c����������������s#���|��j�������f�d�d����|��D�����S)Nc�������������3���s!���|��]�}�|�j���������Vq�d��S)N)r)���)r*���r+���)r&���r'���r���r���r,�������s����z+_ResultMixinBytes.decode.<locals>.<genexpr>)�_decoded_counterpart)r8���r&���r'���r���)r&���r'���r���r)�������s����z_ResultMixinBytes.decodeN)r9���r:���r;���r<���r=���r)���r���r���r���r���r>�������s���r>���c���������������@���sd���e��Z�d��Z�d�Z�f��Z�e�d�d������Z�e�d�d������Z�e�d�d������Z�e�d�d ������Z �d �S)�_NetlocResultMixinBasezHShared methods for the parsed result objects containing a netloc elementc�������������C���s���|��j��d�S)Nr���)� _userinfo)r8���r���r���r����username����s����z_NetlocResultMixinBase.usernamec�������������C���s���|��j��d�S)Nr0���)rA���)r8���r���r���r����password����s����z_NetlocResultMixinBase.passwordc�������������C���s8���|��j��d�}�|�s�d��}�n�|�d��k �r4�|�j����}�|�S)Nr���)� _hostinfo�lower)r8����hostnamer���r���r���rF�������s���� z_NetlocResultMixinBase.hostnamec�������������C���sL���|��j��d�}�|�d��k �rH�t�|�d���}�d�|�k�o?�d�k�n�sH�d��S|�S)Nr0���� ���r���i����)rD����int)r8����portr���r���r���rI�������s���� z_NetlocResultMixinBase.portN) r9���r:���r;���r<���r=����propertyrB���rC���rF���rI���r���r���r���r���r@�������s��� r@���c���������������@���s:���e��Z�d��Z�f��Z�e�d�d������Z�e�d�d������Z�d�S)�_NetlocResultMixinStrc�������������C���sb���|��j��}�|�j�d���\�}�}�}�|�rN�|�j�d���\�}�}�}�|�sX�d��}�n �d��}�}�|�|�f�S)N�@�:)�netloc� rpartition� partition)r8���rN����userinfo� have_info�hostinforB���� have_passwordrC���r���r���r���rA�������s���� z_NetlocResultMixinStr._userinfoc�������������C���s����|��j��}�|�j�d���\�}�}�}�|�j�d���\�}�}�}�|�rr�|�j�d���\�}�}�}�|�j�d���\�}�}�}�n�|�j�d���\�}�}�}�|�s��d��}�|�|�f�S)NrL����[�]rM���)rN���rO���rP���)r8���rN����_rS����have_open_br� bracketedrF���rI���r���r���r���rD�������s���� z_NetlocResultMixinStr._hostinfoN)r9���r:���r;���r=���rJ���rA���rD���r���r���r���r���rK�������s���rK���c���������������@���s:���e��Z�d��Z�f��Z�e�d�d������Z�e�d�d������Z�d�S)�_NetlocResultMixinBytesc�������������C���sb���|��j��}�|�j�d���\�}�}�}�|�rN�|�j�d���\�}�}�}�|�sX�d��}�n �d��}�}�|�|�f�S)N����@����:)rN���rO���rP���)r8���rN���rQ���rR���rS���rB���rT���rC���r���r���r���rA�������s���� z!_NetlocResultMixinBytes._userinfoc�������������C���s����|��j��}�|�j�d���\�}�}�}�|�j�d���\�}�}�}�|�rr�|�j�d���\�}�}�}�|�j�d���\�}�}�}�n�|�j�d���\�}�}�}�|�s��d��}�|�|�f�S)Nr[�������[����]r\���)rN���rO���rP���)r8���rN���rW���rS���rX���rY���rF���rI���r���r���r���rD�������s���� z!_NetlocResultMixinBytes._hostinfoN)r9���r:���r;���r=���rJ���rA���rD���r���r���r���r���rZ�������s���rZ���)� namedtuplezurl fragmentz!scheme netloc path query fragmentz(scheme netloc path params query fragmentc���������������@���s"���e��Z�d��Z�f��Z�d�d����Z�d�S)r���c�������������C���s&���|��j��r�|��j�d�|��j��S|��j�Sd��S)N�#)�fragment�url)r8���r���r���r����geturl����s���� zDefragResult.geturlN)r9���r:���r;���r=���rc���r���r���r���r���r�������s���c���������������@���s"���e��Z�d��Z�f��Z�d�d����Z�d�S)r���c�������������C���s ���t��|����S)N)r���)r8���r���r���r���rc������s����zSplitResult.geturlN)r9���r:���r;���r=���rc���r���r���r���r���r�������s���c���������������@���s"���e��Z�d��Z�f��Z�d�d����Z�d�S)r���c�������������C���s ���t��|����S)N)r���)r8���r���r���r���rc�����s����zParseResult.geturlN)r9���r:���r;���r=���rc���r���r���r���r���r�����s���c���������������@���s"���e��Z�d��Z�f��Z�d�d����Z�d�S)r���c�������������C���s&���|��j��r�|��j�d�|��j��S|��j�Sd��S)N����#)ra���rb���)r8���r���r���r���rc�����s���� zDefragResultBytes.geturlN)r9���r:���r;���r=���rc���r���r���r���r���r��� ��s���c���������������@���s"���e��Z�d��Z�f��Z�d�d����Z�d�S)r���c�������������C���s ���t��|����S)N)r���)r8���r���r���r���rc�����s����zSplitResultBytes.geturlN)r9���r:���r;���r=���rc���r���r���r���r���r�����s���c���������������@���s"���e��Z�d��Z�f��Z�d�d����Z�d�S)r���c�������������C���s ���t��|����S)N)r���)r8���r���r���r���rc�����s����zParseResultBytes.geturlN)r9���r:���r;���r=���rc���r���r���r���r���r�����s���c��������������C���sN���t��t�f�t�t�f�t�t�f�f�}��x&�|��D]�\�}�}�|�|�_�|�|�_�q(�Wd��S)N)r���r���r���r���r���r���r7���r?���)Z _result_pairsZ_decodedZ_encodedr���r���r����_fix_result_transcoding��s���� re���Tc������� ������C���s����t��|��|���\�}��}�}�t�|��|�|���}�|�\�}�}�}��}�}�|�t�k�rl�d�|��k�rl�t�|����\�}��}�n�d�}�t�|�|�|��|�|�|���} �|�| ���S)a#��Parse a URL into 6 components: <scheme>://<netloc>/<path>;<params>?<query>#<fragment> Return a 6-tuple: (scheme, netloc, path, params, query, fragment). Note that we don't break the components up in smaller bits (e.g. netloc is a single string) and we don't expand % escapes.�;r���)r5���r����uses_params�_splitparamsr���) rb����scheme�allow_fragments�_coerce_resultZsplitresultrN����queryra����params�resultr���r���r���r���)��s����c�������������C���sq���d�|��k�r@�|��j��d�|��j�d�����}�|�d�k��rO�|��d�f�Sn�|��j��d���}�|��d��|���|��|�d�d����f�S)N�/rf���r���r���r0���)�find�rfind)rb����ir���r���r���rh���9��s���� rh���c�������������C���sh���t��|����}�x;�d�D]3�}�|��j�|�|���}�|�d�k�r�t�|�|���}�q�W|��|�|���|��|�d����f�S)Nz/?#r���)�lenrp����min)rb����start�delim�cZwdelimr���r���r����_splitnetlocB��s���� rx���c�������������C���s����|��s!�t��d�d����|��D����r%�d��Sd�d��l�}�|��j�d�d���}�|�j�d�d���}�|�j�d�d���}�|�j�d�d���}�|�j�d �|���}�|�|�k�r��d��Sx2�d �D]*�}�|�|�k�r��t�d�|��d�d �����q��Wd��S)Nc�������������s���s!���|��]�}�t��|���d��k�Vq�d�S)����N)�ord)r*���rw���r���r���r���r,���K��s����z_checknetloc.<locals>.<genexpr>r���rL���r���rM���r`����?ZNFKCz/?#@:znetloc 'z' contains invalid z#characters under NFKC normalization)�any�unicodedata�replaceZ normalize� ValueError)rN���r}����nZnetloc2rw���r���r���r����_checknetlocJ��s����! r����c������� ������C���s8��t��|��|���\�}��}�}�t�|���}�|��|�|�t�|����t�|���f�}�t�j�|�d���}�|�rg�|�|���St�t���t�k�r��t����d�}�}�}�|��j�d���} �| �d�k�rM|��d�| ���d�k�r�|��d�| ���j ����}�|��| �d�d���}��|��d�d���d�k�rPt �|��d���\�}�}��d �|�k�r,d �|�k�sDd �|�k�rPd �|�k�rPt�d�����|�rzd�|��k�rz|��j�d�d���\�}��}�d �|��k�r�|��j�d �d���\�}��}�t �|���t�|�|�|��|�|���} �| �t�|�<|�| ���Sxv�|��d�| ���D]�}�|�t�k�r�Pq�W|��| �d�d���}�|�s0t�d�d����|�D����rM|��d�| ���j ����|�}�}��|��d�d���d�k�r�t �|��d���\�}�}��d �|�k�r�d �|�k�s�d �|�k�r�d �|�k�r�t�d�����|�r�d�|��k�r�|��j�d�d���\�}��}�d �|��k�r|��j�d �d���\�}��}�t �|���t�|�|�|��|�|���} �| �t�|�<|�| ���S)a��Parse a URL into 5 components: <scheme>://<netloc>/<path>?<query>#<fragment> Return a 5-tuple: (scheme, netloc, path, query, fragment). Note that we don't break the components up in smaller bits (e.g. netloc is a single string) and we don't expand % escapes.Nr���rM���r���r���r0�������z//rU���rV���zInvalid IPv6 URLr`���r{���c�������������s���s���|��]�}�|�d��k�Vq�d�S)� 0123456789Nr���)r*���rw���r���r���r���r,������s����zurlsplit.<locals>.<genexpr>)r5����bool�typer����getrs����MAX_CACHE_SIZEr ���rp���rE���rx���r����splitr����r����scheme_charsr|���) rb���ri���rj���rk����key�cachedrN���rl���ra���rr����vrw����restr���r���r���r���\��s\����! c�������������C���sV���t��|�����\�}�}�}�}�}�}�}�|�r7�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)r5���r���)� componentsri���rN���rb���rm���rl���ra���rk���r���r���r���r������s����!c�������������C���s����t��|�����\�}�}�}�}�}�}�|�sL�|�r��|�t�k�r��|�d�d���d�k�r��|�rr�|�d�d���d�k�rr�d�|�}�d�|�p~�d�|�}�|�r��|�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����z//r0���ro���r���rM���r{���r`���)r5����uses_netloc)r����ri���rN���rb���rl���ra���rk���r���r���r���r������s����.� c�������������C���sR��|��s �|�S|�s�|��St��|��|���\�}��}�}�t�|��d�|���\�}�}�}�}�}�} �t�|�|�|���\�} �}�}�} �}�}�| �|�k�s��| �t�k�r��|�|���S| �t�k�r��|�r��|�t�| �|�|�| �|�|�f�����S|�}�|�r| �r|�}�|�} �|�s��|�}�|�t�| �|�|�| �|�|�f�����S|�j�d���}�|�d�d�k�r>|�d�=|�d�d���d�k�rf|�j�d���}�n6�|�|�j�d���}�t�d�|�d�d �����|�d�d ���<g��}�x_�|�D]W�}�|�d�k�r�y�|�j����Wq�t�k �r�Yq�Xq�|�d�k�r�q�q�|�j �|���q�W|�d�d�k�r!|�j �d���|�t�| �|�d�j �|���p?d�| �|�|�f�����S) zaJoin a base URL and a possibly relative URL to form an absolute interpretation of the latter.r���ro���r0���N�..�.���r����r����r����r����)r����r����)r5���r���� uses_relativer����r���r�����filter�pop� IndexError�append�join)�baserb���rj���rk���ZbschemeZbnetlocZbpathZbparamsZbqueryZ bfragmentri���rN����pathrm���rl���ra���Z base_partsZsegmentsZ resolved_pathZsegr���r���r���r������sT����$$ # c������� ������C���s|���t��|����\�}��}�d�|��k�r]�t�|����\�}�}�}�}�}�}�t�|�|�|�|�|�d�f���}�n�d�}�|��}�|�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���)r5���r���r���r���) rb���rk����sr�����p�a�qZfragZdefragr���r���r���r������s����!Z0123456789ABCDEFabcdefc�������������C���s ��|��s�|��j��d�St�|��t���r/�|��j�d���}��|��j��d���}�t�|���d�k�rT�|��S|�d�g�}�|�j�}�t�d�k�r��d�d����t�D��a�xq�|�d�d���D]_�}�y0�|�t�|�d�d �����|�|�d �d�����Wq��t�k �r��|�d���|�|���Yq��Xq��Wd�j �|���S) z,unquote_to_bytes('abc%20def') -> b'abc def'.�����zutf-8����%r0���r���Nc�������������S���sF���i��|��]<�}�t��D]/�}�t�t�|�|�d����g���|�|�j������q�q�S)����)�_hexdig�bytesrH���r%���)r*���r�����br���r���r���� <dictcomp>��s��� z$unquote_to_bytes.<locals>.<dictcomp>r����) r����r1���r2���r%���rs���r����� _hextobyter�����KeyErrorr����)�string�bits�resr�����itemr���r���r���r�����s*���� z([�-]+)zutf-8r~���c�������������C���s����d�|��k�r�|��j��|��S|�d�k�r)�d�}�|�d�k�r;�d�}�t�j��|����}�|�d�g�}�|�j�}�xR�t�d�t�|���d���D]8�}�|�t�|�|���j�|�|�����|�|�|�d���qy�Wd�j�|���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'. �%Nzutf-8r~���r���r0���r����r���)r�����_asciirer�����rangers���r���r)���r����)r����r&���r'���r����r����r����rr���r���r���r���r���,��s���� Fc������� ������C���sl���i��}�t��|��|�|�d�|�d�|��}�xA�|�D]9�\�}�}�|�|�k�rW�|�|�j�|���q+�|�g�|�|�<q+�W|�S)an��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. Returns a dictionary. r&���r'���)r ���r����) �qs�keep_blank_values�strict_parsingr&���r'���Z parsed_result�pairs�name�valuer���r���r���r ���F��s����c�������������C���sM��t��|����\�}��}�d�d����|��j�d���D��}�g��}�x|�D] }�|�rR�|�rR�q;�|�j�d�d���} �t�| ���d�k�r��|�r��t�d�|�f�����|�r;�| �j�d���n�q;�t�| �d���s��|�r;�| �d �j�d �d���} �t�| �d�|�d �|��} �|�| ���} �| �d�j�d �d���}�t�|�d�|�d �|��}�|�|���}�|�j�| �|�f���q;�W|�S)an��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. Returns a list, as G-d intended. c�������������S���s,���g��|��]"�}�|�j��d����D]�}�|���q�q�S)rf���)r����)r*����s1�s2r���r���r���� <listcomp>���s��� �zparse_qsl.<locals>.<listcomp>�&�=r0���r����zbad query field: %rr���r����+� r&���r'���)r5���r����rs���r���r����r~���r���)r����r����r����r&���r'���rk���r�����rZ name_valueZnvr����r����r���r���r���r ���i��s,���� c�������������C���s"���|��j��d�d���}��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����r&���r'���r���r���r���r������s����sA���ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_.-c���������������@���s:���e��Z�d��Z�d�Z�d�d����Z�d�d����Z�d�d����Z�d�S) �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��j�|���|��_�d�S)zsafe: bytes object.N)�_ALWAYS_SAFE�union�safe)r8���r����r���r���r����__init__���s����zQuoter.__init__c�������������C���s���d�|��j��j�t�|����f�S)Nz<%s %r>)� __class__r9����dict)r8���r���r���r����__repr__���s����zQuoter.__repr__c�������������C���s8���|�|��j��k�r�t�|���n�d�j�|���}�|�|��|�<|�S)Nz%{:02X})r�����chr�format)r8���r����r����r���r���r����__missing__���s����* zQuoter.__missing__N)r9���r:���r;���r<���r����r����r����r���r���r���r���r�������s���r����ro���c�������������C���s����t��|��t���rR�|��s�|��S|�d�k�r+�d�}�|�d�k�r=�d�}�|��j�|�|���}��n0�|�d�k �rj�t�d�����|�d�k �r��t�d�����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. RFC 2396 Uniform Resource Identifiers (URI): Generic Syntax lists the following reserved characters. reserved = ";" | "/" | "?" | ":" | "@" | "&" | "=" | "+" | "$" | "," Each of these characters is reserved in some component of a URL, but not necessarily in all of them. By default, the quote function is intended for quoting the path section of a URL. Thus, it will not encode '/'. This character is reserved, but in typical usage the quote function is being called on a path where the existing slash characters are used as reserved 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). Nzutf-8r"���z,quote() doesn't support 'encoding' for bytesz*quote() doesn't support 'errors' for bytes)r1���r2���r%���r3���r ���)r����r����r&���r'���r���r���r���r������s����c�������������C���s����t��|��t���r�d�|��k�s6�t��|��t���rI�d�|��k�rI�t�|��|�|�|���St��|�t���ra�d�}�n�d�}�t�|��|�|�|�|���}��|��j�d�d���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����)r1���r2���r����r���r~���)r����r����r&���r'���Zspacer���r���r���r������s���� c����������������s����t��|��t�t�f���s!�t�d�����|��s+�d�St��|�t���rO�|�j�d�d���}�n�t�d�d����|�D����}�|��j�t�|���s��|��j����Sy�t �|����Wn)�t �k �r��t�|���j�t �|�<���Yn�Xd�j ����f�d�d����|��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�|���q�S)����r���)r*���rw���r���r���r���r���� ��s��� �z$quote_from_bytes.<locals>.<listcomp>c����������������s���g��|��]�}����|�����q�Sr���r���)r*����char)�quoterr���r���r������s��� �)r1���r����� bytearrayr3���r2���r%����rstrip�_ALWAYS_SAFE_BYTESr)���r���r����r�����__getitem__r����)Zbsr����r���)r����r���r ������s���� c�������������C���s���t��|��d���r�|��j����}��ni�y*�t�|����rG�t�|��d�t���rG�t���Wn<�t�k �r��t�j����\�}�}�}�t�d���j�|�����Yn�Xg��} �|�s:x |��D]��\�} �}�t�| �t ���r��|�| �|���} �n�|�t �| ���|�|�|���} �t�|�t ���r|�|�|���}�n�|�t �|���|�|�|���}�| �j�| �d�|���q��Wn|xy|��D]q\�} �}�t�| �t ���rn|�| �|���} �n�|�t �| ���|�|�|���} �t�|�t ���r�|�|�|���}�| �j�| �d�|���qAt�|�t ���r�|�|�|�|�|���}�| �j�| �d�|���qAy�t�|���}�WnB�t�k �rO|�t �|���|�|�|���}�| �j�| �d�|���YqAXx_�|�D]W�} �t�| �t ���r~|�| �|���} �n�|�t �| ���|�|�|���} �| �j�| �d�| ���qWWqAWd�j�| ���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����) �hasattrr����rs���r1���r-���r3����sys�exc_info�with_tracebackr����r2���r����r����)rl���Zdoseqr����r&���r'���Z quote_viaZtyZva�tb�l�kr����r+���Zeltr���r���r���r�����sP���� c�������������C���s[���t��|��t���rW�y�|��j�d���j����}��Wn,�t�k �rV�t�d�t�|����d�����Yn�X|��S)zto_bytes(u"URL") --> 'URL'.�ASCIIzURL z contains non-ASCII characters)r1���r2���r%���r)����UnicodeError�repr)rb���r���r���r����to_bytesb��s���� r����c�������������C���s����t��|����j����}��|��d�d���d�k�rT�|��d�d���d�k�rT�|��d�d���j����}��|��d�d���d�k�r��|��d�d���j����}��|��S) z8unwrap('<URL:type://host/path>') --> 'type://host/path'.Nr0����<�>����zURL:r����r����)r2����strip)rb���r���r���r����unwrapo��s����,�r����c�������������C���sb���t��d�k�r!�t�j�d�t�j���a��t��j�|����}�|�rX�|�j����\�}�}�|�j����|�f�Sd�|��f�S)z:splittype('type:opaquestring') --> 'type', 'opaquestring'.Nz ([^/:]+):(.*))� _typeprog�re�compile�DOTALL�match�groupsrE���)rb���r����ri����datar���r���r���� splittypex��s����r����c�������������C���s|���t��d�k�r!�t�j�d�t�j���a��t��j�|����}�|�rr�|�j����\�}�}�|�rh�|�d�d�k�rh�d�|�}�|�|�f�Sd�|��f�S)z;splithost('//host[:port]/path') --> 'host[:port]', '/path'.Nz//([^/#?]*)(.*)r���ro���)� _hostprogr����r����r����r����r����)rb���r����Z host_portr����r���r���r���� splithost���s���� r����c�������������C���s.���|��j��d���\�}�}�}��|�r$�|�n�d�|��f�S)zJsplituser('user[:passwd]@host[:port]') --> 'user[:passwd]', 'host[:port]'.rL���N)rO���)�host�userrv���r���r���r���� splituser���s����r����c�������������C���s.���|��j��d���\�}��}�}�|��|�r'�|�n�d�f�S)z/splitpasswd('user:passwd') -> 'user', 'passwd'.rM���N)rP���)r����rv���Zpasswdr���r���r����splitpasswd���s����r����c�������������C���sb���t��d�k�r!�t�j�d�t�j���a��t��j�|����}�|�rX�|�j����\�}��}�|�rX�|��|�f�S|��d�f�S)z*splitport('host:port') --> 'host', 'port'.Nz(.*):([0-9]*)$)� _portprogr����r����r����r����r����)r����r����rI���r���r���r���� splitport���s���� r����r0���c�������������C���sl���|��j��d���\�}��}�}�|�s'�|�}��n;�|�rb�y�t�|���}�Wn�t�k �rW�d�}�Yn�X|��|�f�S|��|�f�S)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.rM���N)rO���rH���r���)r����Zdefportrv���rI���Znportr���r���r���� splitnport���s���� r����c�������������C���s2���|��j��d���\�}�}�}�|�r(�|�|�f�S|��d�f�S)z/splitquery('/path?query') --> '/path', 'query'.r{���N)rO���)rb���r����rv���rl���r���r���r���� splitquery���s���� r����c�������������C���s2���|��j��d���\�}�}�}�|�r(�|�|�f�S|��d�f�S)z)splittag('/path#tag') --> '/path', 'tag'.r`���N)rO���)rb���r����rv����tagr���r���r����splittag���s���� r����c�������������C���s'���|��j��d���}�|�d�|�d�d���f�S)zksplitattr('/path;attr1=value1;attr2=value2;...') -> '/path', ['attr1=value1', 'attr2=value2', ...].rf���r���r0���N)r����)rb���Zwordsr���r���r���� splitattr���s����r����c�������������C���s.���|��j��d���\�}��}�}�|��|�r'�|�n�d�f�S)z-splitvalue('attr=value') --> 'attr', 'value'.r����N)rP���)�attrrv���r����r���r���r���� splitvalue���s����r����r����)Sr<���r����r�����collections�__all__r����r����rg���Znon_hierarchicalZ uses_queryZ uses_fragmentr����r����r���r ���Z_implicit_encodingZ_implicit_errorsr$���r(���r/���r5����objectr6���r>���r@���rK���rZ���r_���Z_DefragResultBaseZ_SplitResultBaseZ_ParseResultBaseZ ResultBaser���r���r���r���r���r���re���r���rh���rx���r����r���r���r���r���r���r����r����r���r����r����r���r ���r ���r���� frozensetr����r����r����r����defaultdictr����r���r���r ���r���r����r����r����r����r����r����r����r����r����r����r����r����r����r����r����r���r���r���r����<module>���s���� :E"/ ,O