/usr/local/lib/python3.6/site-packages/distlib/__pycache__
NameSizeModeActions
compat.cpython-36.pyc315800644editdlrm
database.cpython-36.pyc430950644editdlrm
index.cpython-36.pyc170910644editdlrm
locators.cpython-36.pyc385820644editdlrm
manifest.cpython-36.pyc103070644editdlrm
markers.cpython-36.pyc52970644editdlrm
metadata.cpython-36.pyc276730644editdlrm
resources.cpython-36.pyc108460644editdlrm
scripts.cpython-36.pyc115000644editdlrm
util.cpython-36.pyc518470644editdlrm
version.cpython-36.pyc208310644editdlrm
wheel.cpython-36.pyc277940644editdlrm
__init__.cpython-36.pyc9970644editdlrm
Edit: /usr/local/lib/python3.6/site-packages/distlib/__pycache__/resources.cpython-36.pyc (10846B)
3 0DgD*@sddlmZddlZddlZddlZddlZddlZddlZddlZddl Z ddl m Z ddl m Z mZmZejeZdaGdddeZGdd d eZGd d d eZGd d d eZGdddeZGdddeZedee jeiZyPy ddlZWne k rddl!ZYnXeeej"<eeej#<eeej$<[Wne e%fk rVYnXddZ&iZ'ddZ(ej)e*dZ+ddZ,dS))unicode_literalsN)DistlibException)cached_propertyget_cache_baseCachecs.eZdZdfdd ZddZddZZS) ResourceCacheNcs0|dkrtjjttd}tt|j|dS)Nzresource-cache)ospathjoinrstrsuperr__init__)selfbase) __class__;/usr/local/lib/python3.6/site-packages/distlib/resources.pyrszResourceCache.__init__cCsdS)z 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. Tr)rresourcer rrris_stale"s zResourceCache.is_stalec Cs|jj|\}}|dkr|}n~tjj|j|j||}tjj|}tjj|sXtj |tjj |sjd}n |j ||}|rt |d}|j |jWdQRX|S)z Get a resource into the cache, :param resource: A :class:`Resource` instance. :return: The pathname of the resource in the cache. NTwb)finderget_cache_infor r r r prefix_to_dirdirnameisdirmakedirsexistsropenwritebytes)rrprefixr resultrstalefrrrget-s      zResourceCache.get)N)__name__ __module__ __qualname__rrr% __classcell__rr)rrrs rc@seZdZddZdS) ResourceBasecCs||_||_dS)N)rname)rrr+rrrrHszResourceBase.__init__N)r&r'r(rrrrrr*Gsr*c@s@eZdZdZdZddZeddZeddZed d Z d S) Resourcez 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. FcCs |jj|S)z Get the resource as a stream. This is not a property to make it obvious that it returns a new stream each time. )r get_stream)rrrr as_streamUszResource.as_streamcCstdkrtatj|S)N)cacherr%)rrrr file_path^szResource.file_pathcCs |jj|S)N)r get_bytes)rrrrr eszResource.bytescCs |jj|S)N)rget_size)rrrrsizeisz Resource.sizeN) r&r'r(__doc__ is_containerr.rr0r r3rrrrr,Ms   r,c@seZdZdZeddZdS)ResourceContainerTcCs |jj|S)N)r get_resources)rrrr resourcesqszResourceContainer.resourcesN)r&r'r(r5rr8rrrrr6nsr6c@seZdZdZejjdrdZnd ZddZdd Z d d Z d d Z ddZ ddZ ddZddZddZddZddZeejjZddZdS)!ResourceFinderz4 Resource finder for file system resources. java.pyc.pyo.classcCs.||_t|dd|_tjjt|dd|_dS)N __loader____file__)modulegetattrloaderr r rr)rrArrrrszResourceFinder.__init__cCs tjj|S)N)r r realpath)rr rrr _adjust_pathszResourceFinder._adjust_pathcCsBt|trd}nd}|j|}|jd|jtjj|}|j|S)N//r) isinstancer splitinsertrr r r rE)r resource_nameseppartsr"rrr _make_paths   zResourceFinder._make_pathcCs tjj|S)N)r r r)rr rrr_findszResourceFinder._findcCs d|jfS)N)r )rrrrrrszResourceFinder.get_cache_infocCsD|j|}|j|sd}n&|j|r0t||}n t||}||_|S)N)rNrO _is_directoryr6r,r )rrKr r"rrrfinds     zResourceFinder.findcCs t|jdS)Nrb)rr )rrrrrr-szResourceFinder.get_streamc Cs t|jd }|jSQRXdS)NrR)rr read)rrr$rrrr1szResourceFinder.get_bytescCstjj|jS)N)r r getsize)rrrrrr2szResourceFinder.get_sizecs*fddtfddtj|jDS)Ncs|dko|jj S)N __pycache__)endswithskipped_extensions)r$)rrrallowedsz-ResourceFinder.get_resources..allowedcsg|]}|r|qSrr).0r$)rXrr sz0ResourceFinder.get_resources..)setr listdirr )rrr)rXrrr7s zResourceFinder.get_resourcescCs |j|jS)N)rPr )rrrrrr5szResourceFinder.is_containerccs|j|}|dk r|g}xn|r|jd}|V|jr|j}xH|jD]>}|sP|}ndj||g}|j|}|jrz|j|qB|VqBWqWdS)NrrG)rQpopr5r+r8r append)rrKrtodornamer+new_namechildrrriterators      zResourceFinder.iteratorN)r;r<r=)r;r<)r&r'r(r4sysplatform startswithrWrrErNrOrrQr-r1r2r7r5 staticmethodr r rrPrcrrrrr9vs"    r9cs`eZdZdZfddZddZddZdd Zd d Zd d Z ddZ ddZ ddZ Z S)ZipResourceFinderz6 Resource finder for resources in .zip files. csZtt|j||jj}dt||_t|jdr>|jj|_n t j ||_t |j|_ dS)Nr_files) r rhrrCarchivelen prefix_lenhasattrri zipimport_zip_directory_cachesortedindex)rrArj)rrrrs   zZipResourceFinder.__init__cCs|S)Nr)rr rrrrEszZipResourceFinder._adjust_pathc Cs||jd}||jkrd}nX|r:|dtjkr:|tj}tj|j|}y|j|j|}Wntk rtd}YnX|stj d||j j ntj d||j j |S)NTrFz_find failed: %r %rz_find worked: %r %r) rlrir rLbisectrqrf IndexErrorloggerdebugrCr!)rr r"irrrrOs   zZipResourceFinder._findcCs&|jj}|jdt|d}||fS)Nr)rCrjr rk)rrr!r rrrrsz ZipResourceFinder.get_cache_infocCs|jj|jS)N)rCget_datar )rrrrrr1szZipResourceFinder.get_bytescCstj|j|S)N)ioBytesIOr1)rrrrrr-szZipResourceFinder.get_streamcCs|j|jd}|j|dS)N)r rlri)rrr rrrr2szZipResourceFinder.get_sizecCs|j|jd}|r,|dtjkr,|tj7}t|}t}tj|j|}xV|t|jkr|j|j|sjP|j||d}|j |j tjdd|d7}qJW|S)Nrrrr) r rlr rLrkr[rsrqrfaddrI)rrr plenr"rwsrrrr7s  zZipResourceFinder.get_resourcesc Csj||jd}|r*|dtjkr*|tj7}tj|j|}y|j|j|}Wntk rdd}YnX|S)NrFrr)rlr rLrsrqrfrt)rr rwr"rrrrPs  zZipResourceFinder._is_directory)r&r'r(r4rrErOrr1r-r2r7rPr)rr)rrrhs rhcCs|tt|<dS)N)_finder_registrytype)rC finder_makerrrrregister_finder2srcCs|tkrt|}nv|tjkr$t|tj|}t|dd}|dkrJtdt|dd}tjt|}|dkrxtd|||}|t|<|S)z Return a resource finder for a package. :param package: The name of the package. :return: A :class:`ResourceFinder` instance for the package. __path__Nz8You cannot get a finder for a module, only for a packager>zUnable to locate finder for %r) _finder_cacherdmodules __import__rBrrr%r)packager"rAr rCrrrrr9s      r __dummy__cCsRd}tj|tjj|}tjt|}|rNt}tj j |d|_ ||_ ||}|S)z Return a resource finder for a path, which should represent a container. :param path: The path. :return: A :class:`ResourceFinder` instance for the path. Nr@) pkgutil get_importerrdpath_importer_cacher%rr _dummy_moduler r r r?r>)r r"rCrrArrrfinder_for_pathUs  r)- __future__rrsryloggingr rrdtypesrnr@rutilrrr getLoggerr&rur/robjectr*r,r6r9rhr zipimporterr_frozen_importlib_externalZ_fi ImportError_frozen_importlibSourceFileLoader FileFinderSourcelessFileLoaderAttributeErrorrrr ModuleTyper rrrrrrsH   ,!ZO