[ Avaa Bypassed ]




Upload:

Command:

hmhc3928@3.139.86.170: ~ $


�t�_���@s�ddlZddlmZddlZddlZddlmZddlZddl	Z	ddl
Z
ddlZddlZddl
Z
ddlZyddlZWnek
r�dZYnXddlZddlZddlZddlZddlZyddlZWnek
r/ddlZYnXddlZddlmZddlmZmZmZmZm Z m!Z!m"Z"m#Z#m$Z$m%Z%m&Z&m'Z'm(Z(m)Z)m*Z*m+Z+m,Z,m-Z-m.Z.m/Z/m0Z0e
j1e2�Z3e
j4d�Z5e
j4d�Z6e
j4d	�Z7e
j4d
�Z8e
j4d�Z9e
j4d�Z:e
j4d
�Z;e
j4d�Z<dd�Z=dd�Z>dd�Z?dd�Z@dd�ZAdddd�ZBdd�ZCdd�ZDdd �ZEejFd!d"��ZGejFd#d$��ZHejFd%d&d'��ZIGd(d)�d)eJ�ZKd*d+�ZLGd,d-�d-eJ�ZMd.d/�ZNGd0d1�d1eJ�ZOe
j4d2e
jP�ZQd3d4�ZRdd5d6�ZSd7d8�ZTd9d:�ZUd;d<�ZVd=d>�ZWd?d@�ZXe
j4dAe
jY�ZZe
j4dB�Z[ddCdD�Z\e
j4dE�Z]dFdG�Z^dHdI�Z_dJdK�Z`dLZadMdN�ZbdOdP�ZcGdQdR�dReJ�ZdGdSdT�dTeJ�ZeGdUdV�dVeJ�Zfd�Zgdd^d_d`�Zhdadb�Zid�ZjGdidj�djeJ�Zke
j4dk�Zle
j4dl�Zme
j4dm�Zndndo�Zdpdq�Zoer�ddrlmpZqmrZrmsZsGdsdt�dte$jt�ZtGdudv�dveq�ZpGdwdx�dxepe'�Zuejvddy�Zwewd�kr�Gd{d|�d|e$jx�Zxer�Gd}d~�d~e$jy�ZyGdd��d�e%jz�ZzerGd�d��d�e%j{�Z{Gd�d��d�e%j|�Z|d�d��Z}Gd�d��d�eJ�Z~Gd�d��d�e~�ZGd�d��d�e~�Z�Gd�d��d�e(�Z�Gd�d��d�eJ�Z�d�d��Z�dS)��N)�deque)�iglob�)�DistlibException)�string_types�	text_type�shutil�	raw_input�StringIO�cache_from_source�urlopen�urljoin�httplib�	xmlrpclib�	splittype�HTTPHandler�BaseConfigurator�valid_ident�	Container�configparser�URLError�ZipFile�fsdecode�unquote�urlparsez^([\w\.-]+)\s*z^([\w\.*+-]+)\s*z^(<=?|>=?|={2,3}|[~!]=)\s*z*^((<=?)|(>=?)|={2,3}|[~!]=|in|not\s+in)\s*z^or\b\s*z	^and\b\s*z(\S+)\s*z(([\s\w\.{}()*+#:;,/?!~`@$%^&=|<>\[\]-]+)csOdd����fdd���fdd���fdd���|�S)	ae
    Parse a marker string and return a dictionary containing a marker expression.

    The dictionary will contain keys "op", "lhs" and "rhs" for non-terminals in
    the expression grammar, or strings. A string contained in quotes is to be
    interpreted as a literal string, and a string not contained in quotes is a
    variable (such as os_name).
    cSs�tj|�}|r>|j�d}||j�d�}nZ|sStd��nE|d}|dkrytd|��dj|d�}|dd�}|g}x�|rF|d|kr�Pq�|d|kr�|j|�|dd�}q�tj|�}|std|��|j|j�d�||j�d�}q�Wdj|�}td|��|j|�dj|�}|dd�j	�}||fS)	Nrzunexpected end of inputz'"zinvalid expression: %s�rzerror in string literal: %szunterminated string: %s)
�
IDENTIFIER�match�groups�end�SyntaxError�replace�append�STRING_CHUNK�join�lstrip)�	remaining�m�result�q�oq�parts�s�r-��/builddir/build/BUILDROOT/alt-python35-pip-20.2.4-1.el7.x86_64/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/distlib/util.py�
marker_varAs:
		

z parse_marker.<locals>.marker_varcs|rq|ddkrq�|dd�j��\}}|ddkrXtd|��|dd�j�}n��|�\}}xp|r�tj|�}|s�P|j�d}||j�d�}�|�\}}d|d|d|i}q�W|}||fS)	Nr�(r�)zunterminated parenthesis: %s�op�lhs�rhs)r%r �	MARKER_OPrrr)r&r(r3r'r2r4)�markerr/r-r.�marker_expres "	z!parse_marker.<locals>.marker_exprcs�|�\}}x`|rttj|�}|s1P||j�d�}�|�\}}ddd|d|i}qW||fS)Nr2�andr3r4)�ANDrr)r&r3r'r4)r7r-r.�
marker_andxs	z parse_marker.<locals>.marker_andcs�|�\}}x`|rttj|�}|s1P||j�d�}�|�\}}ddd|d|i}qW||fS)Nr2�orr3r4)�ORrr)r&r3r'r4)r:r-r.r6�s	zparse_marker.<locals>.markerr-)�
marker_stringr-)r6r:r7r/r.�parse_marker8s
	$r>c
CsD|j�}|s"|jd�r&dStj|�}|sKtd|��|j�d}||j�d�}d}}}}|r�|ddkr�|jdd�}|dkr�td|��|d|�}	||dd�j�}g}x�|	r�tj|	�}|s%td	|	��|j	|j�d�|	|j�d�}	|	sYP|	dd
krytd|	��|	dd�j�}	q�W|s�d}|rp|ddkrM|dd�j�}t
j|�}|s�td
|��|j�d}t|�}
|
jo|
j
s.td|��||j�d�j�}n#dd�}|ddkr~||�\}}n�|jdd�}|dkr�td|��|d|�}	||dd�j�}tj|	�r�||	�\}}nvtj|	�}|std|	��|j�d}
|	|j�d�j�}	|	ratd|	��d|
fg}|r�|ddkr�td|��|dd�j�}t|�\}}|r�|ddkr�td|��|s�|}n&d|djdd�|D��f}td|d|d|d |d!|d"|�S)#z�
    Parse a requirement passed in as a string. Return a Container
    whose attributes contain the various parts of the requirement.
    �#Nzname expected: %sr�[�]rzunterminated extra: %szmalformed extra: %s�,zcomma expected in extras: %s�@zinvalid URI: %szInvalid URL: %scSstj|�}d}|rg}x�|j�d}||j�d�}tj|�}|sotd|��|j�d}|j||f�||j�d�}|s�|ddkr�P|dd�j�}tj|�}|s$td|��q$W|sd}||fS)z|
                Return a list of operator, version tuples if any are
                specified, else None.
                Nrzinvalid version: %srBrzinvalid constraint: %s)�
COMPARE_OPrrr�VERSION_IDENTIFIERr r"r%)�
ver_remainingr'�versionsr2�vr-r-r.�get_versions�s,z'parse_requirement.<locals>.get_versionsr0r1zunterminated parenthesis: %szinvalid constraint: %sz~=�;zinvalid requirement: %szunexpected trailing data: %sz%s %sz, cSsg|]}d|�qS)z%s %sr-)�.0�conr-r-r.�
<listcomp>s	z%parse_requirement.<locals>.<listcomp>�name�extras�constraintsr6�url�requirement)�strip�
startswithrrr rr�findr%r"�	NON_SPACEr�scheme�netlocrDrEr>r$r)�reqr&r'�distnamerO�	mark_exprrG�uri�ir,�trI�_rH�rsr-r-r.�parse_requirement�s�		&racCs�dd�}i}x�|D]�\}}}tjj||�}x�t|�D]�}tjj||�}	x�t|	�D]v}
|||
�}|dkr�|j|d�qr|||
�}|jtjjd�jd�}
|
d|||<qrWqJWqW|S)z%Find destinations for resources filescSsb|jtjjd�}|jtjjd�}|j|�sEt�|t|�d�jd�S)N�/)r!�os�path�seprT�AssertionError�lenr%)�rootrdr-r-r.�get_rel_path
sz)get_resources_dests.<locals>.get_rel_pathNrb)rcrdr$r�popr!re�rstrip)�resources_root�rulesri�destinations�base�suffix�dest�prefix�abs_base�abs_glob�abs_path�
resource_file�rel_path�rel_destr-r-r.�get_resources_dests
s!rycCs:ttd�rd}ntjttdtj�k}|S)N�real_prefixT�base_prefix)�hasattr�sysrr�getattr)r(r-r-r.�in_venv$s	rcCs4tjjtj�}t|t�s0t|�}|S)N)rcrd�normcaser}�
executable�
isinstancerr)r(r-r-r.�get_executable.s
r�cCsr|}xet|�}|}|r.|r.|}|r	|dj�}||krQP|r	d|||f}q	W|S)Nrz	%c: %s
%s)r	�lower)�prompt�
allowed_chars�error_prompt�default�pr,�cr-r-r.�proceed>s
r�cCsPt|t�r|j�}i}x(|D] }||kr(||||<q(W|S)N)r�r�split)�d�keysr(�keyr-r-r.�extract_by_keyNs
r�cCs�tjddkr(tjd�|�}|j�}t|�}y�tj|�}|ddd}xo|j�D]a\}}xR|j�D]D\}}d||f}t	|�}	|	dk	s�t
�|	||<q�WqqW|SWn"tk
r�|jdd�YnXdd	�}
t
j�}y|
||�WnGt
jk
rr|j�tj|�}t|�}|
||�YnXi}xz|j�D]l}i||<}xU|j|�D]D\}
}d|
|f}t	|�}	|	dk	s�t
�|	||
<q�Wq�W|S)
Nr�zutf-8�
extensionszpython.exports�exportsz%s = %scSs0t|d�r|j|�n
|j|�dS)N�	read_file)r|r��readfp)�cp�streamr-r-r.�read_streamksz!read_exports.<locals>.read_stream)r}�version_info�codecs�	getreader�readr
�json�load�items�get_export_entryrf�	Exception�seekr�ConfigParser�MissingSectionHeaderError�close�textwrap�dedent�sections)r��data�jdatar(�group�entries�krHr,�entryr�r�r�rN�valuer-r-r.�read_exportsWsD

r�cCs�tjddkr(tjd�|�}tj�}x�|j�D]�\}}|j|�x�|j�D]r}|j	dkr�|j
}nd|j
|j	f}|jr�d|dj|j�f}|j
||j|�qgWqAW|j|�dS)Nrr�zutf-8z%s:%sz%s [%s]z, )r}r�r��	getwriterrr�r��add_section�valuesrprr�flagsr$�setrN�write)r�r�r�r�rHr�r,r-r-r.�
write_exports�s
	r�ccs*tj�}z	|VWdtj|�XdS)N)�tempfile�mkdtempr�rmtree)�tdr-r-r.�tempdir�s	r�ccs7tj�}ztj|�dVWdtj|�XdS)N)rc�getcwd�chdir)r��cwdr-r-r.r��s

	r��ccs7tj�}ztj|�dVWdtj|�XdS)N)�socket�getdefaulttimeout�setdefaulttimeout)�seconds�ctor-r-r.�socket_timeout�s

	r�c@s+eZdZdd�Zddd�ZdS)�cached_propertycCs
||_dS)N)�func)�selfr�r-r-r.�__init__�szcached_property.__init__NcCs<|dkr|S|j|�}tj||jj|�|S)N)r��object�__setattr__�__name__)r��obj�clsr�r-r-r.�__get__�s
zcached_property.__get__)r��
__module__�__qualname__r�r�r-r-r-r.r��sr�cCs�tjdkr|S|s|S|ddkr=td|��|ddkr]td|��|jd�}x#tj|kr�|jtj�qoW|s�tjStjj|�S)a�Return 'pathname' as a name that will work on the native filesystem.

    The path is split on '/' and put back together again using the current
    directory separator.  Needed because filenames in the setup script are
    always supplied in Unix style, and have to be converted to the local
    convention before we can actually use them in the filesystem.  Raises
    ValueError on non-Unix-ish systems if 'pathname' either starts or
    ends with a slash.
    rbrzpath '%s' cannot be absoluterzpath '%s' cannot end with '/'���)rcre�
ValueErrorr��curdir�removerdr$)�pathname�pathsr-r-r.�convert_path�s
r�c@s�eZdZddd�Zdd�Zdd�Zdd	�Zd
dd�Zd
dd�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
ddd
ddd�Zdd�Zdd�Zd d!�Zd"d#�Zd
S)$�FileOperatorFcCs#||_t�|_|j�dS)N)�dry_runr��ensured�_init_record)r�r�r-r-r.r��s	zFileOperator.__init__cCs%d|_t�|_t�|_dS)NF)�recordr��
files_written�dirs_created)r�r-r-r.r��s	zFileOperator._init_recordcCs|jr|jj|�dS)N)r�r��add)r�rdr-r-r.�record_as_written�s	zFileOperator.record_as_writtencCsftjj|�s.tdtjj|���tjj|�sDdStj|�jtj|�jkS)a�Tell if the target is newer than the source.

        Returns true if 'source' exists and is more recently modified than
        'target', or if 'source' exists and 'target' doesn't.

        Returns false if both exist and 'target' is the same age or younger
        than 'source'. Raise PackagingFileError if 'source' does not exist.

        Note that this test is not very accurate: files created in the same
        second will have the same "age".
        zfile '%r' does not existT)rcrd�existsr�abspath�stat�st_mtime)r��source�targetr-r-r.�newer�szFileOperator.newerTcCs�|jtjj|��tjd||�|js�d}|r�tjj|�r`d|}n/tjj|�r�tjj	|�r�d|}|r�t
|d��tj||�|j
|�dS)z8Copy a file respecting dry-run and force flags.
        zCopying %s to %sNz%s is a symlinkz%s is a non-regular filez which would be overwritten)�
ensure_dirrcrd�dirname�logger�infor��islinkr��isfiler�r�copyfiler�)r��infile�outfile�check�msgr-r-r.�	copy_files	
%
zFileOperator.copy_fileNc
Cs�tjj|�st�|jtjj|��tjd||�|js�|dkrlt	|d�}nt
j	|dd|�}ztj||�Wd|j
�X|j|�dS)NzCopying stream %s to %s�wb�w�encoding)rcrd�isdirrfr�r�r�r�r��openr�r�copyfileobjr�r�)r��instreamr�r��	outstreamr-r-r.�copy_streams	zFileOperator.copy_streamc	Csx|jtjj|��|jsgtjj|�rAtj|�t|d��}|j|�WdQRX|j	|�dS)Nr�)
r�rcrdr�r�r�r�r�r�r�)r�rdr��fr-r-r.�write_binary_file!s	
zFileOperator.write_binary_filecCs|j||j|��dS)N)r�encode)r�rdr�r�r-r-r.�write_text_file*szFileOperator.write_text_filecCs�tjdks-tjdkr�tjdkr�xg|D]_}|jrVtjd|�q4tj|�j|B|@}tjd||�tj||�q4WdS)N�posix�javazchanging mode of %szchanging mode of %s to %o)	rcrN�_namer�r�r�r��st_mode�chmod)r��bits�mask�filesr��moder-r-r.�set_mode-s-
	zFileOperator.set_modecCs|jdd|�S)Nimi�)r)r,r�r-r-r.�<lambda>9szFileOperator.<lambda>cCs�tjj|�}||jkr�tjj|�r�|jj|�tjj|�\}}|j|�tj	d|�|j
s�tj|�|jr�|j
j|�dS)NzCreating %s)rcrdr�r�r�r�r�r�r�r�r��mkdirr�r�)r�rdr�r�r-r-r.r�;s"
	
	zFileOperator.ensure_dirc	Cs�t||�}tjd||�|js�|sD|j||�r~|sSd}n+|j|�sht�|t|�d�}i}|r�tt	d�r�t	j
j|d<t	j|||d|�|j
|�|S)NzByte-compiling %s to %s�PycInvalidationMode�invalidation_modeT)rr�r�r�r�rTrfrgr|�
py_compiler�CHECKED_HASH�compiler�)	r�rd�optimize�forcerr�hashed_invalidation�dpath�diagpath�compile_kwargsr-r-r.�byte_compileGs		
zFileOperator.byte_compilecCs�tjj|�r�tjj|�r�tjj|�r�tjd|�|js]tj	|�|j
r�||jkr�|jj|�nrtjj|�r�d}nd}tjd||�|js�tj|�|j
r�||j
kr�|j
j|�dS)NzRemoving directory tree at %s�link�filezRemoving %s %s)rcrdr�r�r�r��debugr�rr�r�r�r�r�)r�rdr,r-r-r.�ensure_removedXs"%	
			
	zFileOperator.ensure_removedcCsdd}xW|s_tjj|�r7tj|tj�}Ptjj|�}||krVP|}q	W|S)NF)rcrdr��access�W_OKr�)r�rdr(�parentr-r-r.�is_writablems	
zFileOperator.is_writablecCs/|jst�|j|jf}|j�|S)zV
        Commit recorded changes, turn off recording, return
        changes.
        )r�rfr�r�r�)r�r(r-r-r.�commitys
zFileOperator.commitcCs�|js�x6t|j�D]%}tjj|�rtj|�qWt|jdd�}xk|D]c}tj	|�}|r�|dgks�t
�tjj||d�}tj|�tj|�q^W|j
�dS)N�reverseT�__pycache__r)r��listr�rcrdr�r��sortedr��listdirrfr$�rmdirr�)r�r��dirsr��flist�sdr-r-r.�rollback�s	

zFileOperator.rollback)r�r�r�r�r�r�r�r�r�rrr�set_executable_moder�rrr"r#r-r-r-r-r.r��s 	
r�cCs�|tjkrtj|}nt|�}|dkr@|}nG|jd�}t||jd��}x|D]}t||�}qnW|S)N�.r)r}�modules�
__import__r�r~rj)�module_name�dotted_path�modr(r+r�r-r-r.�resolve�s	
r5c@sOeZdZdd�Zedd��Zdd�Zdd�Zej	Z	d	S)
�ExportEntrycCs(||_||_||_||_dS)N)rNrrrpr�)r�rNrrrpr�r-r-r.r��s			zExportEntry.__init__cCst|j|j�S)N)r5rrrp)r�r-r-r.r��szExportEntry.valuecCs d|j|j|j|jfS)Nz<ExportEntry %s = %s:%s %s>)rNrrrpr�)r�r-r-r.�__repr__�szExportEntry.__repr__cCsdt|t�sd}nH|j|jko]|j|jko]|j|jko]|j|jk}|S)NF)r�r6rNrrrpr�)r��otherr(r-r-r.�__eq__�s	zExportEntry.__eq__N)
r�r�r�r�r�r�r7r9r��__hash__r-r-r-r.r6�s

r6z�(?P<name>(\w|[-.+])+)
                      \s*=\s*(?P<callable>(\w+)([:\.]\w+)*)
                      \s*(\[\s*(?P<flags>[\w-]+(=\w+)?(,\s*\w+(=\w+)?)*)\s*\])?
                      c
Cs>tj|�}|sFd}d|ks3d|kr:td|��n�|j�}|d}|d}|jd�}|dkr�|d}}n1|dkr�td|��|jd�\}}|d	}	|	dkr	d|ks�d|krtd|��g}	nd
d�|	jd�D�}	t||||	�}|S)
Nr@rAzInvalid specification '%s'rN�callable�:rrr�cSsg|]}|j��qSr-)rS)rKr�r-r-r.rM�s	z$get_export_entry.<locals>.<listcomp>rB)�ENTRY_RE�searchr�	groupdict�countr�r6)
�
specificationr'r(r�rNrd�colonsrrrpr�r-r-r.r��s2





	r�cCs|dkrd}tjdkrEdtjkrEtjjd�}ntjjd�}tjj|�r�tj|tj�}|s�t	j
d|�nHytj|�d}Wn.tk
r�t	j
d	|d
d�d}YnX|st
j�}t	j
d|�tjj||�S)
a�
    Return the default base location for distlib caches. If the directory does
    not exist, it is created. Use the suffix provided for the base directory,
    and default to '.distlib' if it isn't provided.

    On Windows, if LOCALAPPDATA is defined in the environment, then it is
    assumed to be a directory, and will be the parent directory of the result.
    On POSIX, and on Windows if LOCALAPPDATA is not defined, the user's home
    directory - using os.expanduser('~') - will be the parent directory of
    the result.

    The result is just the directory '.distlib' in the parent directory as
    determined above, or with the name specified with ``suffix``.
    Nz.distlib�nt�LOCALAPPDATAz
$localappdata�~z(Directory exists but is not writable: %sTzUnable to create %s�exc_infoFz#Default location unusable, using %s)rcrN�environrd�
expandvars�
expanduserr�rr r��warning�makedirs�OSErrorr�r�r$)rpr(�usabler-r-r.�get_cache_base�s&


rNcCs]tjjtjj|��\}}|r<|jdd�}|jtjd�}||dS)a
    Convert an absolute path to a directory name for use in a cache.

    The algorithm used is:

    #. On Windows, any ``':'`` in the drive is replaced with ``'---'``.
    #. Any occurrence of ``os.sep`` is replaced with ``'--'``.
    #. ``'.cache'`` is appended.
    r<z---z--z.cache)rcrd�
splitdriver�r!re)rdr�r�r-r-r.�path_to_cache_dir
s

$rPcCs|jd�s|dS|S)Nrb)�endswith)r,r-r-r.�ensure_slashsrRcCs�d}}d|kr[|jdd�\}}d|krC|}n|jdd�\}}|rmt|�}|rt|�}|||fS)NrCrr<)�rsplitr�r)rX�username�passwordrrr-r-r.�parse_credentials$s
	rVcCs tjd�}tj|�|S)N�)rc�umask)r(r-r-r.�get_process_umask3s
rYcCsUd}d}x0t|�D]"\}}t|t�sd}PqW|dk	sQt�|S)NTF)�	enumerater�rrf)�seqr(r]r,r-r-r.�is_string_sequence8sr\z3([a-z0-9_]+([.-][a-z_][a-z0-9_]*)*)-([a-z0-9_.+-]+)z
-py(\d\.?\d?)cCsd}d}t|�jdd�}tj|�}|r^|jd�}|d|j��}|r�t|�t|�dkr�tjtj	|�d|�}|r�|j
�}|d|�||dd�|f}|dkrtj|�}|r|jd�|jd�|f}|S)zw
    Extract name, version, python version from a filename (no extension)

    Return name, version, pyver or None
    N� �-rz\br�)rr!�PYTHON_VERSIONr>r��startrg�rer�escaper�PROJECT_NAME_AND_VERSION)�filename�project_namer(�pyverr'�nr-r-r.�split_filenameGs""'!rhz-(?P<name>[\w .-]+)\s*\(\s*(?P<ver>[^\s)]+)\)$cCsOtj|�}|s%td|��|j�}|dj�j�|dfS)z�
    A utility method used to get name and version from a string.

    From e.g. a Provides-Dist value.

    :param p: A value in a form 'foo (1.0)'
    :return: The name and version as a tuple.
    z$Ill-formed name/version string: '%s'rN�ver)�NAME_VERSION_RErrr?rSr�)r�r'r�r-r-r.�parse_name_and_versioncs
	rkcCst�}t|pg�}t|p'g�}d|krP|jd�||O}x�|D]�}|dkry|j|�qW|jd�r�|dd�}||kr�tjd|�||kr�|j|�qW||kr�tjd|�|j|�qWW|S)N�*r^rzundeclared extra: %s)r�r�r�rTr�rJ)�	requested�	availabler(�r�unwantedr-r-r.�
get_extrasrs&	


rqcCs�i}yqt|�}|j�}|jd�}|jd�sRtjd|�n$tjd�|�}tj	|�}Wn8t
k
r�}ztjd||�WYdd}~XnX|S)NzContent-Typezapplication/jsonz(Unexpected response for JSON request: %szutf-8z&Failed to get external data for %s: %s)rr��getrTr�rr�r�r�r�r��	exception)rQr(�resp�headers�ct�reader�er-r-r.�_get_external_data�s&ryz'https://www.red-dove.com/pypi/projects/cCs9d|dj�|f}tt|�}t|�}|S)Nz%s/%s/project.jsonr)�upperr
�_external_data_base_urlry)rNrQr(r-r-r.�get_project_data�sr|cCs6d|dj�||f}tt|�}t|�S)Nz%s/%s/package-%s.jsonr)rzr
r{ry)rN�versionrQr-r-r.�get_package_data�sr~c@s:eZdZdZdd�Zdd�Zdd�ZdS)	�Cachez�
    A class implementing a cache for resources that need to live in the file system
    e.g. shared libraries. This class was moved from resources to here because it
    could be used by other modules, e.g. the wheel module.
    cCsptjj|�stj|�tj|�jd@dkrKtjd|�tjjtjj	|��|_
dS)zu
        Initialise an instance.

        :param base: The base directory where the cache should be located.
        �?rzDirectory '%s' is not privateN)rcrdr�rKr�rr�rJr��normpathro)r�ror-r-r.r��s

zCache.__init__cCs
t|�S)zN
        Converts a resource prefix to a directory name in the cache.
        )rP)r�rrr-r-r.�
prefix_to_dir�szCache.prefix_to_dircCs�g}x�tj|j�D]�}tjj|j|�}yWtjj|�s^tjj|�rntj|�ntjj|�r�t	j
|�Wqtk
r�|j|�YqXqW|S)z"
        Clear the cache.
        )
rcr(rordr$r�r�r�r�rr�r�r")r��not_removed�fnr-r-r.�clear�s$
zCache.clearN)r�r�r��__doc__r�r�r�r-r-r-r.r�src@sUeZdZdZdd�Zddd�Zdd�Zd	d
�Zdd�Zd
S)�
EventMixinz1
    A very simple publish/subscribe system.
    cCs
i|_dS)N)�_subscribers)r�r-r-r.r��szEventMixin.__init__TcCs\|j}||kr+t|g�||<n-||}|rK|j|�n
|j|�dS)a`
        Add a subscriber for an event.

        :param event: The name of an event.
        :param subscriber: The subscriber to be added (and called when the
                           event is published).
        :param append: Whether to append or prepend the subscriber to an
                       existing subscriber list for the event.
        N)r�rr"�
appendleft)r��event�
subscriberr"�subs�sqr-r-r.r��s
	
zEventMixin.addcCs:|j}||kr%td|��||j|�dS)z�
        Remove a subscriber for an event.

        :param event: The name of an event.
        :param subscriber: The subscriber to be removed.
        zNo subscribers: %rN)r�r�r�)r�r�r�r�r-r-r.r��s	zEventMixin.removecCst|jj|f��S)z�
        Return an iterator for the subscribers for an event.
        :param event: The event to return subscribers for.
        )�iterr�rr)r�r�r-r-r.�get_subscribersszEventMixin.get_subscriberscOs�g}xb|j|�D]Q}y||||�}Wn%tk
rYtjd�d}YnX|j|�qWtjd||||�|S)a^
        Publish a event and return a list of values returned by its
        subscribers.

        :param event: The event to publish.
        :param args: The positional arguments to pass to the event's
                     subscribers.
        :param kwargs: The keyword arguments to pass to the event's
                       subscribers.
        z"Exception during event publicationNz/publish %s: args = %s, kwargs = %s, result = %s)r�r�r�rsr"r)r�r��args�kwargsr(r�r�r-r-r.�publishs

	zEventMixin.publishN)	r�r�r�r�r�r�r�r�r�r-r-r-r.r��sr�c@s�eZdZdd�Zdd�Zddd�Zdd	�Zd
d�Zdd
�Zdd�Z	e
dd��Ze
dd��ZdS)�	SequencercCs"i|_i|_t�|_dS)N)�_preds�_succsr��_nodes)r�r-r-r.r�"s		zSequencer.__init__cCs|jj|�dS)N)r�r�)r��noder-r-r.�add_node'szSequencer.add_nodeFcCs||jkr|jj|�|r�x3t|jj|f��D]}|j||�qAWx3t|jj|f��D]}|j||�qwWx3t|jj��D]\}}|s�|j|=q�Wx3t|jj��D]\}}|s�|j|=q�WdS)N)r�r�r�r�rrr�r&r�)r�r��edgesr�r,r�rHr-r-r.�remove_node*s""""zSequencer.remove_nodecCsT||kst�|jj|t��j|�|jj|t��j|�dS)N)rfr��
setdefaultr�r�r�)r��pred�succr-r-r.r�:sz
Sequencer.addcCs�||kst�y|j|}|j|}Wn"tk
rTtd|��YnXy|j|�|j|�Wn(tk
r�td||f��YnXdS)Nz%r not a successor of anythingz%r not a successor of %r)rfr�r��KeyErrorr�r�)r�r�r��preds�succsr-r-r.r�?s



zSequencer.removecCs+||jkp*||jkp*||jkS)N)r�r�r�)r��stepr-r-r.�is_stepLszSequencer.is_stepcCs�|j|�std|��g}g}t�}|j|�x�|r�|jd�}||kr�||kr�|j|�|j|�qD|j|�|j|�|jj|f�}|j	|�qDWt
|�S)NzUnknown: %rr)r�r�r�r"rjr�r�r�rr�extend�reversed)r��finalr(�todo�seenr�r�r-r-r.�	get_stepsPs"	
	


zSequencer.get_stepscsydg�g�i�i�g�|j��������fdd��x$�D]}|�krU�|�qUW�S)Nrc
s0�d�|<�d�|<�dd7<�j|�y�|}Wntk
r_g}YnXxi|D]a}|�kr��|�t�|�|��|<qg|�krgt�|�|��|<qgW�|�|kr,g}x*�j�}|j|�||kr�Pq�Wt|�}�j|�dS)Nrr)r"r��minrj�tuple)r��
successors�	successor�connected_component�	component)�graph�index�
index_counter�lowlinksr(�stack�
strongconnectr-r.r�ts.




z3Sequencer.strong_connections.<locals>.strongconnect)r�)r�r�r-)r�r�r�r�r(r�r�r.�strong_connectionsis		$"
zSequencer.strong_connectionscCs�dg}xF|jD];}|j|}x%|D]}|jd||f�q-WqWx"|jD]}|jd|�q\W|jd�dj|�S)Nzdigraph G {z  %s -> %s;z  %s;�}�
)r�r"r�r$)r�r(r�r�r�r�r-r-r.�dot�s	


z
Sequencer.dotN)
r�r�r�r�r�r�r�r�r�r��propertyr�r�r-r-r-r.r�!s
3r��.tar.gz�.tar.bz2�.tar�.zip�.tgz�.tbz�.whlTc

s���fdd�}tjj���t���d}|dkr�|jd�r]d}nj|jd�r{d}d	}nL|jd�r�d}d
}n.|jd�r�d}d}ntd|��z�|dkrt|d�}|rT|j�}xZ|D]}||�q�Wn?tj	||�}|rT|j
�}x|D]}||�q@W|dkr�tjddkr�x;|j
�D]-}	t|	jt�s�|	jjd�|	_q�W|j��Wd|r�|j�XdS)Ncsvt|t�s|jd�}tjjtjj�|��}|j��sb|�tjkrrt	d|��dS)Nzutf-8zpath outside destination: %r)
r�r�decodercrdr�r$rTrer�)rdr�)�dest_dir�plenr-r.�
check_path�s
!#zunarchive.<locals>.check_path�.zip�.whl�zip�.tar.gz�.tgz�tgzzr:gz�.tar.bz2�.tbz�tbzzr:bz2z.tar�tarrozUnknown format for %rrr�zutf-8)r�r�)r�r�)r�r�)rcrdr�rgrQr�r�namelist�tarfiler��getnamesr}r��
getmembersr�rNrr��
extractallr�)
�archive_filenamer��formatr�r��archiver�namesrN�tarinfor-)r�r�r.�	unarchive�sH				

r�cCs�tj�}t|�}t|d���}x{tj|�D]j\}}}xX|D]P}tjj||�}||d�}	tjj|	|�}
|j||
�qPWq:WWdQRX|S)z*zip a directory tree into a BytesIO objectr�N)	�io�BytesIOrgrrc�walkrdr$r�)�	directoryr(�dlen�zfrhr*r
rN�full�relrqr-r-r.�zip_dir�s
r�r�K�M�G�T�Pc@s�eZdZdZdddd�Zdd�Zdd	�Zd
d�Zdd
�Ze	dd��Z
e	dd��Zdd�Ze	dd��Z
e	dd��ZdS)�Progress�UNKNOWNr�dcCsV|dks||kst�||_|_||_d|_d|_d|_dS)NrF)rfr��cur�max�started�elapsed�done)r��minval�maxvalr-r-r.r��s			zProgress.__init__cCs}|j|kst�|jdks9||jks9t�||_tj�}|jdkri||_n||j|_dS)N)r�rfr�r��timer�r�)r��curval�nowr-r-r.�updates$	zProgress.updatecCs*|dkst�|j|j|�dS)Nr)rfr�r�)r��incrr-r-r.�	incrementszProgress.incrementcCs|j|j�|S)N)r�r�)r�r-r-r.r`szProgress.startcCs,|jdk	r|j|j�d|_dS)NT)r�r�r�)r�r-r-r.�stopsz
Progress.stopcCs|jdkr|jS|jS)N)r��unknown)r�r-r-r.�maximumszProgress.maximumcCsZ|jrd}nD|jdkr*d}n,d|j|j|j|j}d|}|S)Nz100 %z ?? %gY@z%3d %%)r�r�r�r�)r�r(rHr-r-r.�
percentages			"
zProgress.percentagecCsU|dkr|jdks-|j|jkr6d}ntjdtj|��}|S)Nrz??:??:??z%H:%M:%S)r�r�r�r��strftime�gmtime)r��durationr(r-r-r.�format_duration*s-	zProgress.format_durationcCs�|jrd}|j}n�d}|jdkr9d}ne|jdksZ|j|jkrcd}n;t|j|j�}||j|j}|d|j}d||j|�fS)N�DonezETA rrz%s: %sr�)r�r�r�r�r��floatr�)r�rrr^r-r-r.�ETA3s		!	zProgress.ETAcCse|jdkrd}n|j|j|j}x%tD]}|dkrIP|d}q6Wd||fS)Nrgi�g@�@z%d %sB/s)r�r�r��UNITS)r�r(�unitr-r-r.�speedFs	
zProgress.speedN)r�r�r�r�r�r�r�r`r�r�r�r�r�rrr-r-r-r.r��s
	r�z\{([^}]*)\}z[^/\\,{]\*\*|\*\*[^/\\,}]z^[^{]*\}|\{[^}]*$cCsTtj|�r%d}t||��tj|�rJd}t||��t|�S)zAExtended globbing function that supports ** and {opt1,opt2,opt3}.z7invalid glob %r: recursive glob "**" must be used alonez2invalid glob %r: mismatching set marker '{' or '}')�_CHECK_RECURSIVE_GLOBr>r��_CHECK_MISMATCH_SET�_iglob)�	path_globr�r-r-r.r[srccs�tj|d�}t|�dkr�t|�dksBt|��|\}}}x0|jd�D]4}x+tdj|||f��D]}|Vq�WqaWn�d|kr�x�t|�D]}|Vq�Wn�|jdd�\}}|dkr�d}|dkrd}n|jd�}|jd	�}x]tj	|�D]L\}}}	tj
j|�}x(ttj
j||��D]}
|
VqqWq4WdS)
Nrr�rBrz**r/rlrb�\)�	RICH_GLOBr�rgrfrr$�	std_iglobr%rcr�rdr�)r	�rich_path_globrrr�rp�itemrd�radical�dirr
r�r-r-r.rfs*%	"r)�HTTPSHandler�match_hostname�CertificateErrorc@s(eZdZdZdZdd�ZdS)�HTTPSConnectionNTcCs�tj|j|jf|j�}t|dd�rF||_|j�tt	d�s�|j
rjt	j}n	t	j}t	j
||j|jd|dt	jd|j
�|_n�t	jt	j�}tt	d�r�|jt	jO_|jr�|j|j|j�i}|j
rKt	j|_|jd|j
�tt	d	d�rK|j|d
<|j
||�|_|j
r�|jr�y0t|jj�|j�tjd|j�Wn5tk
r�|jjtj�|jj��YnXdS)N�_tunnel_hostF�
SSLContext�	cert_reqs�ssl_version�ca_certs�OP_NO_SSLv2�cafile�HAS_SNI�server_hostnamezHost verified: %s) r��create_connection�host�port�timeoutr~�sock�_tunnelr|�sslr�
CERT_REQUIRED�	CERT_NONE�wrap_socket�key_file�	cert_file�PROTOCOL_SSLv23r�optionsr�load_cert_chain�verify_mode�load_verify_locations�check_domainr�getpeercertr�rr�shutdown�	SHUT_RDWRr�)r�r"r�contextr�r-r-r.�connect�s@!	
					


zHTTPSConnection.connect)r�r�r�rr/r4r-r-r-r.r�src@s7eZdZddd�Zdd�Zdd�ZdS)	rTcCs#tj|�||_||_dS)N)�BaseHTTPSHandlerr�rr/)r�rr/r-r-r.r��s
	zHTTPSHandler.__init__cOs4t||�}|jr0|j|_|j|_|S)a
            This is called to create a connection instance. Normally you'd
            pass a connection class to do_open, but it doesn't actually check for
            a class, and just expects a callable. As long as we behave just as a
            constructor would have, we should be OK. If it ever changes so that
            we *must* pass a class, we'll create an UnsafeHTTPSConnection class
            which just sets check_domain to False in the class definition, and
            choose which one to pass to do_open.
            )rrr/)r�r�r�r(r-r-r.�_conn_maker�s

	zHTTPSHandler._conn_makercCsqy|j|j|�SWnStk
rl}z3dt|j�krWtd|j��n�WYdd}~XnXdS)Nzcertificate verify failedz*Unable to verify server certificate for %s)�do_openr6r�str�reasonrr)r�rYrxr-r-r.�
https_open�szHTTPSHandler.https_openN)r�r�r�r�r6r:r-r-r-r.r�src@seZdZdd�ZdS)�HTTPSOnlyHandlercCstd|��dS)NzAUnexpected HTTP request on what should be a secure connection: %s)r)r�rYr-r-r.�	http_open�szHTTPSOnlyHandler.http_openN)r�r�r�r<r-r-r-r.r;�sr;��c@s"eZdZdddd�ZdS)�HTTPrNcKs2|dkrd}|j|j|||��dS)Nr)�_setup�_connection_class)r�rr r�r-r-r.r��sz
HTTP.__init__)r�r�r�r�r-r-r-r.r?�sr?c@s"eZdZdddd�ZdS)�HTTPSrNcKs2|dkrd}|j|j|||��dS)Nr)r@rA)r�rr r�r-r-r.r��szHTTPS.__init__)r�r�r�r�r-r-r-r.rB�srBc@s+eZdZddd�Zdd�ZdS)�	TransportrcCs ||_tjj||�dS)N)r!rrCr�)r�r!�use_datetimer-r-r.r��s	zTransport.__init__cCs�|j|�\}}}tdkr<t|d|j�}nK|jsY||jdkrz||_|tj|�f|_|jd}|S)Nr=r>r!rr)r=r>)�
get_host_info�	_ver_infor?r!�_connection�_extra_headersr�HTTPConnection)r�r�h�eh�x509r(r-r-r.�make_connection�s	
zTransport.make_connectionN)r�r�r�r�rMr-r-r-r.rC�srCc@s+eZdZddd�Zdd�ZdS)�
SafeTransportrcCs ||_tjj||�dS)N)r!rrNr�)r�r!rDr-r-r.r�s	zSafeTransport.__init__cCs�|j|�\}}}|s$i}|j|d<tdkrRt|d|�}nQ|jso||jdkr�||_|tj|d|�f|_|jd}|S)Nr!r=r>rr)r=r>)rEr!rFrBrGrHrr)r�rrJrKr�r(r-r-r.rMs
	
zSafeTransport.make_connectionN)r�r�r�r�rMr-r-r-r.rN
srNc@seZdZdd�ZdS)�ServerProxyc	Ks�|jdd�|_}|dk	r�t|�\}}|jdd�}|dkr^t}nt}||d|�|d<}||_tjj	|||�dS)Nr!rDr�https�	transport)
rjr!rrrrNrCrQrrOr�)	r�r\r�r!rWr_rD�tclsr^r-r-r.r� s		zServerProxy.__init__N)r�r�r�r�r-r-r-r.rOsrOcKsDtjddkr |d7}nd|d<d|d<t|||�S)Nrr��br�newlinezutf-8r�)r}r�r�)r�rr�r-r-r.�	_csv_open4s



rUc@sReZdZded�ded�ded�iZdd�Zd	d
�ZdS)�CSVBase�	delimiterrB�	quotechar�"�lineterminatorr�cCs|S)Nr-)r�r-r-r.�	__enter__FszCSVBase.__enter__cGs|jj�dS)N)r�r�)r�rFr-r-r.�__exit__IszCSVBase.__exit__N)r�r�r�r8�defaultsr[r\r-r-r-r.rV?s
rVc@s:eZdZdd�Zdd�Zdd�ZeZdS)�	CSVReadercKsd|krJ|d}tjddkr>tjd�|�}||_nt|dd�|_tj|j|j�|_dS)Nr�rr�zutf-8rdro)	r}r�r�r�r�rU�csvrwr])r�r�r�r-r-r.r�Ns
zCSVReader.__init__cCs|S)Nr-)r�r-r-r.�__iter__YszCSVReader.__iter__cCset|j�}tjddkrax<t|�D].\}}t|t�s/|jd�||<q/W|S)Nrr�zutf-8)�nextrwr}r�rZr�rr�)r�r(r]rr-r-r.ra\szCSVReader.nextN)r�r�r�r�r`ra�__next__r-r-r-r.r^Msr^c@s(eZdZdd�Zdd�ZdS)�	CSVWritercKs1t|d�|_tj|j|j�|_dS)Nr�)rUr�r_�writerr])r�r�r�r-r-r.r�gszCSVWriter.__init__cCsotjddkr[g}x9|D]1}t|t�rD|jd�}|j|�q W|}|jj|�dS)Nrr�zutf-8)r}r�r�rrr"rd�writerow)r��rowrorr-r-r.reks
zCSVWriter.writerowN)r�r�r�r�rer-r-r-r.rcfsrccsbeZdZeej�Zded<d�fdd�Zdd�Zdd	�Zd
d�Z	�S)�Configurator�inc_convert�incNcs/tt|�j|�|p%tj�|_dS)N)�superrgr�rcr�ro)r��configro)�	__class__r-r.r�~szConfigurator.__init__c
s���fdd���jd�}t|�s?�j|�}�jdd�}�jdf�}|r�t�fdd�|D��}��fdd��D�}t|�}|||�}|r�x0|j�D]"\}}	t||�|	��q�W|S)	Ncs�t|ttf�r=t|��fdd�|D��}njt|t�r�d|krj�j|�}q�i}x4|D]}�||�||<qwWn�j|�}|S)Ncsg|]}�|��qSr-r-)rKr])�convertr-r.rM�s	zBConfigurator.configure_custom.<locals>.convert.<locals>.<listcomp>z())r�r&r��type�dict�configure_customrm)�or(r�)rmr�r-r.rm�s(
z.Configurator.configure_custom.<locals>.convertz()r/z[]csg|]}�|��qSr-r-)rKrq)rmr-r.rM�s	z1Configurator.configure_custom.<locals>.<listcomp>cs2g|](}t|�r|��|�f�qSr-)r)rKr�)rkrmr-r.rM�s	)rjr;r5r�ror��setattr)
r�rkr��propsr�r�r�r(rgrHr-)rkrmr�r.rp�szConfigurator.configure_customcCsF|j|}t|t�rBd|krB|j|�|j|<}|S)Nz())rkr�rorp)r�r�r(r-r-r.�__getitem__�s
zConfigurator.__getitem__c	Cs_tjj|�s*tjj|j|�}tj|ddd��}tj|�}WdQRX|S)z*Default converter for the inc:// protocol.ror�zutf-8N)	rcrd�isabsr$ror�r�r�r�)r�r�r�r(r-r-r.rh�s
zConfigurator.inc_convert)
r�r�r�ror�value_convertersr�rprtrhr-r-)rlr.rgys
rgc@s@eZdZdZdddd�Zdd�Zdd	�ZdS)
�SubprocessMixinzC
    Mixin for running subprocesses and capturing their output
    FNcCs||_||_dS)N)�verbose�progress)r�rxryr-r-r.r��s	zSubprocessMixin.__init__cCs�|j}|j}xr|j�}|s(P|dk	rD|||�q|s]tjjd�ntjj|jd��tjj�qW|j�dS)z�
        Read lines from a subprocess' output stream and either pass to a progress
        callable (if specified) or write progress information to sys.stderr.
        Nr/zutf-8)	ryrx�readliner}�stderrr�r��flushr�)r�r�r3ryrxr,r-r-r.rw�s		zSubprocessMixin.readercKs�tj|dtjdtj|�}tjd|jd|jdf�}|j�tjd|jd|jdf�}|j�|j	�|j
�|j
�|jdk	r�|jdd�n|jr�t
jjd�|S)N�stdoutr{r�r�zdone.�mainzdone.
)�
subprocess�Popen�PIPE�	threading�Threadrwr}r`r{�waitr$ryrxr}r�)r��cmdr�r��t1�t2r-r-r.�run_command�s$
$



	zSubprocessMixin.run_command)r�r�r�r�r�rwr�r-r-r-r.rw�srwcCstjdd|�j�S)z,Normalize a python package name a la PEP 503z[-_.]+r^)ra�subr�)rNr-r-r.�normalize_name�sr�)r�r�r�r�r�r�r�)rr�r�r�r�r�)r=r>)�r��collectionsr�
contextlibr_�globrrr�r��loggingrcrrar�r$�ImportErrorrr}r�r�r�r��dummy_threadingr�rr�compatrrrr	r
rrr
rrrrrrrrrrrrr�	getLoggerr�r�rrrErDr5r<r9rVr#r>raryrr�r�r�r�r��contextmanagerr�r�r�r�r�r�r�r5r6�VERBOSEr=r�rNrPrRrVrYr\�Ircr_rhrjrkrqryr{r|r~rr�r��ARCHIVE_EXTENSIONSr�r�rr�rrrrrr5rrrr;r�rFr?rBrCrNrOrUrVr^rcrgrwr�r-r-r-r.�<module>s�

�Yy
	/
	�)
	,H�6]+)	7.

Filemanager

Name Type Size Permission Actions
__init__.cpython-35.pyc File 1.1 KB 0644
compat.cpython-35.pyc File 33.85 KB 0644
database.cpython-35.pyc File 44.5 KB 0644
index.cpython-35.pyc File 18.01 KB 0644
locators.cpython-35.pyc File 40.95 KB 0644
manifest.cpython-35.pyc File 10.95 KB 0644
markers.cpython-35.pyc File 4.81 KB 0644
metadata.cpython-35.pyc File 28.86 KB 0644
resources.cpython-35.pyc File 11.58 KB 0644
scripts.cpython-35.pyc File 11.56 KB 0644
util.cpython-35.pyc File 51.86 KB 0644
version.cpython-35.pyc File 22.13 KB 0644
wheel.cpython-35.pyc File 28.19 KB 0644