Viewing File: /opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/distlib/resources.pyc

ó
“tÆ_c@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((sN/opt/alt/python35/lib/python3.5/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	((sN/opt/alt/python35/lib/python3.5/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((sN/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/distlib/resources.pytget.s	$	N(t__name__t
__module__RR
RR!(((sN/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/distlib/resources.pyRs	tResourceBasecBseZd„ZRS(cCs||_||_dS(N(Rtname(RRR%((sN/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/distlib/resources.pyR
Is	(R"R#R
(((sN/opt/alt/python35/lib/python3.5/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((sN/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/distlib/resources.pyt	as_streamVscCs%tdkrtƒantj|ƒS(N(tcacheRRR!(R((sN/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/distlib/resources.pyt	file_path_scCs|jj|ƒS(N(Rt	get_bytes(R((sN/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/distlib/resources.pyRfscCs|jj|ƒS(N(Rtget_size(R((sN/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/distlib/resources.pytsizejs(
R"R#t__doc__tFalsetis_containerR(RR*RR-(((sN/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/distlib/resources.pyR&Ns		tResourceContainercBseZeZed„ƒZRS(cCs|jj|ƒS(N(Rt
get_resources(R((sN/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/distlib/resources.pyt	resourcesrs(R"R#RR0RR3(((sN/opt/alt/python35/lib/python3.5/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((sN/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/distlib/resources.pyR
s	cCstjj|ƒS(N(RR	trealpath(RR	((sN/opt/alt/python35/lib/python3.5/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((sN/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/distlib/resources.pyt
_make_path‰s	cCstjj|ƒS(N(RR	R(RR	((sN/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/distlib/resources.pyt_find•scCs
d|jfS(N(RR	(RR((sN/opt/alt/python35/lib/python3.5/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((sN/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/distlib/resources.pytfind›s		cCst|jdƒS(Nurb(RR	(RR((sN/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/distlib/resources.pyR'§scCs)t|jdƒ}|jƒSWdQXdS(Nurb(RR	tread(RRR ((sN/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/distlib/resources.pyR+ªscCstjj|jƒS(N(RR	tgetsize(RR((sN/opt/alt/python35/lib/python3.5/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(sN/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/distlib/resources.pytallowed²s(tsetRtlistdirR	(RRRIR ((RsN/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/distlib/resources.pyR2±scCs|j|jƒS(N(RCR	(RR((sN/opt/alt/python35/lib/python3.5/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((sN/opt/alt/python35/lib/python3.5/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(((sN/opt/alt/python35/lib/python3.5/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((sN/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/distlib/resources.pyR
ÕscCs|S(N((RR	((sN/opt/alt/python35/lib/python3.5/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((sN/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/distlib/resources.pyRBãs
	

cCs-|jj}|jdt|ƒ}||fS(Ni(R7RXR	RY(RRRR	((sN/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/distlib/resources.pyRõscCs|jj|jƒS(N(R7tget_dataR	(RR((sN/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/distlib/resources.pyR+úscCstj|j|ƒƒS(N(tiotBytesIOR+(RR((sN/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/distlib/resources.pyR'ýscCs|j|j}|j|dS(Ni(R	RZR\(RRR	((sN/opt/alt/python35/lib/python3.5/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((sN/opt/alt/python35/lib/python3.5/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((sN/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/distlib/resources.pyRCs


(R"R#R.R
R9RBRR+R'R,R2RC(((sN/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/distlib/resources.pyRWÑs								cCs|tt|ƒ<dS(N(t_finder_registryttype(R7tfinder_maker((sN/opt/alt/python35/lib/python3.5/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((sN/opt/alt/python35/lib/python3.5/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((sN/opt/alt/python35/lib/python3.5/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(((sN/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/distlib/resources.pyt<module>sJ",!ZM




		
Back to Directory File Manager