AlkantarClanX12

Your IP : 18.119.108.233


Current Path : /lib/python2.7/site-packages/pip/_vendor/distlib/
Upload File :
Current File : //lib/python2.7/site-packages/pip/_vendor/distlib/resources.pyo

�
��abc@s	ddlmZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlmZddl
mZmZmZmZeje�Zdadefd��YZdefd	��YZd
efd��YZdefd
��YZdefd��YZdefd��YZieed�6ee
j6Z yQyddl!Z"Wne#k
r�ddl$Z"nXee e"j%<ee e"j&<["Wne#e'fk
r�nXd�Z(iZ)d�Z*e	j+e,d��Z-d�Z.dS(i����(tunicode_literalsNi(tDistlibException(tcached_propertytget_cache_basetpath_to_cache_dirtCachet
ResourceCachecBs&eZdd�Zd�Zd�ZRS(cCsG|dkr-tjjt�td��}ntt|�j|�dS(Nuresource-cache(	tNonetostpathtjoinRtstrtsuperRt__init__(tselftbase((sA/usr/lib/python2.7/site-packages/pip/_vendor/distlib/resources.pyR
s!cCstS(u�
        Is the cache stale for the given resource?

        :param resource: The :class:`Resource` being cached.
        :param path: The path of the resource in the cache.
        :return: True if the cache is stale.
        (tTrue(RtresourceR	((sA/usr/lib/python2.7/site-packages/pip/_vendor/distlib/resources.pytis_stale#s	cCs�|jj|�\}}|dkr-|}n�tjj|j|j|�|�}tjj|�}tjj	|�s�tj
|�ntjj|�s�t}n|j
||�}|r�t|d��}|j|j�WdQXn|S(u�
        Get a resource into the cache,

        :param resource: A :class:`Resource` instance.
        :return: The pathname of the resource in the cache.
        uwbN(tfindertget_cache_infoRRR	R
Rt
prefix_to_dirtdirnametisdirtmakedirstexistsRRtopentwritetbytes(RRtprefixR	tresultRtstaletf((sA/usr/lib/python2.7/site-packages/pip/_vendor/distlib/resources.pytget.s	$	N(t__name__t
__module__RR
RR!(((sA/usr/lib/python2.7/site-packages/pip/_vendor/distlib/resources.pyRs	tResourceBasecBseZd�ZRS(cCs||_||_dS(N(Rtname(RRR%((sA/usr/lib/python2.7/site-packages/pip/_vendor/distlib/resources.pyR
Is	(R"R#R
(((sA/usr/lib/python2.7/site-packages/pip/_vendor/distlib/resources.pyR$HstResourcecBsJeZdZeZd�Zed��Zed��Zed��Z	RS(u�
    A class representing an in-package resource, such as a data file. This is
    not normally instantiated by user code, but rather by a
    :class:`ResourceFinder` which manages the resource.
    cCs|jj|�S(u�
        Get the resource as a stream.

        This is not a property to make it obvious that it returns a new stream
        each time.
        (Rt
get_stream(R((sA/usr/lib/python2.7/site-packages/pip/_vendor/distlib/resources.pyt	as_streamVscCs%tdkrt�antj|�S(N(tcacheRRR!(R((sA/usr/lib/python2.7/site-packages/pip/_vendor/distlib/resources.pyt	file_path_scCs|jj|�S(N(Rt	get_bytes(R((sA/usr/lib/python2.7/site-packages/pip/_vendor/distlib/resources.pyRfscCs|jj|�S(N(Rtget_size(R((sA/usr/lib/python2.7/site-packages/pip/_vendor/distlib/resources.pytsizejs(
R"R#t__doc__tFalsetis_containerR(RR*RR-(((sA/usr/lib/python2.7/site-packages/pip/_vendor/distlib/resources.pyR&Ns		tResourceContainercBseZeZed��ZRS(cCs|jj|�S(N(Rt
get_resources(R((sA/usr/lib/python2.7/site-packages/pip/_vendor/distlib/resources.pyt	resourcesrs(R"R#RR0RR3(((sA/usr/lib/python2.7/site-packages/pip/_vendor/distlib/resources.pyR1ostResourceFindercBs�eZdZejjd�r'dZndZd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zeejj�Zd�ZRS(u4
    Resource finder for file system resources.
    ujavau.pycu.pyou.classcCsC||_t|dd�|_tjjt|dd��|_dS(Nu
__loader__u__file__u(tmoduletgetattrRtloaderRR	RR(RR5((sA/usr/lib/python2.7/site-packages/pip/_vendor/distlib/resources.pyR
�s	cCstjj|�S(N(RR	trealpath(RR	((sA/usr/lib/python2.7/site-packages/pip/_vendor/distlib/resources.pyt_adjust_path�scCs_t|t�rd}nd}|j|�}|jd|j�tjj|�}|j|�S(Nt/u/i(	t
isinstanceRtsplittinsertRRR	R
R9(Rt
resource_nametseptpartsR((sA/usr/lib/python2.7/site-packages/pip/_vendor/distlib/resources.pyt
_make_path�s	cCstjj|�S(N(RR	R(RR	((sA/usr/lib/python2.7/site-packages/pip/_vendor/distlib/resources.pyt_find�scCs
d|jfS(N(RR	(RR((sA/usr/lib/python2.7/site-packages/pip/_vendor/distlib/resources.pyR�scCsd|j|�}|j|�s'd}n9|j|�rHt||�}nt||�}||_|S(N(RARBRt
_is_directoryR1R&R	(RR>R	R((sA/usr/lib/python2.7/site-packages/pip/_vendor/distlib/resources.pytfind�s		cCst|jd�S(Nurb(RR	(RR((sA/usr/lib/python2.7/site-packages/pip/_vendor/distlib/resources.pyR'�scCs)t|jd��}|j�SWdQXdS(Nurb(RR	tread(RRR ((sA/usr/lib/python2.7/site-packages/pip/_vendor/distlib/resources.pyR+�scCstjj|j�S(N(RR	tgetsize(RR((sA/usr/lib/python2.7/site-packages/pip/_vendor/distlib/resources.pyR,�scsD�fd�}tgtj|j�D]}||�r%|^q%�S(Ncs|dko|j�j�S(Nu__pycache__(tendswithtskipped_extensions(R (R(sA/usr/lib/python2.7/site-packages/pip/_vendor/distlib/resources.pytallowed�s(tsetRtlistdirR	(RRRIR ((RsA/usr/lib/python2.7/site-packages/pip/_vendor/distlib/resources.pyR2�scCs|j|j�S(N(RCR	(RR((sA/usr/lib/python2.7/site-packages/pip/_vendor/distlib/resources.pyR0�sccs�|j|�}|dk	r�|g}x�|r�|jd�}|V|jr'|j}xe|jD]W}|sr|}ndj||g�}|j|�}|jr�|j|�q]|Vq]Wq'q'WndS(Niu/(RDRtpopR0R%R3R
tappend(RR>RttodotrnameR%tnew_nametchild((sA/usr/lib/python2.7/site-packages/pip/_vendor/distlib/resources.pytiterator�s 						(u.pycu.pyou.class(u.pycu.pyo(R"R#R.tsystplatformt
startswithRHR
R9RARBRRDR'R+R,R2R0tstaticmethodRR	RRCRR(((sA/usr/lib/python2.7/site-packages/pip/_vendor/distlib/resources.pyR4ws"												tZipResourceFindercBs_eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�ZRS(
u6
    Resource finder for resources in .zip files.
    cCstt|�j|�|jj}dt|�|_t|jd�rY|jj|_nt	j
||_t|j�|_dS(Niu_files(
RRWR
R7tarchivetlent
prefix_lenthasattrt_filest	zipimportt_zip_directory_cachetsortedtindex(RR5RX((sA/usr/lib/python2.7/site-packages/pip/_vendor/distlib/resources.pyR
�scCs|S(N((RR	((sA/usr/lib/python2.7/site-packages/pip/_vendor/distlib/resources.pyR9�scCs�||j}||jkr%t}nr|rN|dtjkrN|tj}ntj|j|�}y|j|j|�}Wntk
r�t	}nX|s�t
jd||jj
�nt
jd||jj
�|S(Ni����u_find failed: %r %ru_find worked: %r %r(RZR\RRR?tbisectR`RUt
IndexErrorR/tloggertdebugR7R(RR	Rti((sA/usr/lib/python2.7/site-packages/pip/_vendor/distlib/resources.pyRB�s
	

cCs-|jj}|jdt|�}||fS(Ni(R7RXR	RY(RRRR	((sA/usr/lib/python2.7/site-packages/pip/_vendor/distlib/resources.pyR�scCs|jj|j�S(N(R7tget_dataR	(RR((sA/usr/lib/python2.7/site-packages/pip/_vendor/distlib/resources.pyR+�scCstj|j|��S(N(tiotBytesIOR+(RR((sA/usr/lib/python2.7/site-packages/pip/_vendor/distlib/resources.pyR'�scCs|j|j}|j|dS(Ni(R	RZR\(RRR	((sA/usr/lib/python2.7/site-packages/pip/_vendor/distlib/resources.pyR,scCs�|j|j}|r9|dtjkr9|tj7}nt|�}t�}tj|j|�}xn|t|j�kr�|j|j|�s�Pn|j||}|j	|j
tjd�d�|d7}qfW|S(Ni����ii(R	RZRR?RYRJRaR`RUtaddR<(RRR	tplenRRets((sA/usr/lib/python2.7/site-packages/pip/_vendor/distlib/resources.pyR2s	 cCs�||j}|r6|dtjkr6|tj7}ntj|j|�}y|j|j|�}Wntk
r~t}nX|S(Ni����(RZRR?RaR`RURbR/(RR	ReR((sA/usr/lib/python2.7/site-packages/pip/_vendor/distlib/resources.pyRCs


(R"R#R.R
R9RBRR+R'R,R2RC(((sA/usr/lib/python2.7/site-packages/pip/_vendor/distlib/resources.pyRW�s								cCs|tt|�<dS(N(t_finder_registryttype(R7tfinder_maker((sA/usr/lib/python2.7/site-packages/pip/_vendor/distlib/resources.pytregister_finder0scCs�|tkrt|}n�|tjkr5t|�ntj|}t|dd�}|dkrotd��nt|dd�}tjt	|��}|dkr�td|��n||�}|t|<|S(u�
    Return a resource finder for a package.
    :param package: The name of the package.
    :return: A :class:`ResourceFinder` instance for the package.
    u__path__u8You cannot get a finder for a module, only for a packageu
__loader__uUnable to locate finder for %rN(
t
_finder_cacheRStmodulest
__import__R6RRRlR!Rm(tpackageRR5R	R7Rn((sA/usr/lib/python2.7/site-packages/pip/_vendor/distlib/resources.pyR6s



u	__dummy__cCszd}tj|�tjj|�}tjt|��}|rvt}t	j
j|d�|_||_
||�}n|S(u�
    Return a resource finder for a path, which should represent a container.

    :param path: The path.
    :return: A :class:`ResourceFinder` instance for the path.
    uN(Rtpkgutiltget_importerRStpath_importer_cacheR!RlRmt
_dummy_moduleRR	R
t__file__t
__loader__(R	RR7RR5((sA/usr/lib/python2.7/site-packages/pip/_vendor/distlib/resources.pytfinder_for_pathRs
	(/t
__future__RRaRgtloggingRRttshutilRSttypesR]tRtutilRRRRt	getLoggerR"RcRR)RtobjectR$R&R1R4RWRmtzipimporterRlt_frozen_importlib_externalt_fitImportErrort_frozen_importlibtSourceFileLoadert
FileFindertAttributeErrorRoRpRt
ModuleTypeRRwRz(((sA/usr/lib/python2.7/site-packages/pip/_vendor/distlib/resources.pyt<module>sJ",!ZM