TacG@@sM dZddlmZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl Z ddl Z ddl Z ddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlmZyddlZWnek ruddlZnXye Wne!k re"Z nXddl#m$Z$ddl%m&Z&m'Z'm(Z(ddlm)Z)y&ddlm*Z*m+Z+m,Z,e-Z.Wnek re/Z.nXdd lm0Z1dd l2m3Z3m4Z4yddl5j6Z7e7j8Wnek rme9Z7nXd d l:m;Z;dd l#m<Z<ddl#m=Z=e>de>de>de>de?Z@ddfejAkoddfknreBdne$jCre9ZDe9ZEne9ZFe9ZGe9ZHe9ZIe9ZJe9ZKe9ZLe9ZMe9ZNe9ZOe9ZPe9ZQe9ZRe9ZSe9ZTe9ZUe9ZVdeWfdYZXdZYiZZdZ[dZ\dZ]dZ^dZ_dZ`dZad ZbZcd!Zdd"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4d5d6d7d8d9d:d;d<d=d>d?d@dAddBdCdDdEdFdGdHdIdJdKdLdMdNdOdPdQdRdSdTdUdVdWdXdYdZd[d\d]d^d_d`dadbdcdddedfdggGZed=effdhYZgd>egfdiYZhdjehfdkYZid?egfdlYZjd@egfdmYZkiZldnjmejAZndZodoZpd ZqdZrdpZsdqZtdrZugdsZvdtZwduZxejydvZzejydwZ{exZ|dxZ}dyZ~e~ZdzZd{Ze9d|Zd}ZdUfd~YZdVefdYZd8fdYZdefdYZd7fdYZeZdAeBfdYZd9fdYZdZdZdZdZdZdZe9dZd\fdYZeteed]efdYZd^efdYZejdZefdYZeZdefdYZdefdYZd_efdYZete jedWefdYZdXefdYZdYefdYZe[ddidZe/dZe/dZee jee/dZeeedZe/dZdZdfdYZdZdZdZdZeejeee7dree7jene[ddie[ddidZdZdZdZe9dZdZeejeee jeee7drk ee7jendZeeedZdZidZdZdZdZdZejydjZejydejejBjZd<fdYZdZdZd:fdYZdefdYZdefdYZied6ed6ed6ZdZdefdYZdZd;e=jjfdYZdZdZdZdZdZdZe jddeXde-dZeedZedZdeefdYZdS(sZ Package resource API -------------------- A resource is a logical file contained within a package, or a logical subdirectory thereof. The package resource API expects resource names to have their path parts separated with ``/``, *not* whatever the local path separator is. Do not use os.path operations to manipulate resource names being passed into the API. The package resource API is designed to work with normal filesystem packages, .egg files, and unpacked .egg files. It can also work in a limited way with .zip files and with custom PEP 302 loaders that support the ``get_data()`` method. i(tabsolute_importN(t get_importer(tsix(turllibtmaptfilter(tutime(tmkdirtrenametunlink(topen(tisdirtspliti(t py31compat(tappdirs(t packagings&pkg_resources.extern.packaging.versions)pkg_resources.extern.packaging.specifierss+pkg_resources.extern.packaging.requirementss&pkg_resources.extern.packaging.markersiisPython 3.4 or later is requiredt PEP440WarningcB@seZdZRS(sa Used when there is an issue with a version or specifier not complying with PEP 440. (t__name__t __module__t__doc__(((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyRxscC@s?ytjj|SWn$tjjk r:tjj|SXdS(N(RtversiontVersiontInvalidVersiont LegacyVersion(tv((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyt parse_versionscK@s-tj|tjtj||dS(N(tglobalstupdatet _state_varstdicttfromkeys(tvartypetkw((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyt_declare_statescC@sLi}t}x6tjD](\}}|d|||||tcC@s{t}tj|}|dk rwtjdkrwy-ddjtd |jdf}Wqwt k rsqwXn|S(sZReturn this platform's maximum compatible version. distutils.util.get_platform() normally reports the minimum version of Mac OS X that would be required to *use* extensions produced by distutils. But what we want when checking compatibility is to know the version of Mac OS X that we are *running*. To allow usage of packages that explicitly require a newer version of Mac OS X, we must also know the current version of the OS. If this condition occurs for any other platform with a version in its platform strings, this function should be extended accordingly. tdarwins macosx-%s-%st.iiN( tget_build_platformtmacosVersionStringtmatchR3tsystplatformtjoint _macosx_verstgroupt ValueError(tplattm((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pytget_supported_platforms - trequiret run_scriptt get_providertget_distributiontload_entry_pointt get_entry_maptget_entry_infotiter_entry_pointstresource_stringtresource_streamtresource_filenametresource_listdirtresource_existstresource_isdirtdeclare_namespacet working_settadd_activation_listenertfind_distributionstset_extraction_pathtcleanup_resourcestget_default_cachet Environmentt WorkingSettResourceManagert Distributiont Requirementt EntryPointtResolutionErrortVersionConflicttDistributionNotFoundt UnknownExtratExtractionErrortparse_requirementsRt safe_namet safe_versiont get_platformtcompatible_platformst yield_linestsplit_sectionst safe_extrat to_filenametinvalid_markertevaluate_markertensure_directorytnormalize_pathtEGG_DISTt BINARY_DISTt SOURCE_DISTt CHECKOUT_DISTt DEVELOP_DISTtIMetadataProvidertIResourceProvidert FileMetadatat PathMetadatat EggMetadatat EmptyProvidertempty_providert NullProvidert EggProvidertDefaultProvidert ZipProvidertregister_findertregister_namespace_handlertregister_loader_typetfixup_namespace_packagesRtPkgResourcesDeprecationWarningtrun_maintAvailableDistributionscB@seZdZdZRS(s.Abstract base for dependency resolution errorscC@s|jjt|jS(N(t __class__RtreprR4(tself((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyt__repr__s(RRRR(((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyR`scB@sDeZdZdZedZedZdZdZRS(s An already-installed version conflicts with the requested version. Should be initialized with the installed Distribution and the requested Requirement. s3{self.dist} is installed but {self.req} is requiredcC@s |jdS(Ni(R4(R((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pytdist scC@s |jdS(Ni(R4(R((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pytreqscC@s|jjtS(N(t _templatetformattlocals(R((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pytreportscC@s$|s |S|j|f}t|S(st If required_by is non-empty, return a version of self that is a ContextualVersionConflict. (R4tContextualVersionConflict(Rt required_byR4((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyt with_contexts( RRRRtpropertyRRRR(((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyRas  RcB@s*eZdZejdZedZRS(s A VersionConflict that accepts a third parameter, the set of the requirements that required the installed Distribution. s by {self.required_by}cC@s |jdS(Ni(R4(R((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyR*s(RRRRaRRR(((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyR"s cB@sSeZdZdZedZedZedZdZdZ RS(s&A requested distribution was not foundsSThe '{self.req}' distribution was not found and is required by {self.requirers_str}cC@s |jdS(Ni(R4(R((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyR5scC@s |jdS(Ni(R4(R((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyt requirers9scC@s|js dSdj|jS(Nsthe applications, (RR>(R((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyt requirers_str=s cC@s|jjtS(N(RRR(R((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyRCscC@s |jS(N(R(R((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyt__str__Fs( RRRRRRRRRR(((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyRb/s cB@seZdZRS(s>Distribution doesn't have an "extra feature" of the given name(RRR(((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyRcJss{}.{}iicC@s|t|eZdZdZdZdZdZdZRS(cC@sdS(s;Does the package's distribution contain the named metadata?N((R((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyt has_metadataR6cC@sdS(s'The named metadata resource as a stringN((R((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyt get_metadataR6cC@sdS(sYield named metadata resource as list of non-blank non-comment lines Leading and trailing whitespace is stripped from each line, and lines with ``#`` as the first non-blank character are omitted.N((R((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pytget_metadata_linesR6cC@sdS(s>Is the named metadata a directory? (like ``os.path.isdir()``)N((R((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pytmetadata_isdirR6cC@sdS(s?List of metadata names in the directory (like ``os.listdir()``)N((R((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pytmetadata_listdirR6cC@sdS(s=Execute the named script in the supplied namespace dictionaryN((Rt namespace((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyRF R6(RRRRRRRRF(((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyRws      cB@sDeZdZdZdZdZdZdZdZRS(s3An object that provides access to package resourcescC@sdS(sdReturn a true filesystem path for `resource_name` `manager` must be an ``IResourceManager``N((tmanagert resource_name((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pytget_resource_filenameR6cC@sdS(siReturn a readable file-like object for `resource_name` `manager` must be an ``IResourceManager``N((RR((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pytget_resource_streamR6cC@sdS(smReturn a string containing the contents of `resource_name` `manager` must be an ``IResourceManager``N((RR((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pytget_resource_stringR6cC@sdS(s,Does the package contain the named resource?N((R((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyt has_resourceR6cC@sdS(s>Is the named resource a directory? (like ``os.path.isdir()``)N((R((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyRR"R6cC@sdS(s?List of resource names in the directory (like ``os.listdir()``)N((R((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyRP%R6( RRRRRRRRRRP(((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyRx s     cB@seZdZddZedZedZdZdZ dZ ddZ dZ d Z deed Zddedd Zdded Zd ZedZdZdZdZRS(sDA collection of active distributions on sys.path (or a similar list)cC@s^g|_i|_i|_g|_|dkr<tj}nx|D]}|j|qCWdS(s?Create working set from list of path entries (default=sys.path)N(tentriest entry_keystby_keyt callbacksR3R<Rt add_entry(RRtentry((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyt__init__,s       cC@se|}yddlm}Wntk r1|SXy|j|Wntk r`|j|SX|S(s1 Prepare the master working set. i(t __requires__(t__main__Rt ImportErrorRERat_build_from_requirements(tclstwsR((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyt _build_master9s   cC@s|g}t|}|j|t}x|D]}|j|q4Wx0tjD]%}||jkrU|j|qUqUW|jtj(|S(sQ Build a working set from a requirement spec. Rewrites sys.path. (RetresolveRZtaddR<RRR(Rtreq_specRtreqstdistsRR((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyRMs    cC@sT|jj|g|jj|x*t|tD]}|j||tq3WdS(sAdd a path item to ``.entries``, finding any distributions on it ``find_distributions(entry, True)`` is used to find distributions corresponding to the path entry, and they are added. `entry` is always appended to ``.entries``, even if it is already present. (This is because ``sys.path`` can contain the same value more than once, and the ``.entries`` of the ``sys.path`` WorkingSet should always equal ``sys.path``.) N(Rt setdefaultRRRVRRR(RRR((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyRcs cC@s|jj|j|kS(s9True if `dist` is the active distribution for its project(RRR.(RR((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyt __contains__rscC@sC|jj|j}|dk r?||kr?t||n|S(sFind a distribution matching requirement `req` If there is an active distribution for the requested project, this returns it as long as it meets the version requirement specified by `req`. But, if there is an active distribution for the project and it does *not* meet the `req` requirement, ``VersionConflict`` is raised. If there is no active distribution for the requested project, ``None`` is returned. N(RRR.R3Ra(RRR((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyRvs c@sfd|DS(sYield entry point objects from `group` matching `name` If `name` is None, yields all entry points in `group` from all distributions in the working set, otherwise only ones matching both `group` and `name` are yielded (in distribution order). c3@sL|]B}|jjD]&}dks=|jkr|VqqdS(N(RJtvaluesR3R(t.0RR(R@R(s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pys s((RR@R((R@Rs</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyRLscC@sQtjdj}|d}|j||d<|j|dj||dS(s?Locate distribution for `requires` and run `script_name` scriptiRiN(R<RRR-RERF(RtrequiresRRR((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyRFs    cc@spi}xc|jD]X}||jkr+qnx:|j|D]+}||kr9d||<|j|Vq9q9WqWdS(sYield distributions for non-duplicate projects in the working set The yield order is the order in which the items' path entries were added to the working set. iN(RRR(RtseentitemR.((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyt__iter__s  cC@s|r"|j|j|d|n|dkr:|j}n|jj|g}|jj|jg}| r|j|jkrdS||j|j<|j|kr|j|jn|j|kr|j|jn|j |dS(sAdd `dist` to working set, associated with `entry` If `entry` is unspecified, it defaults to the ``.location`` of `dist`. On exit from this routine, `entry` is added to the end of the working set's ``.entries`` (if it wasn't already present). `dist` is only added to the working set if it's for a project that doesn't already have a distribution in the set, unless `replace=True`. If it's added, any callbacks registered with the ``subscribe()`` method will be called. RN( t insert_onRR3tlocationRRR.RRt _added_new(RRRtinsertRtkeystkeys2((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyRs   cC@s+t|ddd}i}i}g}t} tjt} x|r&|jd} | |krmqFn| j| |sqFn|j| j} | dkr|j j| j} | dks| | krz|rz|} |dkr!| dkrt |j }q!t g}t g} n|j| | |d|} || j<| dkrz| j| d}t| |qzn|j| n| | kr| | }t| | j|n| j| jddd}|j|x/|D]'}| |j| j| j| | Map each requirement to the extras that demanded it. c@s@fd|jd|p$dD}j p?t|S(s Evaluate markers for req against each extra that demanded it. Return False if the req has a marker and fails evaluation. Otherwise, return True. c3@s(|]}jji|d6VqdS(textraN(tmarkertevaluate(RR)(R(s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pys s(N(N(RR3R*tany(RRR t extra_evals((Rs</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyR s  N(RRRR3R (((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyRscB@seZdZd eedZdZdZd dZ dZ dZ d e dZ d dZd Zd Zd ZRS( s5Searchable snapshot of distributions on a search pathcC@s,i|_||_||_|j|dS(s!Snapshot distributions available on a search path Any distributions found on `search_path` are added to the environment. `search_path` should be a sequence of ``sys.path`` items. If not supplied, ``sys.path`` is used. `platform` is an optional string specifying the name of the platform that platform-specific distributions must be compatible with. If unspecified, it defaults to the current platform. `python` is an optional string naming the desired version of Python (e.g. ``'3.6'``); it defaults to the current version. You may explicitly set `platform` (and/or `python`) to ``None`` if you wish to map *all* distributions, not just those compatible with the running platform or Python version. N(t_distmapR=tpythontscan(Rt search_pathR=R/((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyRs   cC@sI|jdkp-|jdkp-|j|jk}|oHt|j|jS(sIs distribution `dist` acceptable for this environment? The distribution must match the platform and python version requirements specified when this environment was created, or False is returned. N(R/R3t py_versionRiR=(RRt py_compat((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pytcan_addscC@s|j|jj|dS(s"Remove `dist` from the environmentN(R.R.tremove(RR((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyR5scC@sQ|dkrtj}nx2|D]*}x!t|D]}|j|q2WqWdS(sdScan `search_path` for distributions usable in this environment Any distributions found are added to the environment. `search_path` should be a sequence of ``sys.path`` items. If not supplied, ``sys.path`` is used. Only distributions conforming to the platform/python version defined at initialization are added. N(R3R<RRVR(RR1RR((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyR0s    cC@s|j}|jj|gS(sReturn a newest-to-oldest list of distributions for `project_name` Uses case-insensitive `project_name` comparison, assuming all the project's distributions use their project's name converted to all lowercase as their key. (tlowerR.R(RR tdistribution_key((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyt __getitem__s cC@su|j|rq|jrq|jj|jg}||krq|j||jdtjddt qqndS(sLAdd `dist` if we ``can_add()`` it and it has not already been added R.thashcmptreverseN( R4t has_versionR.RR.RRtoperatort attrgetterR(RRR((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyRs   cC@sy|j|}Wn#tk r8|s/nd}nX|dk rI|Sx%||jD]}||krW|SqWW|j||S(sFind distribution best matching `req` and usable on `working_set` This calls the ``find(req)`` method of the `working_set` to see if a suitable distribution is already active. (This may raise ``VersionConflict`` if an unsuitable version of the project is already active in the specified `working_set`.) If a suitable distribution isn't active, this method returns the newest distribution in the environment that meets the ``Requirement`` in `req`. If no suitable distribution is found, and `installer` is supplied, then the result of calling the environment's ``obtain(req, installer)`` method will be returned. N(RRaR3R.tobtain(RRRTRRR((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyR s    cC@s|dk r||SdS(sObtain a distribution matching `requirement` (e.g. via download) Obtain a distro that matches requirement (e.g. via download). In the base ``Environment`` class, this routine just returns ``installer(requirement)``, unless `installer` is None, in which case None is returned instead. This method is a hook that allows subclasses to attempt other ways of obtaining a distribution before falling back to the `installer` argument.N(R3(Rt requirementR((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyR>+s cc@s0x)|jjD]}||r|VqqWdS(s=Yield the unique project names of the available distributionsN(R.R(RR.((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyR7s cC@s{t|tr|j|nXt|trdxF|D](}x||D]}|j|qFWq5Wntd|f|S(s2In-place addition of a distribution or environmentsCan't add %r to environment(RR]RRZR(RtothertprojectR((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyt__iadd__=s cC@s@|jgdddd}x||fD]}||7}q(W|S(s4Add an environment or distribution to an environmentR=R/N(RR3(RR@tnewR((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyt__add__IsN(RRRR3RDtPY_MAJORRR4R5R0R8RRR R>RRBRD(((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyRZs        cB@seZdZRS(sTAn error occurred extracting a resource The following attributes are available from instances of this exception: manager The resource manager that raised this exception cache_path The base directory for resource extraction original_error The exception instance that caused extraction to fail (RRR(((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyRdUs cB@seZdZdZdZdZdZdZdZ dZ dZ dZ dd Z ed Zd Zd Zed ZRS(s'Manage resource extraction and packagescC@s i|_dS(N(t cached_files(R((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyRiscC@st|j|S(sDoes the named resource exist?(RGR(Rtpackage_or_requirementR((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyRQlscC@st|j|S(s,Is the named resource an existing directory?(RGRR(RRGR((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyRRps cC@st|j||S(s4Return a true filesystem path for specified resource(RGR(RRGR((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyROvs cC@st|j||S(s9Return a readable file-like object for specified resource(RGR(RRGR((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyRN|s cC@st|j||S(s%Return specified resource as a string(RGR(RRGR((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyRMs cC@st|j|S(s1List the contents of the named resource directory(RGRP(RRGR((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyRPs cC@sttjd}|jpt}tjdj}t|jt }||_ ||_ ||_ |dS(s5Give an error message for problems extracting file(s)is Can't extract file(s) to egg cache The following error occurred while trying to extract file(s) to the Python egg cache: {old_exc} The Python egg cache directory is currently set to: {cache_path} Perhaps your account does not have write access to this directory? You can change the cache directory by setting the PYTHON_EGG_CACHE environment variable to point to an accessible directory. N( R<texc_infotextraction_pathRYttextwraptdedenttlstripRdRRRt cache_pathtoriginal_error(Rtold_excRMttmplterr((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pytextraction_errors   cC@sx|jpt}tjj||d|}yt|Wntk rY|jnX|j|d|j |<|S(sReturn absolute location in cache for `archive_name` and `names` The parent directory of the resulting path will be created if it does not already exist. `archive_name` should be the base filename of the enclosing egg (which may not be the name of the enclosing zipfile!), including its ".egg" extension. `names`, if provided, should be a sequence of path name parts "under" the egg's extraction location. This method should only be called by resource providers that need to obtain an extraction location, and only for names they intend to extract, as it tracks the generated names for possible cleanup later. s-tmpi( RIRYRRR>t_bypass_ensure_directoryt ExceptionRRt_warn_unsafe_extraction_pathRF(Rt archive_nametnamest extract_patht target_path((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pytget_cache_paths    cC@swtjdkr*|jtjd r*dStj|j}|tj@sV|tj@rsd|}tj |t ndS(sN If the default extraction path is overridden and set to an insecure location, such as /tmp, it opens up an opportunity for an attacker to replace an extracted file with an unauthorized payload. Warn the user if a known insecure location is used. See Distribute #375 for more details. tnttwindirNs%s is writable by group/others and vulnerable to attack when used with get_resource_filename. Consider a more secure location (set with .set_extraction_path or the PYTHON_EGG_CACHE environment variable).( RRRtenvirontstattst_modetS_IWOTHtS_IWGRPtwarningstwarnt UserWarning(Rtmodetmsg((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyRUs &cC@s@tjdkr<tj|jdBd@}tj||ndS(s4Perform any platform-specific postprocessing of `tempname` This is where Mac header rewrites should be done; other platforms don't have anything special they should do. Resource providers should call this method ONLY after successfully extracting a compressed resource. They must NOT call it on resources that are already in the filesystem. `tempname` is the current (temporary) name of the file, and `filename` is the name it will be renamed to by the caller after this routine returns. tposiximiN(RRR^R_tchmod(RttempnametfilenameRe((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyt postprocessscC@s%|jrtdn||_dS(sSet the base path where resources will be extracted to, if needed. If you do not call this routine before any extractions take place, the path defaults to the return value of ``get_default_cache()``. (Which is based on the ``PYTHON_EGG_CACHE`` environment variable, with various platform-specific fallbacks. See that routine's documentation for more details.) Resources are extracted to subdirectories of this path based upon information given by the ``IResourceProvider``. You may set this to a temporary directory, but then you must call ``cleanup_resources()`` to delete the extracted files when done. There is no guarantee that ``cleanup_resources()`` will be able to remove all extracted files. (Note: you may not change the extraction path for a given resource manager once resources have been extracted, unless you first call ``cleanup_resources()``.) s5Can't change extraction path, files already extractedN(RFRARI(RR((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyRWs  cC@sdS(sB Delete all extracted resource files and directories, returning a list of the file and directory names that could not be successfully removed. This function does not have any concurrency protection, so it should generally only be called when the extraction path is a temporary directory exclusive to a single process. This method is not automatically called; you must call it explicitly or register it as an ``atexit`` function if you wish to ensure cleanup of a temporary directory used for extractions. N((Rtforce((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyRX R6N((RRRR3RIRRQRRRORNRMRPRRRZt staticmethodRURkRWRRX(((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyR\es           cC@s"tjjdp!tjddS(s Return the ``PYTHON_EGG_CACHE`` environment variable or a platform-relevant user cache dir for an app named "Python-Eggs". tPYTHON_EGG_CACHEtappnames Python-Eggs(RR]RRtuser_cache_dir(((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyRYscC@stjdd|S(sConvert an arbitrary string to a standard distribution name Any runs of non-alphanumeric/. characters are replaced with a single '-'. s[^A-Za-z0-9.]+t-(tretsub(R((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyRf%scC@sZyttjj|SWn9tjjk rU|jdd}tjdd|SXdS(sB Convert an arbitrary string to a standard version string RR8s[^A-Za-z0-9.]+RqN(RRRRRRRrRs(R((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyRg-s cC@stjdd|jS(sConvert an arbitrary string to a standard 'extra' name Any runs of non-alphanumeric characters are replaced with a single '_', and the result is always lowercased. s[^A-Za-z0-9.-]+R(RrRsR6(R)((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyRl9scC@s|jddS(s|Convert a project or version name to its filename-escaped form Any '-' characters are currently replaced with '_'. RqR(R(R((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyRmBscC@s;yt|Wn&tk r6}d|_d|_|SXtS(so Validate text as a PEP 508 environment marker; return an exception if invalid or False otherwise. N(Rot SyntaxErrorR3RjtlinenoR(ttextte((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyRnJs  cC@sLy tjj|}|jSWn%tjjk rG}t|nXdS(s Evaluate a PEP 508 environment marker. Return a boolean indicating the marker result in this environment. Raise SyntaxError if marker is invalid. This implementation uses the 'pyparsing' module. N(RtmarkerstMarkerR+t InvalidMarkerRt(RvR)R*Rw((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyRoXs cB@seZdZdZdZdZdZdZdZ dZ dZ dZ dZ dZd Zd Zd Zd Zd ZdZdZdZdZdZedZdZRS(sETry to implement resources and metadata for arbitrary PEP 302 loaderscC@s:t|dd|_tjjt|dd|_dS(NRt__file__R6(RR3RRRtdirnamet module_path(RR((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyRnscC@s|j|j|S(N(t_fnR}(RRR((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyRrscC@stj|j||S(N(tiotBytesIOR(RRR((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyRuscC@s|j|j|j|S(N(t_getR~R}(RRR((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyRxscC@s|j|j|j|S(N(t_hasR~R}(RR((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyR{scC@s|j|j|S(N(R~tegg_info(RR((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyt_get_metadata_path~scC@s,|js|jS|j|}|j|S(N(RRR(RRR((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyRs cC@s|js dS|j|}|j|}tjr8|Sy|jdSWn1tk r|}|jdj||7_nXdS(NR6sutf-8s in {} file at path: {}( RRRRtPY2tdecodetUnicodeDecodeErrortreasonR(RRRtvaluetexc((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyRs  cC@st|j|S(N(RjR(RR((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyRscC@s|j|j|j|S(N(t_isdirR~R}(RR((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyRRscC@s%|jo$|j|j|j|S(N(RRR~(RR((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyRscC@s|j|j|j|S(N(t_listdirR~R}(RR((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyRPscC@s)|jr%|j|j|j|SgS(N(RRR~(RR((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyRs c B@sd|}|j|s4edjen|j|jdd}|jdd}|j|j|}||dR (RtbaseR((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyR~s cC@stjj|jtjkp9tj|p9tj|}|sFdSd}tj|rztj| rzt|nt j |d dt dddS(sO Validate the resource paths according to the docs. https://setuptools.readthedocs.io/en/latest/pkg_resources.html#basic-resource-access >>> warned = getfixture('recwarn') >>> warnings.simplefilter('always') >>> vrp = NullProvider._validate_resource_path >>> vrp('foo/bar.txt') >>> bool(warned) False >>> vrp('../foo/bar.txt') >>> bool(warned) True >>> warned.clear() >>> vrp('/foo/bar.txt') >>> bool(warned) True >>> vrp('foo/../../bar.txt') >>> bool(warned) True >>> warned.clear() >>> vrp('foo/f../bar.txt') >>> bool(warned) False Windows path separators are straight-up disallowed. >>> vrp(r'\foo/bar.txt') Traceback (most recent call last): ... ValueError: Use of .. or absolute path in a resource path is not allowed. >>> vrp(r'C:\foo/bar.txt') Traceback (most recent call last): ... ValueError: Use of .. or absolute path in a resource path is not allowed. Blank values are allowed >>> vrp('') >>> bool(warned) False Non-string values are not. >>> vrp(None) Traceback (most recent call last): ... AttributeError: ... Ns=Use of .. or absolute path in a resource path is not allowed.is/ and will raise exceptions in a future release.t stackleveli( RRtpardirR t posixpathtseptisabstntpathRARbRctDeprecationWarning(RtinvalidRf((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyRs6 cC@s2t|jdr"|jj|StddS(Ntget_datas=Can't perform this operation for loaders without 'get_data()'(RRRR(RR((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyRsN(RRRR3tegg_nameRRRRRRRRRRRRRRRPRRFRRRR~RmRR(((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyR~gs0                  KcB@s eZdZdZdZRS(s&Provider based on a virtual filesystemcC@stj|||jdS(N(R~Rt _setup_prefix(RR((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyR-scC@s|j}d}xt||krt|rdtjj||_tjj|d|_||_ Pn|}tjj |\}}qWdS(NsEGG-INFO( R}R3t _is_egg_pathRRtbasenameRR>Rtegg_rootR (RRtoldR((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyR1s   (RRRRR(((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyR*s cB@sJeZdZdZdZdZdZdZedZ RS(s6Provides access to package resources in the filesystemcC@stjj|S(N(RRR(RR((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyRCscC@stjj|S(N(RRR (RR((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyRFscC@s tj|S(N(Rtlistdir(RR((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyRIscC@st|j|j|dS(Ntrb(R R~R}(RRR((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyRLscC@s&t|d}|jSWdQXdS(NR(R R(RRtstream((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyROscC@s@d}x3|D]+}tt|td}t||q WdS(NtSourceFileLoadertSourcelessFileLoader(RR(Rtimportlib_machineryttypeR3R(Rt loader_namesRt loader_cls((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyt _registerSs ( RRRRRRRRR(R(((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyR@s     cB@s<eZdZdZdZZdZdZdZ RS(s.Provider that returns nothing for all requestscC@stS(N(R(RR((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyR5cR6cC@sdS(NR6((RR((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyRescC@sgS(N((RR((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyRhscC@sdS(N((R((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyRksN( RRRR3R}RRRRR(((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyR|^s    t ZipManifestscB@s#eZdZedZeZRS(s zip manifest builder c@sBtj|-fdjD}t|SWdQXdS(s Build a dictionary similar to the zipimport directory caches, except instead of tuples, store ZipInfo objects. Use a platform-specific path separator (os.sep) for the path keys for compatibility with pypy on Windows. c3@s3|])}|jdtjj|fVqdS(RN(RRRtgetinfo(RR(tzfile(s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pys sN(tzipfiletZipFiletnamelistR(RRR#((Rs</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pytbuildws  (RRRR(Rtload(((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyRrstMemoizedZipManifestscB@s)eZdZejddZdZRS(s% Memoized zipfile manifests. t manifest_modsmanifest mtimecC@svtjj|}tj|j}||ksC||j|krk|j|}|j||||Rt_extract_resourcet _eager_to_zip(RRRRteagersR((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyRs     cC@s/|j}|jd}tj|}||fS(Nii(iii(t file_sizet date_timettimetmktime(tzip_stattsizeRt timestamp((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyt_get_date_and_sizes  c C@s||jkr^x9|j|D]'}|j|tjj||}q#Wtjj|S|j|j|\}}tst dny(|j |j |j |}|j ||r|Stddtjj|\}} tj||jj|tj|t| ||f|j| |yt| |Wnltjk rtjj|r|j ||r|Stjdkrt|t| ||SnnXWntjk r|jnX|S(Ns>"os.rename" and "os.unlink" are not supported on this platforms .$extracttdirR[(t_indexRRRR>R|RRt WRITE_SUPPORTtIOErrorRZRRt _is_currentt_mkstemptwriteRRtcloseRRkRterrortisfileRR RR( RRRRtlastRRt real_pathtoutfttmpnam((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyRsD    c C@s|j|j|\}}tjj|s2tStj|}|j|ks_|j|krctS|j j |}t |d}|j }WdQX||kS(sK Return True if the file_path is current for this zip_path RN( RRRRRRR^tst_sizeRRRR R( Rt file_pathRRRR^t zip_contentstft file_contents((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyRscC@sa|jdkrZg}x6dD].}|j|r|j|j|qqW||_n|jS(Nsnative_libs.txtseager_resources.txt(snative_libs.txtseager_resources.txt(RR3RR R(RRR((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyR"s  cC@sy |jSWntk ri}x~|jD]s}|jtj}xX|rtjj|d }||kr||j|dPqF|jg||RR(RtindRtpartstparent((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyR+s     cC@s.|j|}||jkp-||jkS(N(RRR(RRR((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyR<scC@s|j||jkS(N(RR(RR((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyR@scC@s%t|jj|j|dS(N((RRRR(RR((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyRCscC@s|j|j|j|S(N(RR~R(RR((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyRFscC@s|j|j|j|S(N(RR~R}(RR((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyRIsN(RRRR3RRRRRRRRRRmRRRRRRRRRR(((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyRs$     7      cB@sDeZdZdZdZdZdZdZdZRS(s*Metadata handler for standalone PKG-INFO files Usage:: metadata = FileMetadata("/path/to/PKG-INFO") This provider rejects all data and metadata requests except for PKG-INFO, which is treated as existing, and will be the contents of the file at the provided location. cC@s ||_dS(N(R(RR((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyR\scC@s|jS(N(R(RR((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyR_scC@s|dkotjj|jS(NsPKG-INFO(RRR(RR((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyRbscC@s_|dkrtdntj|jdddd}|j}WdQX|j||S(NsPKG-INFOs(No metadata except PKG-INFO is availabletencodingsutf-8terrorsR(RRR RRt_warn_on_replacement(RRRtmetadata((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyRes  ! cC@sGdjd}||krCd}|jt}tj|ndS(Ns�sutf-8s2{self.path} could not be properly decoded in UTF-8(RRRRbRc(RRtreplacement_charRPRf((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyRns  cC@st|j|S(N(RjR(RR((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyRvs( RRRRRRRRR(((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyRyPs     cB@seZdZdZRS(ssMetadata provider for egg directories Usage:: # Development eggs: egg_info = "/path/to/PackageName.egg-info" base_dir = os.path.dirname(egg_info) metadata = PathMetadata(base_dir, egg_info) dist_name = os.path.splitext(os.path.basename(egg_info))[0] dist = Distribution(basedir, project_name=dist_name, metadata=metadata) # Unpacked egg directories: egg_path = "/path/to/PackageName-ver-pyver-etc.egg" metadata = PathMetadata(egg_path, os.path.join(egg_path,'EGG-INFO')) dist = Distribution.from_filename(egg_path, metadata=metadata) cC@s||_||_dS(N(R}R(RRR((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyRs (RRRR(((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyRzzscB@seZdZdZRS(s Metadata provider for .egg filescC@s`|jtj|_||_|jrFtjj|j|j|_n |j|_|j dS(s-Create a metadata provider from a zipimporterN( RRRRRtprefixRR>R}R(Rtimporter((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyRs   ! (RRRR(((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyR{sRt_distribution_finderscC@s|t|tfind_eggs_in_zipt zipimportt zipimporterR6Rt from_location( RRRRtsubitemtsubpathRRtsubmeta((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyRs$     cC@sdS(N(((RRR((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyt find_nothingscC@sd}t|d|dtS(sL Given a list of filenames, return them in descending order by version number. >>> names = 'bar', 'foo', 'Python-2.7.10.egg', 'Python-2.7.2.egg' >>> _by_version_descending(names) ['Python-2.7.10.egg', 'Python-2.7.2.egg', 'foo', 'bar'] >>> names = 'Setuptools-1.2.3b1.egg', 'Setuptools-1.2.3.egg' >>> _by_version_descending(names) ['Setuptools-1.2.3.egg', 'Setuptools-1.2.3b1.egg'] >>> names = 'Setuptools-1.2.3b1.egg', 'Setuptools-1.2.3.post1.egg' >>> _by_version_descending(names) ['Setuptools-1.2.3.post1.egg', 'Setuptools-1.2.3b1.egg'] cS@sYtjj|\}}tj|jd|g}g|D]}tjj|^q=S(s6 Parse each component of the filename Rq( RRtsplitextt itertoolstchainR RRR(RtextRtpart((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyt _by_versionsR.R:(tsortedR(RWR((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyt_by_version_descendings c #@sttrHtjdttjjdVdSt}fd|D}t |}xQ|D]I}tjj|}t |}x||D] } | VqWqWdS(s6Yield distributions accessible on a sys.path directoryRsEGG-INFONc3@s'|]}t|r|VqdS(N(t dist_factory(RR(RR(s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pys s( t_normalize_cachedt_is_unpacked_eggR]RRzRRR>t safe_listdirRR( RRRRtfilteredtpath_item_entriesRtfullpathtfactoryR((RRs</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyt find_on_paths       cC@sf|j}tt|jd}|r.tS| rEt|rEtS| r_|jdr_tStS(s9 Return a dist_factory for a path_item and entry s .egg-infos .dist-infos .egg-link(s .egg-infos .dist-info( R6R,RRtdistributions_from_metadataRRVtresolve_egg_linktNoDists(RRRR6tis_meta((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyRs   RcB@s2eZdZdZejr'eZndZRS(sS >>> bool(NoDists()) False >>> list(NoDists()('anything')) [] cC@stS(N(R(R((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyt__bool__.scC@s tdS(N((titer(RR((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyt__call__3s(RRRR RRt __nonzero__R"(((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyR&s    cC@sytj|SWnnttfk r*nXtk r}|jtjtjtjfkpot |dddk}|sqnXdS(sI Attempt to list contents of path, but suppress some exceptions. twinerrori N(( RRtPermissionErrortNotADirectoryErrortOSErrorterrnotENOTDIRtEACCEStENOENTRR3(RRwt ignorable((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyR7s! cc@stjj|}tjj|rUttj|dkrCdSt||}n t|}tjj|}t j |||dt VdS(Nit precedence( RRR|R RRRzRyRR]RRv(RtrootRR((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyRLs cc@sDt|2}x(|D] }|j}|r|VqqWWdQXdS(s1 Yield non-empty lines from file at path N(R tstrip(RRtline((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pytnon_empty_lines[s   c@s>t}fd|D}tt|}t|dS(sa Given a path to an .egg-link, resolve distributions present in the referenced path. c3@s0|]&}tjjtjj|VqdS(N(RRR>R|(Rtref(R(s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pys ms((R1RRVtnext(Rtreferenced_pathstresolved_pathst dist_groups((Rs</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyRfs    t FileFindert_namespace_handlerst_namespace_packagescC@s|t|(Rt path_partst module_partsR(t package_nameRL(s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pytposition_in_sys_paths R.N(R<RRRRR<R(t orig_pathRPRtpRQtnew_path((RPRLRKs</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyRDs"   cC@stjz|tkrdStj}|jd\}}}|rt||tkrgt|nytj|j }Wqt k rt d|qXntj |pdgj|tj |gx|D]}t||qWWdtjXdS(s9Declare that package 'packageName' is a namespace packageNR8sNot a package:(t_impt acquire_lockR9R<Rt rpartitionRSRRR<RRRR3RRGt release_lock(RERRRR((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyRSs&        cC@sbtjzFx?tj|dD]+}t||}|r t||q q WWdtjXdS(sDEnsure that previously-declared namespace packages include path_itemN((RURVR9RRGRRX(RRtpackageR((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyRs cC@s`tjj||jdd}t|}x+|jD]}t||kr8Pq8q8W|SdS(sBCompute an ns-package subpath for a filesystem or zipfile importerR8iN(RRR>R RR<(RRRERRt normalizedR((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pytfile_ns_handlers " cC@sdS(N(R3(RRRER((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pytnull_ns_handler scC@s.tjjtjjtjjt|S(s1Normalize a file/dir name for comparison purposes(RRtnormcasetrealpathRt _cygwin_patch(Rj((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyRq scC@s#tjdkrtjj|S|S(s Contrary to POSIX 2008, on Cygwin, getcwd (3) contains symlink components. Using os.path.abspath() works around this limitation. A fix in os.getcwd() would probably better, in Cygwin even more so, except that this seems to be by design... tcygwin(R<R=RRtabspath(Rj((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyR_ scC@s9y ||SWn&tk r4t|||<}|SXdS(N(RRq(RjRtresult((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyR) s   cC@s|jjdS(s7 Determine if given path appears to be an egg. s.egg(R6R(R((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyR1 scC@s.t|o-tjjtjj|ddS(s@ Determine if given path appears to be an unpacked egg. sEGG-INFOsPKG-INFO(RRRRR>(R((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyR8 s cC@sU|jd}|j}|rQdj|}ttj||tj|ndS(NR8(R RR>tsetattrR<R(RERRR((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyRBB s  cc@st|tjrVxn|jD]0}|j}|r|jd r|VqqWn-x*|D]"}xt|D] }|VqpWq]WdS(s9Yield non-empty/non-comment lines of a string or sequencet#N(RRRt splitlinesR/RRj(tstrststss((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyRjJ s  s \w+(\.\w+)*$s (?P[^-]+) ( -(?P[^-]+) ( -py(?P[^-]+) ( -(?P.+) )? )? )? cB@seZdZd d ddZdZdZedZdZ dddZ e j dZ eddZed Zedd Zedd ZRS(s3Object representing an advertised importable objectcC@s[t|std|n||_||_t||_t||_||_dS(NsInvalid module name(tMODULERARt module_namettupletattrsR R(RRRjRlR R((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyRj s   cC@sfd|j|jf}|jr<|ddj|j7}n|jrb|ddj|j7}n|S(Ns%s = %st:R8s [%s]t,(RRjRlR>R (RRg((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyRs s   cC@sdt|S(NsEntryPoint.parse(%r)(R(R((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyR{ scO@sO| s|s|r,tjdtddn|rE|j||n|jS(sH Require packages for this EntryPoint, then resolve it. sJParameters to load are deprecated. Call .resolve and .require separately.Ri(RbRcRRER(RRER4tkwargs((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyR~ s cC@sdt|jddgdd}ytjt|j|SWn%tk r_}tt|nXdS(sD Resolve the entry point from its module and attrs. tfromlistRtleveliN( RRjt functoolstreduceRRlRRR(RRR((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyR s cC@sr|jr%|j r%td|n|jj|j}tj|||d|j}tttj|dS(Ns&Can't require() without a distributionR ( R RRcRRTRRRR(RRRRR#((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyRE s s]\s*(?P.+?)\s*=\s*(?P[\w.]+)\s*(:\s*(?P[\w.]+))?\s*(?P\[.*\])?\s*$cC@s|jj|}|s0d}t||n|j}|j|d}|drl|djdnd}||d|d|||S(sParse a single entry point from string `src` Entry point syntax follows the form:: name = some.module:some.attr [extra1, extra2] The entry name and module name are required, but the ``:attrs`` and ``[extras]`` parts are optional s9EntryPoint must be in 'name=module:attrs [extras]' formatR tattrR8RR((tpatternR;RAt groupdictt _parse_extrasR (RtsrcRRCRftresR Rl((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyR s  #cC@s9|s dStjd|}|jr2tn|jS(Ntx((R^RtspecsRAR (Rt extras_specR((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyRw s   cC@st|std|ni}xZt|D]L}|j||}|j|krptd||jn|||j '{project_name} ({version})' is being parsed as a legacy, non PEP 440, version. You may find odd behavior and sort order. In particular it will be sorted as less than 0.0. It is recommended to migrate to PEP 440 compatible versions. s R(RRRRRRJRKR/RRbRcRtvarsR(RtLVt is_legacyRP((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyt_warn_legacy_version\ s  cC@suy |jSWnctk rp|j}|dkrl|j|j}dj|j|}t||n|SXdS(Ns4Missing 'Version:' header and/or {} file at path: {}(RRt _get_versionR3t_get_metadata_path_for_displaytPKG_INFORRA(RRRRf((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyRv s    cC@s>y |jSWn)tk r6|j|j|_nX|jS(s~ A map of extra to its list of (direct) requirements for this distribution, including the null extra. (t_Distribution__dep_mapRt_filter_extrast_build_dep_map(R((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyt_dep_map s   cC@sxttd|D]}|}|j|}|jd\}}}|oet|pet| }|rwg}nt|pd}|j|gj |qW|S(s Given a mapping of extras to dependencies, strip off environment markers and filter out any dependencies not matching the markers. RmN( RRR3RRRnRoRlRR (tdmR)t new_extraRRR*t fails_marker((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyR s   cC@s`i}xSdD]K}xBt|j|D]+\}}|j|gjt|q)Wq W|S(Ns requires.txts depends.txt(s requires.txts depends.txt(Rkt _get_metadataRR Re(RRRR)R((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyR s  "'cC@s|j}g}|j|jddxS|D]K}y|j|t|Wq/tk rytd||fq/Xq/W|S(s@List of Requirements needed for this distro if `extras` are useds%s has no such extra feature %rN((RR RR3RlRRc(RR RtdepsR((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyR s   cC@s/y|jj|}Wntk r*dSX|S(sK Return the path to the given metadata file, if available. s[could not detect](RRRT(RRR((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyR s  cc@s5|j|r1x|j|D] }|VqWndS(N(RR(RRR0((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyR scC@s"|j|j}t|}|S(N(RRR(RR}R((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyR s cC@s|dkrtj}n|j|d||tjkrt|jx6|jdD]"}|tjkrWt|qWqWWndS(s>Ensure distribution is importable on `path` (default=sys.path)Rsnamespace_packages.txtN( R3R<RRRRRRRS(RRRtpkg((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pytactivate s   cC@sOdt|jt|j|jp'tf}|jrK|d|j7}n|S(s@Return what this distribution's standard .egg filename should bes %s-%s-py%sRq(RmR RR2RER=(RRj((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyR s  cC@s(|jrd||jfSt|SdS(Ns%s (%s)(RR(R((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyR s cC@sMyt|dd}Wntk r/d}nX|p9d}d|j|fS(NRs[unknown version]s%s %s(RR3RAR (RR((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyR s    cC@s.|jdrt|nt|j|S(sADelegate all unrecognized public attributes to .metadata providerR(RRRR(RRt((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyt __getattr__ scC@s<tttt|jtd|jjDBS(Ncs@s$|]}|jds|VqdS(RN(R(RRt((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pys  s(RRtsuperR]t__dir__R(R((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyR sRcK@s(|jt|tjj|||S(N(RRRRR(RRjRR ((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyR scC@sTt|jtjjr1d|j|jf}nd|j|jf}tj|S(s?Return a ``Requirement`` that matches this distribution exactlys%s==%ss%s===%s(RRRRRR R^R(Rtspec((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyR scC@sD|j||}|dkr:td||ffn|jS(s=Return the `name` entry point of `group` or raise ImportErrorsEntry point %r not foundN(RKR3RR(RR@RR((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyRI s cC@scy |j}Wn3tk rBtj|jd|}|_nX|dk r_|j|iS|S(s=Return the entry point map for `group`, or the full entry mapsentry_points.txtN(t_ep_mapRR_RRR3R(RR@tep_map((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyRJ& s    cC@s|j|j|S(s<Return the EntryPoint object for `group`+`name`, or ``None``(RJR(RR@R((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyRK2 sc C@s|p |j}|sdSt|}tjj|}g|D]}|rVt|pY|^q>}xt|D]\}}||kr|rPqdSqo||kro|jtkro| r|||krdS|tjkr|j n|j |||j ||PqoqoW|tjkr.|j n|rG|j d|n |j |dSxMt ry|j ||d} Wntk rPq[X|| =|| =| }q[WdS(sEnsure self.location is on path If replace=False (default): - If location is already in path anywhere, do nothing. - Else: - If it's an egg and its parent directory is on path, insert just ahead of the parent. - Else: add to the end of path. If replace=True: - If location is already on path anywhere (not eggs) or higher priority than its parent (eggs) do nothing. - Else: - If it's an egg and its parent directory is on path, insert just ahead of the parent, removing any lower-priority entries. - Else: add it to the front of path. Nii(RRRRR|t enumerateR-RrR<tcheck_version_conflictRRRRIRA( RRtlocRtnloctbdirRStnpathRtnp((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyR6 sB +       cC@s|jdkrdStj|jd}t|j}x|jdD]}|tjksJ||ksJ|tkr}qJn|dkrqJnt tj|dd}|rt|j |sJ|j |jrqJnt d|||jfqJWdS( Nt setuptoolssnamespace_packages.txts top_level.txtt pkg_resourcestsiteR{sIModule %s was already imported from %s, but %s is being added to sys.path(RRR( R.RRRRqRR<RR9RR3Rt issue_warning(RtnspRtmodnametfn((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyRz s"  cC@s8y |jWn&tk r3tdt|tSXtS(NsUnbuilt egg for (RRARRRR(R((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyR; s   cK@sYd}x0|jD]"}|j|t||dqW|jd|j|j|S(s@Copy this distribution, substituting in any changed keyword argss<project_name version py_version platform location precedenceRN(R RRR3RR(RR RWRt((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pytclone s  cC@s g|jD]}|r |^q S(N(R(Rtdep((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyR  sN((3RRRRR3RERrRR(RRRR9RRRRRRRR.RRRRRmRRRRRRRRRRRRRRtobjectRRRIRJRKRRR;RR (((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyR] s\                        D   tEggInfoDistributioncB@seZdZRS(cC@s"|j}|r||_n|S(s Packages installed by distutils (e.g. numpy or scipy), which uses an old safe_version, and so their version numbers can get mangled when converted to filenames (e.g., 1.11.0.dev0+2329eae to 1.11.0.dev0_2329eae). These distributions will not be parsed properly downstream by Distribution and safe_version, so take an extra step and try to get the version number from the metadata file itself instead of the filename. (RR(Rt md_version((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyR s  (RRR(((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyR stDistInfoDistributioncB@sJeZdZdZejdZedZedZ dZ RS(sV Wrap an actual or potential sys.path entry w/metadata, .dist-info style. tMETADATAs([\(,])\s*(\d.*?)\s*([,\)])cC@sTy |jSWnBtk rO|j|j}tjjj||_|jSXdS(sParse and cache metadataN(t _pkg_infoRRRtemailtparsertParsertparsestr(RR((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyt_parsed_pkg_info s   cC@s6y |jSWn$tk r1|j|_|jSXdS(N(t_DistInfoDistribution__dep_mapRt_compute_dependencies(R((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyR s   c@sigd6}|_gx3|jjdp2gD]}jt|q3Wfd}t|d}|dj|xR|jjdpgD]8}t|j}t t|||||R4(R((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyR s(RRR(((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyR scc@stt|}x|D]~}d|krA||jd }n|jdr|d j}y|t|7}Wqtk rdSXnt|VqWdS(sYield ``Requirement`` objects for each specification in `strs` `strs` must be a string, or a (possibly-nested) iterable thereof. s #s\iN(R!RjRRR/R3t StopIterationR^(RfR}R0((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyRe s   cB@sMeZdZdZdZdZdZdZedZ RS(cC@sytt|j|Wn+tjjk rG}tt|nX|j|_ t |j}||j |_ |_ g|jD]}|j|jf^q|_ttt|j|_|j |j|jt|j|jrt|jndf|_t|j|_dS(s>DO NOT CALL THIS UNDOCUMENTED METHOD; use Requirement.parse()!N(RR^RRRtInvalidRequirementRRRt unsafe_nameRfR6R R.t specifierR<RR{RkRRlR turlRR*R3thashCmpRt_Requirement__hash(Rtrequirement_stringRwR R((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyR s + $cC@st|to|j|jkS(N(RR^R(RR@((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyR/ scC@s ||k S(N((RR@((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyR5 scC@sGt|tr1|j|jkr%tS|j}n|jj|dtS(Nt prereleases(RR]R.RRRtcontainsR(RR((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyR8 s  cC@s|jS(N(R(R((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyRD scC@sdt|S(NsRequirement.parse(%r)(R(R((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyRG scC@st|\}|S(N(Re(RgR((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyRJ s( RRRRRRRRRmR(((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyR^ s     cC@st|kr|tfS|S(sJ Ensure object appears in the mro even for old-style classes. (R(tclasses((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyt_always_objectP s  cC@sPttjt|dt|}x"|D]}||kr.||Sq.WdS(s2Return an adapter factory for `ob` from `registry`RN(RtinspecttgetmroRR(tregistryR/R@tt((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyRZ s'  cC@s)tjj|}tj|dtdS(s1Ensure that the parent directory of `path` existstexist_okN(RRR|R tmakedirsR(RR|((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyRpb scC@svtstdnt|\}}|rr|rrt| rrt|yt|dWqrtk rnqrXndS(s/Sandbox-bypassing version of ensure_directory()s*"os.mkdir" not supported on this platform.iN(RRR R RSRtFileExistsError(RR|Rj((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyRSh s  cc@sd}g}xt|D]y}|jdr|jdrs|sI|rW||fVn|dd!j}g}qtd|q|j|qW||fVdS(ssSplit a string or iterable thereof into (section, content) pairs Each ``section`` is a stripped version of the section header ("[section]") and each ``content`` is a list of stripped lines excluding blank lines and comment-only lines. If there are any such lines before the first section header, they're returned in a first ``section`` of ``None``. t[t]iisInvalid section headingN(R3RjRRR/RAR(RgtsectiontcontentR0((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyRku s  cO@s7tj}ztt_tj||SWd|t_XdS(N(RR tos_openttempfiletmkstemp(R4R told_open((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyR s   R;tcategoryRcO@s||||S(N((RR4Ro((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyt _call_aside s c@s:t|d<|jfdtDdS(s=Set up global resource manager (deliberately not state-saved)t_managerc3@s3|])}|jds|t|fVqdS(RN(RR(RR(R(s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pys sN(R\RR(R%((Rs</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyt _initialize s    cC@stj}tdd||j}|j}|j}|j}|}td|D|ddtg|_ t t |j t jtjtdS(sE Prepare the master working set and make the ``require()`` API available. This function has explicit effects on the global state of pkg_resources. It is intended to be invoked once at the initialization of this module. Invocation by other packages is unsupported and done at their own risk. RRTcs@s!|]}|jdtVqdS(RN(RR(RR((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pys scS@s|jdtS(NR(RR(R((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyR5 R6R%N(R[RR!RERLR&RFRkRRRRRR<RRRR(RTRERLRURFR((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyt_initialize_master_working_set s        cB@seZdZRS(s Base class for warning about deprecations in ``pkg_resources`` This class is not derived from ``DeprecationWarning``, and as such is visible by default. (RRR(((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyR s(Rt __future__RR<RRRRrR@RRRbR^RrtpkgutilR<R=RRt email.parserRR(RRJR RRRRRURtimpRt NameErrorR'tpkg_resources.externRtpkg_resources.extern.six.movesRRRRRRR RRRR Rtos.pathR R timportlib.machineryt machineryRRR3R6R RRRRt __metaclass__t version_infot RuntimeErrorRR%R&RERTRUtresources_streamRXt resource_dirRNRWRRRMRLRPRORQRR8R9tRuntimeWarningRRRR!R'R)R,R0R1R2t _sget_nonet _sset_noneRDt__all__RTR`RaRRbRcRRRERrRsRtRuRvRRGR?RR9RR:RRhRiRFRRHRIRJRKRwRxR[RRRZRRdR\RYRfRgRlRmRnRoR~RRRRR|R}RRRRRyRzR{RRVRR RRRRRRR1Rt ImpImporterRR7RRGRDRSRR[R\RqR_RRRRBRjR;RitVERBOSEt IGNORECASERR_RRR]RRRRRARReRR^RRRpRSRkRtfilterwarningsRRRRtWarningR(((s</tmp/pip-install-78OKQW/setuptools/pkg_resources/__init__.pyts                                     +                                   .           *            " "          2   7      '