https://t.me/AnonymousX5
Server : Apache
System : Linux cvar2.toservers.com 3.10.0-962.3.2.lve1.5.73.el7.x86_64 #1 SMP Wed Aug 24 21:31:23 UTC 2022 x86_64
User : njnconst ( 1116)
PHP Version : 8.4.18
Disable Function : NONE
Directory :  /lib/python2.7/site-packages/asn1crypto/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python2.7/site-packages/asn1crypto/_iri.pyc
�
y�\c@`s>dZddlmZmZmZmZddlmZddlZddl	Z	ddl
Z
ddlmZddl
mZmZmZmZmZe
jdkr�dd	lmZmZdd
lmZmZn"ddlmZmZmZmZd�Zd
�Zd�Zej de�dd�Z!ddd�Z#dS(u�
Functions to convert unicode IRIs into ASCII byte string URIs and back. Exports
the following items:

 - iri_to_uri()
 - uri_to_iri()
i(tunicode_literalstdivisiontabsolute_importtprint_function(tidnaNi(tunwrap(tbyte_clststr_clst	type_namet
bytes_to_listt	int_typesi(turlsplitt
urlunsplit(tquotetunquote(R
tunquote_to_bytesRRc
C`s�t|t�s-ttdt|����nd}tjdkr�|jd�r�|jd�r�d}t	j
d|�}|r�|jd�}d|t|�}nt
|�}|r�||d}t|d �}q�nt
|�}|dkrt|j�}n|j}|dk	r-|jd	�}nt|jd
d�}t|jd
d�}|j}|dk	r�t|�jd�}nd
}	|dk	r�|	|7}	|r�|	d|7}	n|	d7}	n|dk	r�|	|7}	n|dk	r;|dko�|dk}
|dko|dk}|
r;|r;|	d|7}	q;nt|jd
d�}t|jd
d�}
t|jd
d�}|
dkr�|dkr�|dkr�d}n|dkr�d}nt||	||
|f�}t|t�r�|jd�}n|S(u�
    Normalizes and encodes a unicode IRI into an ASCII byte string URI

    :param value:
        A unicode string of an IRI

    :return:
        A byte string of the ASCII-encoded URI
    u@
            value must be a unicode string, not %s
            iiuhttp://uhttps://u	^[^:]*://ii����uidnatsafeu!$&'()*+,;=uasciitt:t@thttpt80thttpst443u/!$&'()*+,;=@:u/?!$&'()*+,;=@:t/uulatin1N(ii(t
isinstanceRt	TypeErrorRRtNonetsystversion_infot
startswithtretmatchtgrouptlenRt	_urlquotetschemethostnametencodetusernametpasswordtporttpathtquerytfragmentR(tvalueR$treal_prefixtprefix_matchtparsedR%R'R(R)tnetloctdefault_httpt
default_httpsR*R+R,toutput((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/_iri.pyt
iri_to_uri%sd/		


$		cC`s�t|t�s-ttdt|����nt|�}|j}|dk	r`|jd�}nt	|j
dddg�}t	|jdddg�}|j}|r�|jd�}n|j
}|r�t|t�r�|jd�}nd}|dk	r(||7}|r|d|7}n|d7}n|dk	rA||7}n|dk	rd|dt|�7}nt	|jddgd	t�}t	|jdd
dgd	t�}	t	|j�}
t||||	|
f�S(
u�
    Converts an ASCII URI byte string into a unicode IRI

    :param value:
        An ASCII-encoded byte string of the URI

    :return:
        A unicode string of the IRI
    u=
            value must be a byte string, not %s
            uasciitremapu:u@uidnauu/tpreserveu&u=N(RRRRRRR$Rtdecodet_urlunquoteR'R(R%R)R
RR*tTrueR+R,R(R-R0R$R'R(R%R)R1R*R+R,((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/_iri.pyt
uri_to_irius<			


!cC`sOt|j|j|j!�}g|D]}d|^q#}dj|�|jfS(u>
    Error handler for decoding UTF-8 parts of a URI into an IRI. Leaves byte
    sequences encoded in %XX format, but as part of a unicode string.

    :param exc:
        The UnicodeDecodeError exception

    :return:
        A 2-element tuple of (replacement unicode string, integer index to
        resume at)
    u%%%02xu(R	tobjecttstarttendtjoin(texct
bytes_as_intstnumtreplacements((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/_iri.pyt_iri_utf8_errors_handler�s
uiriutf8uc`s|dks|dkrdSg�tjd|�r�fd�}tjd||�}�fd�}tjd||�}nt|jd�d�jd��}t|t�s�|jd�}nt��d	kr��fd
�}tjd||�}n|S(
u
    Quotes a unicode string for use in a URL

    :param string:
        A unicode string

    :param safe:
        A unicode string of character to not encode

    :return:
        None (if string is None) or an ASCII byte string of the quoted string
    uu%[0-9a-fA-F]{2}c`s^t|jd��}|jdd�}x0t��D]"}|j|dt|��}q4W|S(Niuutf-8uiriutf8u%%%02x(RR!R8tlisttreplacetord(R tbyte_stringtunicode_stringt	safe_char(R(s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/_iri.pyt
_try_unescape�s
 u(?:%[0-9a-fA-F]{2})+c`s#�j|jd�jd��dS(Niuasciiu(tappendR!R&(R (tescapes(s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/_iri.pyt_extract_escape�suutf-8Ruasciiic`s
�jd�S(Ni(tpop(t_(RM(s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/_iri.pyt_return_escape�ss%00N(	RRtsearchtsubturlquoteR&RRR"(tstringRRKRNR4RQ((RMRs5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/_iri.pyR#�s$c	C`s4|d
kr|S|dkr dS|r�dddddg}i}xN|D]C}|jd�}|||<|j|jd	�|jd	��}qHWnt|�}|r�x?|D]4}|j|jd	�d
t|�jd	��}q�Wn|jdd�}|r0x/|j�D]\}}|j||�}qWn|S(u
    Unquotes a URI portion from a byte string into unicode using UTF-8

    :param byte_string:
        A byte string of the data to unquote

    :param remap:
        A list of characters (as unicode) that should be re-mapped to a
        %XX encoding. This is used when characters are not valid in part of a
        URL.

    :param preserve:
        A bool - indicates that the chars to be remapped if they occur in
        non-hex form, should be preserved. E.g. / for URL path.

    :return:
        A unicode string
    Ruuuuuuiuasciiu%%%02xuutf-8uiriutf8N(RRORFR&RRGR8titems(	RHR6R7RCtpreserve_unmaptchartreplacementR4toriginal((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/_iri.pyR9�s(

+
5(i($t__doc__t
__future__RRRRt	encodingsRtcodecsRRt_errorsRt_typesRRRR	R
RturlparseRRturllibR
RTRRturllib.parseR5R;RDtregister_errorR#RR9(((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/_iri.pyt<module>	s""("	P	4	4

https://t.me/AnonymousX5 - 2025