Viewing File: /opt/alt/python35/lib/python3.5/site-packages/pkg_resources/__pycache__/__init__.cpython-35.pyc



\ʘ^@sSdZddlmZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
Z
ddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlmZyddlZWnek
rRddlZYnXddlmZddlm Z m!Z!m"Z"ddlm#Z#y&ddlm$Z$m%Z%m&Z&d	Z'Wnek
rd
Z'YnXddlm(Z)ddl*m+Z+m,Z,yddl-j.Z/e/j0Wnek
r*dZ/YnXd
dl1m2Z2ddlm3Z3ddlm4Z4e5de5de5de5dddfej6koddfknre7ddZ8dZ9Gddde:Z;Gddde<Z=Gddde=e4j>j?Z@Gddde=e4j>jAZBdd ZCiZDd!d"ZEd#d$ZFd%d&ZGd'd(ZHd)d*ZId+d,ZJd-d.ZKd/d0ZLZMd1d2ZNd3d4d5d6d7d8d9d:d;d<d=d>d?d@dAdBdCdDdEdFdGdHdIdJdKdLdMdNdOdPdQdRddSd dTdUdVdWdXdYdZd[d\d]d^d_d`dadbdcdddedfdgdhdidjdkdldmdndodpdqdrdsdtdudvgFZOGdwdNdNePZQGdxdOdOeQZRGdydzdzeRZSGd{dPdPeQZTGd|dQdQeQZUiZVej>ddZWdZXd}ZYd
ZZdZ[d
Z\d~drZ]dd5Z^gddZ_ddZ`ddZaejbdZcejbdZdeaZeddWZfdd4ZgegZhdd6Zidd7Zjddd8Zkdd9ZlGddedeZmGddfdfemZnGddIdIe<ZoGdddepZqGddHdHe<ZrerZsGddRdRe7ZtGddJdJZuddGZvddTZwddUZxddZZydd[Zzdd\Z{ddd]Z|GddldlZ}e]e<e}Gddmdme}Z~Gddndne~ZejGddjdje}ZeZGdddepZGdddeZGddde	jZGddodoe~Ze]e
jeGddgdgeZGddhdheZGddidieZeEddiddpZd
ddDZd
ddZee
jed
ddZee<eddZd
ddZeejeee/dree/jeeEddieEddiddqZddZddZddAZdddsZddZeejeee
jeee/drQ	ee/jeddZee<edd_ZiddZddZddZddZddXZejbdjZejbdejejBjZGddMdMe<ZddZddZGddKdKe<ZGdddeZGdddeZdededeiZddZGdddeZddSZGddLdLe4jjZddZddZdd^ZddZddYZddZejdde;dd	ddZeeddZeddZdS)aZ
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.
)absolute_importN)get_importer)six)urllibmapfilter)utime)mkdirrenameunlinkTF)open)isdirsplit)
py31compat)appdirs)	packagingz&pkg_resources.extern.packaging.versionz)pkg_resources.extern.packaging.specifiersz+pkg_resources.extern.packaging.requirementsz&pkg_resources.extern.packaging.markerszPython 3.3 or later is requiredc@seZdZdZdS)
PEP440Warningza
    Used when there is an issue with a version or specifier not complying with
    PEP 440.
    N)__name__
__module____qualname____doc__rr/__init__.pyrYsrcseZdZfddZfddZfddZfddZfd	d
ZfddZfd
dZ	ddZ
ddZS)_SetuptoolsVersionMixincstt|jS)N)superr__hash__)self)	__class__rrrasz _SetuptoolsVersionMixin.__hash__cs9t|trt||kStt|j|SdS)N)
isinstancetuplerr__lt__)rother)rrrr"dsz_SetuptoolsVersionMixin.__lt__cs9t|trt||kStt|j|SdS)N)r r!rr__le__)rr#)rrrr$jsz_SetuptoolsVersionMixin.__le__cs9t|trt||kStt|j|SdS)N)r r!rr__eq__)rr#)rrrr%psz_SetuptoolsVersionMixin.__eq__cs9t|trt||kStt|j|SdS)N)r r!rr__ge__)rr#)rrrr&vsz_SetuptoolsVersionMixin.__ge__cs9t|trt||kStt|j|SdS)N)r r!rr__gt__)rr#)rrrr'|sz_SetuptoolsVersionMixin.__gt__cs9t|trt||kStt|j|SdS)N)r r!rr__ne__)rr#)rrrr(sz_SetuptoolsVersionMixin.__ne__cCst||S)N)r!)rkeyrrr__getitem__sz#_SetuptoolsVersionMixin.__getitem__c
#stjdtjdddddddddd	ijfd
dfdd
}tjdtddx|t|D]}|VqWdS)Nz(\d+ | [a-z]+ | \.| -)precZpreview-zfinal-rcZdev@c3sxxlj|D][}||}|s|dkr;q|dddkrb|jdVqd|VqWdVdS)N.r
0123456789*z*final)rzfill)spart)component_rereplacerr_parse_version_partss
z>_SetuptoolsVersionMixin.__iter__.<locals>._parse_version_partscsg}x|jD]|}|jdr|dkrax$|r`|ddkr`|jq=Wx$|r|ddkr|jqdW|j|qWt|S)Nr3z*finalrz*final-Z00000000r:)lower
startswithpopappendr!)r5partsr6)r9rrold_parse_versionsz;_SetuptoolsVersionMixin.__iter__.<locals>.old_parse_versionaYou have iterated over the result of pkg_resources.parse_version. This is a legacy behavior which is inconsistent with the new version class introduced in setuptools 8.0. In most cases, conversion to a tuple is unnecessary. For comparison of versions, sort the Version instances directly. If you have another use case requiring the tuple, please file a bug with the setuptools project describing that need.
stacklevelr)recompileVERBOSEgetwarningswarnRuntimeWarningstr)rr@r6r)r9r7r8r__iter__sz _SetuptoolsVersionMixin.__iter__)rrrrr"r$r%r&r'r(r*rJrr)rrr`src@seZdZdS)SetuptoolsVersionN)rrrrrrrrKsrKc@seZdZdS)SetuptoolsLegacyVersionN)rrrrrrrrLsrLcCs7yt|SWn"tjjk
r2t|SYnXdS)N)rKrversionInvalidVersionrL)vrrr
parse_versionsrPcKs-tj|tjtj||dS)N)globalsupdate_state_varsdictfromkeys)Zvartypekwrrr_declare_statesrWcCsLi}t}x6tjD](\}}|d|||||<qW|S)NZ_sget_)rQrSitems)stategkrOrrr__getstate__s
	 r\cCsJt}x:|jD],\}}|dt|||||qW|S)NZ_sset_)rQrXrS)rYrZr[rOrrr__setstate__s	$r]cCs
|jS)N)copy)valrrr
_sget_dictsr`cCs|j|j|dS)N)clearrR)r)obrYrrr
_sset_dicts
rccCs
|jS)N)r\)r_rrr_sget_objectsrdcCs|j|dS)N)r])r)rbrYrrr_sset_objectsrecGsdS)Nr)argsrrr<lambda>srgcCst}tj|}|dk	r{tjdkr{y3ddjtdd|jdf}Wntk
rzYnX|S)aZReturn 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.
    Ndarwinzmacosx-%s-%sr0r)	get_build_platformmacosVersionStringmatchsysplatformjoin_macosx_versgroup
ValueError)platmrrrget_supported_platforms
	3
rurequire
run_scriptget_providerget_distributionload_entry_point
get_entry_mapget_entry_infoiter_entry_pointsresource_stringresource_streamresource_filenameresource_listdirresource_existsresource_isdirdeclare_namespaceworking_setadd_activation_listenerfind_distributionsset_extraction_pathcleanup_resourcesget_default_cacheEnvironment
WorkingSetResourceManagerDistributionRequirement
EntryPointResolutionErrorVersionConflictDistributionNotFoundUnknownExtraExtractionErrorparse_requirements	safe_namesafe_versionget_platformcompatible_platformsyield_linessplit_sections
safe_extrato_filenameinvalid_markerevaluate_markerensure_directorynormalize_pathEGG_DISTBINARY_DISTSOURCE_DIST
CHECKOUT_DISTDEVELOP_DISTIMetadataProviderIResourceProviderFileMetadataPathMetadataEggMetadata
EmptyProviderempty_providerNullProviderEggProviderDefaultProviderZipProviderregister_finderregister_namespace_handlerregister_loader_typefixup_namespace_packagesrrun_mainAvailableDistributionsc@s"eZdZdZddZdS)rz.Abstract base for dependency resolution errorscCs|jjt|jS)N)rrreprrf)rrrr__repr__GszResolutionError.__repr__N)rrrrrrrrrrDsc@sXeZdZdZdZeddZeddZddZd	d
Z	dS)rz
    An already-installed version conflicts with the requested version.

    Should be initialized with the installed Distribution and the requested
    Requirement.
    z3{self.dist} is installed but {self.req} is requiredcCs|jdS)Nr)rf)rrrrdistUszVersionConflict.distcCs|jdS)Nr)rf)rrrrreqYszVersionConflict.reqcCs|jjtS)N)	_templateformatlocals)rrrrreport]szVersionConflict.reportcCs$|s
|S|j|f}t|S)zt
        If required_by is non-empty, return a version of self that is a
        ContextualVersionConflict.
        )rfContextualVersionConflict)rrequired_byrfrrrwith_context`szVersionConflict.with_contextN)
rrrrrpropertyrrrrrrrrrKsc@s5eZdZdZejdZeddZdS)rz
    A VersionConflict that accepts a third parameter, the set of the
    requirements that required the installed Distribution.
    z by {self.required_by}cCs|jdS)Nri)rf)rrrrrssz%ContextualVersionConflict.required_byN)rrrrrrrrrrrrrks
rc@sjeZdZdZdZeddZeddZeddZd	d
Z	ddZ
d
S)rz&A requested distribution was not foundzSThe '{self.req}' distribution was not found and is required by {self.requirers_str}cCs|jdS)Nr)rf)rrrrr~szDistributionNotFound.reqcCs|jdS)Nr)rf)rrrr	requirersszDistributionNotFound.requirerscCs|js
dSdj|jS)Nzthe applicationz, )rro)rrrr
requirers_strs	z"DistributionNotFound.requirers_strcCs|jjtS)N)rrr)rrrrrszDistributionNotFound.reportcCs
|jS)N)r)rrrr__str__szDistributionNotFound.__str__N)rrrrrrrrrrrrrrrrxsc@seZdZdZdS)rz>Distribution doesn't have an "extra feature" of the given nameN)rrrrrrrrrsricCs|t|<dS)aRegister `provider_factory` to make providers for `loader_type`

    `loader_type` is the type or class of a PEP 302 ``module.__loader__``,
    and `provider_factory` is a function that, passed a *module* object,
    returns an ``IResourceProvider`` for that module.
    N)_provider_factories)Zloader_typeZprovider_factoryrrrrscCst|tr2tj|p1tt|dSytj|}Wn)tk
rnt	|tj|}YnXt
|dd}tt||S)z?Return an IResourceProvider for the named module or requirementr
__loader__N)
r rrfindrvrIrmmodulesKeyError
__import__getattr
_find_adapterr)ZmoduleOrReqmoduleloaderrrrrxs#

cCs|stjd}|dkrnd}tjj|rnttdrntj|}d|krn|d}|j|j	d|dS)Nrz0/System/Library/CoreServices/SystemVersion.plist	readPlistZProductVersionr0)
rnZmac_verospathexistshasattrplistlibrr>r)_cacherMZplistZ
plist_contentrrrrps
rpcCsddddij||S)NZPowerPCZppcZPower_Macintosh)rE)machinerrr_macosx_archsrcCsyddlm}Wn"tk
r8ddlm}YnX|}tjdkr|jdryTt}tj	dj
dd}dt|dt|d	t|fSWnt
k
rYnX|S)
zReturn this platform's string for platform-specific distributions

    XXX Currently this is the same as ``distutils.util.get_platform()``, but it
    needs some hacks for Linux and Mac OS X.
    r)rrhzmacosx- _zmacosx-%d.%d-%sr)	sysconfigrImportErrorZdistutils.utilrmrnr<rprunamer8intrrr)rrsrMrrrrrjs
		
rjzmacosx-(\d+)\.(\d+)-(.*)zdarwin-(\d+)\.(\d+)\.(\d+)-(.*)cCsL|dks$|dks$||kr(dStj|}|rHtj|}|stj|}|rt|jd}d|jd|jdf}|dkr|dks|dkr|d	krdSd
S|jd|jdks|jd|jdkrd
St|jdt|jdkrDd
SdSd
S)zCan code for the `provided` platform run on the `required` platform?

    Returns true if either platform is ``None``, or the platforms are equal.

    XXX Needs compatibility checks for Linux and other unixy OSes.
    NTrz%s.%sriz10.3r2z10.4Fr)rkrldarwinVersionStringrrq)ZprovidedZrequiredZreqMacZprovMacZ
provDarwinZdversionZmacosversionrrrrs*$"*cCsNtjdj}|d}|j||d<t|dj||dS)z@Locate distribution `dist_spec` and run its `script_name` scriptrrrN)rm	_getframe	f_globalsrarvrw)Z	dist_specscript_namensnamerrrrws



cCs^t|tjr!tj|}t|tr<t|}t|tsZtd||S)z@Return a current distribution object for a Requirement or stringz-Expected string, Requirement, or Distribution)r rstring_typesrparserxr	TypeError)rrrrry'scCst|j||S)zDReturn `name` entry point of `group` for `dist` or raise ImportError)ryrz)rrqrrrrrz2scCst|j|S)z=Return the entry point map for `group`, or the full entry map)ryr{)rrqrrrr{7scCst|j||S)z<Return the EntryPoint object for `group`+`name`, or ``None``)ryr|)rrqrrrrr|<sc@sXeZdZddZddZddZddZd	d
ZddZd
S)rcCsdS)z;Does the package's distribution contain the named metadata?Nr)rrrrhas_metadataBszIMetadataProvider.has_metadatacCsdS)z'The named metadata resource as a stringNr)rrrrget_metadataEszIMetadataProvider.get_metadatacCsdS)zYield 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.Nr)rrrrget_metadata_linesHsz$IMetadataProvider.get_metadata_linescCsdS)z>Is the named metadata a directory?  (like ``os.path.isdir()``)Nr)rrrrmetadata_isdirNsz IMetadataProvider.metadata_isdircCsdS)z?List of metadata names in the directory (like ``os.listdir()``)Nr)rrrrmetadata_listdirQsz"IMetadataProvider.metadata_listdircCsdS)z=Execute the named script in the supplied namespace dictionaryNr)r	namespacerrrrwTszIMetadataProvider.run_scriptN)	rrrrrrrrrwrrrrrAsc@s^eZdZdZddZddZddZdd	Zd
dZdd
Z	dS)rz3An object that provides access to package resourcescCsdS)zdReturn a true filesystem path for `resource_name`

        `manager` must be an ``IResourceManager``Nr)manager
resource_namerrrget_resource_filename[sz'IResourceProvider.get_resource_filenamecCsdS)ziReturn a readable file-like object for `resource_name`

        `manager` must be an ``IResourceManager``Nr)rrrrrget_resource_stream`sz%IResourceProvider.get_resource_streamcCsdS)zmReturn a string containing the contents of `resource_name`

        `manager` must be an ``IResourceManager``Nr)rrrrrget_resource_stringesz%IResourceProvider.get_resource_stringcCsdS)z,Does the package contain the named resource?Nr)rrrrhas_resourcejszIResourceProvider.has_resourcecCsdS)z>Is the named resource a directory?  (like ``os.path.isdir()``)Nr)rrrrrmsz IResourceProvider.resource_isdircCsdS)z?List of resource names in the directory (like ``os.listdir()``)Nr)rrrrrpsz"IResourceProvider.resource_listdirN)
rrrrrrrrrrrrrrrXsc@seZdZdZdddZeddZeddZd	d
ZddZ	d
dZ
dddZddZddZ
dddddZddddddZdddddZddZddd Zd!d"Zd#d$Zd%d&ZdS)'rzDA collection of active distributions on sys.path (or a similar list)NcCs[g|_i|_i|_g|_|dkr9tj}x|D]}|j|q@WdS)z?Create working set from list of path entries (default=sys.path)N)entries
entry_keysby_key	callbacksrmr	add_entry)rrentryrrr__init__ws					
zWorkingSet.__init__cCsm|}yddlm}Wntk
r5|SYnXy|j|Wntk
rh|j|SYnX|S)z1
        Prepare the master working set.
        r)__requires__)__main__rrrvr_build_from_requirements)clswsrrrr
_build_masters	
	
zWorkingSet._build_mastercCs|g}t|}|j|t}x|D]}|j|q4Wx-tjD]"}||jkrU|j|qUW|jtjdd<|S)zQ
        Build a working set from a requirement spec. Rewrites sys.path.
        N)rresolveraddrmrrr)rZreq_specrreqsdistsrrrrrrs
z#WorkingSet._build_from_requirementscCsT|jj|g|jj|x*t|dD]}|j||dq3WdS)aAdd 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``.)
        TFN)r
setdefaultrr>rr)rrrrrrrs
zWorkingSet.add_entrycCs|jj|j|kS)z9True if `dist` is the active distribution for its project)rrEr))rrrrr__contains__szWorkingSet.__contains__cCs@|jj|j}|dk	r<||kr<t|||S)aFind 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)rrEr)r)rrrrrrrs
zWorkingSet.findccsdx]|D]U}|j|}|dkrGx1|jD]}|Vq5Wq||kr||VqWdS)aYield 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).
        N)r{values)rrqrrreprrrr}s
zWorkingSet.iter_entry_pointscCsQtjdj}|d}|j||d<|j|dj||dS)z?Locate distribution for `requires` and run `script_name` scriptrrrN)rmrrrarvrw)rrequiresrrrrrrrws



zWorkingSet.run_scriptccsji}x]|jD]R}||jkr(qx7|j|D](}||kr6d||<|j|Vq6WqWdS)zYield 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.
        rN)rrr)rseenitemr)rrrrJs
zWorkingSet.__iter__TFcCs|r|j|j|d||dkr4|j}|jj|g}|jj|jg}|r~|j|jkr~dS||j|j<|j|kr|j|j|j|kr|j|j|j|dS)aAdd `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.
        r8N)		insert_onrlocationrr
r)rr>
_added_new)rrrinsertr8keysZkeys2rrrrs	zWorkingSet.addcCst|ddd}i}i}g}t}	tjt}
x|r|jd}||krjqF|	j||sqF|j|j}|dkrr|j	j|j}|dks||kre|re|}
|dkr|dkrt
|j}nt
g}tg}
|j
||
|}||j<|dkre|
j|d}t|||j|||kr|
|}t||j||j|jddd}|j|x/|D]'}|
|j|j|j|	|<qWd||<qFW|S)aList all distributions needed to (recursively) meet `requirements`

        `requirements` must be a sequence of ``Requirement`` objects.  `env`,
        if supplied, should be an ``Environment`` instance.  If
        not supplied, it defaults to all distributions available within any
        entry or distribution in the working set.  `installer`, if supplied,
        will be invoked with each requirement that cannot be met by an
        already-installed distribution; it should return a ``Distribution`` or
        ``None``.

        Unless `replace_conflicting=True`, raises a VersionConflict exception if
        any requirements are found on the path that have the correct name but
        the wrong version.  Otherwise, if an `installer` is supplied it will be
        invoked to obtain the correct version of the requirement and activate
        it.

        `extras` is a list of the extras to be used with these requirements.
        This is important because extra requirements may look like `my_req;
        extra = "my_extra"`, which would otherwise be interpreted as a purely
        optional requirement.  Instead, we want to be able to assert that these
        requirements are truly required.
        NrrTr:r:)list
_ReqExtrascollectionsdefaultdictsetr=markers_passrEr)rrrr
best_matchrr>rrrextrasextendrproject_name)rrequirementsenv	installerZreplace_conflictingrZ	processedZbestZto_activateZ
req_extrasrrrrrZ
dependent_reqZnew_requirementsZnew_requirementrrrrsJ		 



zWorkingSet.resolvecCsSt|}|ji}i}|dkrJt|j}||7}n
||}|jg}	tt|	j|x|D]}
x||
D]}|jg}y|	j|||}
Wn<t	k
r}z|||<|rwnPWYdd}~XqXtt|	j|
|j
tj|
PqWqWt|}|j||fS)asFind all activatable distributions in `plugin_env`

        Example usage::

            distributions, errors = working_set.find_plugins(
                Environment(plugin_dirlist)
            )
            # add plugins+libs to sys.path
            map(working_set.add, distributions)
            # display errors
            print('Could not load', errors)

        The `plugin_env` should be an ``Environment`` instance that contains
        only distributions that are in the project's "plugin directory" or
        directories. The `full_env`, if supplied, should be an ``Environment``
        contains all currently-available distributions.  If `full_env` is not
        supplied, one is created automatically from the ``WorkingSet`` this
        method is called on, which will typically mean that every directory on
        ``sys.path`` will be scanned for distributions.

        `installer` is a standard installer callback as used by the
        ``resolve()`` method. The `fallback` flag indicates whether we should
        attempt to resolve older versions of a plugin if the newest version
        cannot be resolved.

        This method returns a 2-tuple: (`distributions`, `error_info`), where
        `distributions` is a list of the distributions found in `plugin_env`
        that were loadable, along with any other distributions that are needed
        to resolve their dependencies.  `error_info` is a dictionary mapping
        unloadable plugin distributions to an exception instance describing the
        error that occurred. Usually this will be a ``DistributionNotFound`` or
        ``VersionConflict`` instance.
        N)
rsortrrrrras_requirementrrrRrTrU)rZ
plugin_envZfull_envr"fallbackZplugin_projectsZ
error_infoZ
distributionsr!Z
shadow_setrrrZ	resolveesrOrrrfind_pluginsos4$




	
zWorkingSet.find_pluginscGs7|jt|}x|D]}|j|qW|S)aEnsure that distributions matching `requirements` are activated

        `requirements` must be a string or a (possibly-nested) sequence
        thereof, specifying the distributions and versions required.  The
        return value is a sequence of the distributions that needed to be
        activated to fulfill the requirements; all relevant distributions are
        included, even if they were already activated in this working set.
        )rrr)rr Zneededrrrrrvs	
zWorkingSet.requirecCsL||jkrdS|jj||s-dSx|D]}||q4WdS)zInvoke `callback` for all distributions

        If `existing=True` (default),
        call on all existing ones, as well.
        N)rr>)rcallbackexistingrrrr	subscribes
zWorkingSet.subscribecCs"x|jD]}||q
WdS)N)r)rrr'rrrrszWorkingSet._added_newcCs<|jdd|jj|jj|jddfS)N)rrr^rr)rrrrr\s(zWorkingSet.__getstate__cCsZ|\}}}}|dd|_|j|_|j|_|dd|_dS)N)rr^rrr)rZe_k_b_crrrrrrrr]s
zWorkingSet.__setstate__)rrrrrclassmethodrrrrrr}rwrJrrr&rvr)rr\r]rrrrrts(
WSc@s%eZdZdZdddZdS)rz>
    Map each requirement to the extras that demanded it.
    NcsCfdd|jf|p'dD}jpBt|S)z
        Evaluate markers for req against each extra that
        demanded it.

        Return False if the req has a marker and fails
        evaluation. Otherwise, return True.
        c3s'|]}jjd|iVqdS)extraN)markerevaluate).0r+)rrr	<genexpr>sz*_ReqExtras.markers_pass.<locals>.<genexpr>N)N)rEr,any)rrrZextra_evalsr)rrrs	 z_ReqExtras.markers_pass)rrrrrrrrrrsrc@seZdZdZdeeddZddZddZdd	d
Z	ddZ
d
dZdddZdddZ
ddZddZddZdS)rz5Searchable snapshot of distributions on a search pathNcCs,i|_||_||_|j|dS)a!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.3'``);
        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)_distmaprnpythonscan)rsearch_pathrnr2rrrr
s			zEnvironment.__init__cCsC|jdks0|jdks0|j|jkoBt|j|jS)zIs 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)r2
py_versionrrn)rrrrrcan_add!szEnvironment.can_addcCs|j|jj|dS)z"Remove `dist` from the environmentN)r1r)remove)rrrrrr7,szEnvironment.removecCsN|dkrtj}x2|D]*}x!t|D]}|j|q/WqWdS)adScan `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)rmrrr)rr4rrrrrr30s
	
zEnvironment.scancCs|j}|jj|gS)aReturn 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.

        )r;r1rE)rrZdistribution_keyrrrr*?szEnvironment.__getitem__cCso|j|rk|jrk|jj|jg}||krk|j||jdtjddddS)zLAdd `dist` if we ``can_add()`` it and it has not already been added
        r)hashcmpreverseTN)	r6has_versionr1r
r)r>r#operator
attrgetter)rrr	rrrrJs

zEnvironment.addcCsW|j|}|dk	r|Sx%||jD]}||kr-|Sq-W|j||S)aFind 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)rr)obtain)rrrr"rrrrrSs
zEnvironment.best_matchcCs|dk	r||SdS)aObtain 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.Nr)rZrequirementr"rrrr=is	zEnvironment.obtainccs-x&|jjD]}||r|VqWdS)z=Yield the unique project names of the available distributionsN)r1r)rr)rrrrJus
zEnvironment.__iter__cCs{t|tr|j|nXt|trdxF|D](}x||D]}|j|qFWq5Wntd|f|S)z2In-place addition of a distribution or environmentzCan't add %r to environment)r rrrr)rr#Zprojectrrrr__iadd__{s
zEnvironment.__iadd__cCs@|jgdddd}x||fD]}||7}q(W|S)z4Add an environment or distribution to an environmentrnNr2)r)rr#newr!rrr__add__szEnvironment.__add__)rrrrruPY_MAJORrr6r7r3r*rrr=rJr>r@rrrrrs		c@seZdZdZdS)raTAn 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
    N)rrrrrrrrrs
c@seZdZdZdZddZddZddZd	d
ZddZ	d
dZ
ddZddZfddZ
eddZddZddZdddZdS)rz'Manage resource extraction and packagesNcCs
i|_dS)N)cached_files)rrrrrszResourceManager.__init__cCst|j|S)zDoes the named resource exist?)rxr)rpackage_or_requirementrrrrrszResourceManager.resource_existscCst|j|S)z,Is the named resource an existing directory?)rxr)rrCrrrrrszResourceManager.resource_isdircCst|j||S)z4Return a true filesystem path for specified resource)rxr)rrCrrrrrsz!ResourceManager.resource_filenamecCst|j||S)z9Return a readable file-like object for specified resource)rxr)rrCrrrrrszResourceManager.resource_streamcCst|j||S)z%Return specified resource as a string)rxr)rrCrrrrr~szResourceManager.resource_stringcCst|j|S)z1List the contents of the named resource directory)rxr)rrCrrrrrsz ResourceManager.resource_listdircCsttjd}|jpt}tjdj}t|jt	}||_
||_||_|dS)z5Give an error message for problems extracting file(s)ra
            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)
rmexc_infoextraction_pathrtextwrapdedentlstriprrrr
cache_pathZoriginal_error)rold_excrItmplerrrrrextraction_errors			z ResourceManager.extraction_errorc	Cso|jpt}tjj||d|}yt|Wn|jYnX|j|d|j|<|S)aReturn 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.
        z-tmpr)	rErrrro_bypass_ensure_directoryrM_warn_unsafe_extraction_pathrB)rarchive_namenamesZextract_pathZtarget_pathrrrget_cache_paths


zResourceManager.get_cache_pathcCsttjdkr*|jtjdr*dStj|j}|tj@sV|tj@rpd|}tj	|t
dS)aN
        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.
        ntZwindirNz%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).)rrr<environstatst_modeS_IWOTHS_IWGRPrFrGUserWarning)rmodemsgrrrrOs
&z,ResourceManager._warn_unsafe_extraction_pathcCs=tjdkr9tj|jdBd@}tj||dS)a4Perform 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.
        posiximiN)rrrUrVchmod)rZtempnamefilenamerZrrrpostprocessszResourceManager.postprocesscCs"|jrtd||_dS)aSet 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()``.)
        z5Can't change extraction path, files already extractedN)rBrrrE)rrrrrr-s		z#ResourceManager.set_extraction_pathFcCsdS)aB
        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.
        Nr)rforcerrrrGsz!ResourceManager.cleanup_resources)rrrrrErrrrrr~rrMrRstaticmethodrOr_rrrrrrrscCs"tjjdp!tjddS)z
    Return the ``PYTHON_EGG_CACHE`` environment variable
    or a platform-relevant user cache dir for an app
    named "Python-Eggs".
    ZPYTHON_EGG_CACHEZappnamezPython-Eggs)rrTrErZuser_cache_dirrrrrrUscCstjdd|S)zConvert an arbitrary string to a standard distribution name

    Any runs of non-alphanumeric/. characters are replaced with a single '-'.
    z[^A-Za-z0-9.]+r-)rBsub)rrrrrascCs^yttjj|SWn=tjjk
rY|jdd}tjdd|SYnXdS)zB
    Convert an arbitrary string to a standard version string
    rr0z[^A-Za-z0-9.]+r-N)rIrrMVersionrNr8rBrb)rMrrrris
cCstjdd|jS)zConvert 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.
    z[^A-Za-z0-9.-]+r)rBrbr;)r+rrrruscCs|jddS)z|Convert a project or version name to its filename-escaped form

    Any '-' characters are currently replaced with '_'.
    r-r)r8)rrrrr~scCsPyt|Wn;tk
rK}zd|_d|_|SWYdd}~XnXdS)zo
    Validate text as a PEP 508 environment marker; return an exception
    if invalid or False otherwise.
    NF)rSyntaxErrorr^lineno)texterrrrs		cCs^y tjj|}|jSWn7tjjk
rY}zt|WYdd}~XnXdS)z
    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)rZmarkersZMarkerr-Z
InvalidMarkerrd)rfr+r,rgrrrrs
c@seZdZdZdZdZdZddZddZddZ	d	d
Z
ddZd
dZddZ
ddZddZddZddZddZddZddZdd Zd!d"Zd#d$Zd%d&ZdS)'rzETry to implement resources and metadata for arbitrary PEP 302 loadersNcCs:t|dd|_tjjt|dd|_dS)Nr__file__r)rrrrdirnamemodule_path)rrrrrrszNullProvider.__init__cCs|j|j|S)N)_fnrj)rrrrrrrsz"NullProvider.get_resource_filenamecCstj|j||S)N)ioBytesIOr)rrrrrrrsz NullProvider.get_resource_streamcCs|j|j|j|S)N)_getrkrj)rrrrrrrsz NullProvider.get_resource_stringcCs|j|j|j|S)N)_hasrkrj)rrrrrrszNullProvider.has_resourcecCs%|jo$|j|j|j|S)N)egg_inforork)rrrrrrszNullProvider.has_metadatacCsE|js
dS|j|j|j|}tjrA|jdS|S)Nrzutf-8)rprnrkrZPY3decode)rrvaluerrrrs	zNullProvider.get_metadatacCst|j|S)N)rr)rrrrrrszNullProvider.get_metadata_linescCs|j|j|j|S)N)_isdirrkrj)rrrrrrszNullProvider.resource_isdircCs%|jo$|j|j|j|S)N)rprsrk)rrrrrrszNullProvider.metadata_isdircCs|j|j|j|S)N)_listdirrkrj)rrrrrrszNullProvider.resource_listdircCs)|jr%|j|j|j|SgS)N)rprtrk)rrrrrrs	zNullProvider.metadata_listdirc
Csd|}|j|s)td||j|jdd}|jdd}|j|j|}||d<tjj|rt	|j
}t||d}t|||nWdd	l
m}t|d|jd|f||<t||d}	t|	||dS)
Nzscripts/zNo script named %rz


rhexecr)cache)rrrr8rkrprrrrreadrCrw	linecacherxlenr)
rrrZscriptZscript_textZscript_filenamesourcecoderxZscript_coderrrrws

%zNullProvider.run_scriptcCstddS)Nz9Can't perform this operation for unregistered loader type)NotImplementedError)rrrrrroszNullProvider._hascCstddS)Nz9Can't perform this operation for unregistered loader type)r~)rrrrrrsszNullProvider._isdircCstddS)Nz9Can't perform this operation for unregistered loader type)r~)rrrrrrtszNullProvider._listdircCs&|r"tjj||jdS|S)N/)rrror)rbaserrrrrkszNullProvider._fncCs2t|jdr"|jj|StddS)Nget_dataz=Can't perform this operation for loaders without 'get_data()')rrrr~)rrrrrrnszNullProvider._get)rrrregg_namerprrrrrrrrrrrrrrwrorsrtrkrnrrrrrs,c@s.eZdZdZddZddZdS)rz&Provider based on a virtual filesystemcCstj|||jdS)N)rr
_setup_prefix)rrrrrr
szEggProvider.__init__cCs|j}d}xq||krt|ratjj||_tjj|d|_||_P|}tjj	|\}}qWdS)NzEGG-INFO)
rj_is_egg_pathrrbasenamerrorpegg_rootr)rroldrrrrrs		zEggProvider._setup_prefixN)rrrrrrrrrrrsc@sdeZdZdZddZddZddZdd	Zd
dZe	dd
Z
dS)rz6Provides access to package resources in the filesystemcCstjj|S)N)rrr)rrrrrro szDefaultProvider._hascCstjj|S)N)rrr
)rrrrrrs#szDefaultProvider._isdircCs
tj|S)N)rlistdir)rrrrrrt&szDefaultProvider._listdircCst|j|j|dS)Nrb)rrkrj)rrrrrrr)sz#DefaultProvider.get_resource_streamc	Cs't|d}|jSWdQRXdS)Nr)rry)rrstreamrrrrn,szDefaultProvider._getcCs)ttdtd}t||dS)NSourceFileLoader)rimportlib_machinerytyper)rZ
loader_clsrrr	_register0s	zDefaultProvider._registerN)rrrrrorsrtrrnr*rrrrrrsc@sPeZdZdZddZZddZddZdZddZ	dS)	rz.Provider that returns nothing for all requestscCsdS)NFr)rrrrrrg=szEmptyProvider.<lambda>cCsdS)Nrr)rrrrrrg>scCsgS)Nr)rrrrrrg?sNcCsdS)Nr)rrrrrBszEmptyProvider.__init__)
rrrrrsrornrtrjrrrrrr:sc@s.eZdZdZeddZeZdS)ZipManifestsz
    zip manifest builder
    c
sCt|0fddjD}t|SWdQRXdS)a
        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.
        c3s3|])}|jdtjj|fVqdS)rN)r8rsepZgetinfo)r.r)zfilerrr/Ysz%ZipManifests.build.<locals>.<genexpr>N)ContextualZipFileZnamelistrT)rrrXr)rrbuildNs	zZipManifests.buildN)rrrrr*rloadrrrrrIsrc@s4eZdZdZejddZddZdS)MemoizedZipManifestsz%
    Memoized zipfile manifests.
    manifest_modzmanifest mtimecCsstjj|}tj|j}||ksC||j|krh|j|}|j||||<||jS)zW
        Load a manifest at path or return a suitable manifest already loaded.
        )	rrnormpathrUst_mtimemtimerrmanifest)rrrrrrrrjszMemoizedZipManifests.loadN)rrrrr
namedtuplerrrrrrrdsrcs@eZdZdZddZddZfddZS)rzL
    Supplement ZipFile class to support context manager for Python 2.6
    cCs|S)Nr)rrrr	__enter__}szContextualZipFile.__enter__cCs|jdS)N)close)rrrr	tracebackrrr__exit__szContextualZipFile.__exit__cs8ttjdr"tj||Stt|j|S)zI
        Construct a ZipFile or ContextualZipFile as appropriate
        r)rzipfileZipFilerr__new__)rrfkwargs)rrrrszContextualZipFile.__new__)rrrrrrrrr)rrrxsrc@seZdZdZdZeZddZddZddZ	e
d	d
ZddZe
d
dZddZddZddZddZddZddZddZddZdd ZdS)!rz"Resource support for zips and eggsNcCs*tj|||jjtj|_dS)N)rrrarchiverrzip_pre)rrrrrrszZipProvider.__init__cCsF|j|jr)|t|jdStd||jfdS)Nz%s is not a subpath of %s)r<rr{AssertionError)rfspathrrr
_zipinfo_nameszZipProvider._zipinfo_namecCsj|j|}|j|jtjrM|t|jddjtjStd||jfdS)Nrz%s is not a subpath of %s)rr<rrrr{rr)rzip_pathrrrr_partss

'zZipProvider._partscCs|jj|jjS)N)_zip_manifestsrrr)rrrrzipinfoszZipProvider.zipinfocCs|jstd|j|}|j}dj|j||krxx'|D]}|j||j|qUW|j||S)Nz5resource_filename() only supported for .egg, not .zipr)rr~_resource_to_zip_get_eager_resourcesror_extract_resource
_eager_to_zip)rrrreagersrrrrrs		
z!ZipProvider.get_resource_filenamecCs/|j}|jd}tj|}||fS)Nrrr:)rrr:)Z	file_size	date_timetimemktime)Zzip_statsizer	timestamprrr_get_date_and_sizes	
zZipProvider._get_date_and_sizec
Cs||jkr^x9|j|D]'}|j|tjj||}q#Wtjj|S|j|j|\}}tst	dy&|j
|j|j|}|j
||r|Stddtjj|\}}	tj||jj|tj|t|	||f|j|	|yt|	|Wnjtjk
rtjj|r|j
||r|Stjdkrt|t|	||SYnXWntjk
r|jYnX|S)Nz>"os.rename" and "os.unlink" are not supported on this platformz	.$extractdirrS)_indexrrrrorirr
WRITE_SUPPORTIOErrorrRrr_is_current_mkstempwriterrrrr_r
errorisfilerrrM)
rrrrZlastrrZ	real_pathZoutfZtmpnamrrrrs@$


zZipProvider._extract_resourcec		Cs|j|j|\}}tjj|s2dStj|}|j|ks_|j|krcdS|jj	|}t
|d}|j}WdQRX||kS)zK
        Return True if the file_path is current for this zip_path
        FrN)rrrrrrUst_sizerrrrry)	rZ	file_pathrrrrUZzip_contentsfZ
file_contentsrrrrszZipProvider._is_currentcCs[|jdkrTg}x3dD]+}|j|r|j|j|qW||_|jS)Nnative_libs.txteager_resources.txt)rr)rrrr)rrrrrrrs
	z ZipProvider._get_eager_resourcescCsy|jSWntk
ri}x|jD]y}|jtj}x^|rtjj|dd}||kr||j|dPqF|jg||<qFWq+W||_|SYnXdS)Nrr:r:)	Z	_dirindexAttributeErrorrrrrror>r=)rZindrr?parentrrrrs
		zZipProvider._indexcCs.|j|}||jkp-||jkS)N)rrr)rrrrrrro!szZipProvider._hascCs|j||jkS)N)rr)rrrrrrs%szZipProvider._isdircCs%t|jj|j|fS)N)rrrEr)rrrrrrt(szZipProvider._listdircCs|j|j|j|S)N)rrkr)rrrrrr+szZipProvider._eager_to_zipcCs|j|j|j|S)N)rrkrj)rrrrrr.szZipProvider._resource_to_zip)rrrrrrrrrrrrrrarrrrrrorsrtrrrrrrrs$		

	4	c@sReZdZdZddZddZddZdd	Zd
dZdS)
ra*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.
    cCs
||_dS)N)r)rrrrrrAszFileMetadata.__init__cCs|dkotjj|jS)NzPKG-INFO)rrr)rrrrrrDszFileMetadata.has_metadatac	Cs]|dkrtdtj|jdddd}|j}WdQRX|j||S)NzPKG-INFOz(No metadata except PKG-INFO is availableencodingzutf-8errorsr8)rrlrrry_warn_on_replacement)rrrmetadatarrrrGs!
zFileMetadata.get_metadatacCsDdjd}||kr@d}|jt}tj|dS)Ns�zutf-8z2{self.path} could not be properly decoded in UTF-8)rqrrrFrG)rrZreplacement_charrKr[rrrrPs
z!FileMetadata._warn_on_replacementcCst|j|S)N)rr)rrrrrrXszFileMetadata.get_metadata_linesN)	rrrrrrrrrrrrrr5s
	c@s"eZdZdZddZdS)rasMetadata 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)
    cCs||_||_dS)N)rjrp)rrrprrrrps	zPathMetadata.__init__N)rrrrrrrrrr\sc@s"eZdZdZddZdS)rz Metadata provider for .egg filescCs`|jtj|_||_|jrFtjj|j|j|_n|j|_|j	dS)z-Create a metadata provider from a zipimporterN)
rrrrrprefixrrorjr)rimporterrrrrxs		!zEggMetadata.__init__N)rrrrrrrrrrusrT_distribution_finderscCs|t|<dS)axRegister `distribution_finder` to find distributions in sys.path items

    `importer_type` is the type or class of a PEP 302 "Importer" (sys.path item
    handler), and `distribution_finder` is a callable that, passed a path
    item and the importer instance, yields ``Distribution`` instances found on
    that path item.  See ``pkg_resources.find_on_path`` for an example.N)r)
importer_typeZdistribution_finderrrrrscCs+t|}tt|}||||S)z.Yield distributions accessible via `path_item`)rrr)	path_itemonlyrfinderrrrrsccs|jjdrdSt|}|jdrEtj|d|V|rOdSx|jdD]}t|rtj	j
||}xttj
||D]}|VqWq_|jjdr_tj	j
||}ttj
|}||_tj|||Vq_WdS)z@
    Find eggs in zip files; possibly multiple nested eggs.
    z.whlNzPKG-INFOrrz
.dist-info)rendswithrrr
from_filenamerrrrrofind_eggs_in_zip	zipimportzipimporterr;rp
from_location)rrrrZsubitemsubpathrZsubmetarrrrs"	rcCsfS)Nr)rrrrrrfind_nothingsrcCs"dd}t|d|ddS)aL
    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']
    cSsGtjj|\}}tj|jd|g}dd|DS)z6
        Parse each component of the filename
        r-cSs"g|]}tjj|qSr)rrMr)r.r6rrr
<listcomp>s	z?_by_version_descending.<locals>._by_version.<locals>.<listcomp>)rrsplitext	itertoolschainr)rextr?rrr_by_versionsz+_by_version_descending.<locals>._by_versionr)r9T)sorted)rQrrrr_by_version_descendingsrccs.t|}tjj|r*tj|tjr*t|rntj|dt	|tjj
|dVnttj|}x|D]}|j
}|jds|jdr:tjj
||}tjj|rttj|dkrqt	||}nt|}tj|||dtVq|rt|rttjj
||}x|D]}	|	VqoWq|r|jdrttjj
||}
|
j}WdQRXx[|D]S}|jsqtjj
||j}
t|
}x|D]}|VqWPqWqWdS)	z6Yield distributions accessible on a sys.path directoryrzEGG-INFOz	.egg-infoz
.dist-infor
precedencez	.egg-linkN)_normalize_cachedrrr
accessR_OK_is_unpacked_eggrrrrorrr;rr{rrrrrr	readlinesstriprstrip)rrrZpath_item_entriesrr;Zfullpathrr	rZ
entry_fileZentry_lineslinerrrrrfind_on_pathsB'	 



	r
FileFinder_namespace_handlers_namespace_packagescCs|t|<dS)aRegister `namespace_handler` to declare namespace packages

    `importer_type` is the type or class of a PEP 302 "Importer" (sys.path item
    handler), and `namespace_handler` is a callable like this::

        def namespace_handler(importer, path_entry, moduleName, module):
            # return a path_entry to use for child packages

    Namespace handlers are only called if the importer object has already
    agreed that it can handle the relevant path item, and they should only
    return a subpath if the module __path__ does not already contain an
    equivalent subpath.  For an example namespace handler, see
    ``pkg_resources.file_ns_handler``.
    N)r)rZnamespace_handlerrrrrscCst|}|dkrdS|j|}|dkr;dStjj|}|dkrtj|}tj|<g|_t|nt	|dst
d|tt|}|||||}|dk	r
|j}|j
||j|t||||S)zEEnsure that named package includes a subpath of path_item (if needed)N__path__zNot a package:)rfind_modulermrrEtypes
ModuleTyper_set_parent_nsrrrrr>load_module_rebuild_mod_path)packageNamerrrrhandlerrrrrr
_handle_ns s*	
	

rcsddtjDfddfdd}t|tsPdS|jd|d	d|D|jdd<dS)
zq
    Rebuild module.__path__ ensuring that all entries are ordered
    corresponding to their sys.path order
    cSsg|]}t|qSr)r)r.prrrr?s	z%_rebuild_mod_path.<locals>.<listcomp>cs4yj|SWntk
r/tdSYnXdS)z/
        Workaround for #520 and #513.
        infN)indexrrfloat)r)sys_pathrrsafe_sys_path_indexAs
z._rebuild_mod_path.<locals>.safe_sys_path_indexcsR|jtj}jdd}|d|}ttjj|S)zR
        Return the ordinal of the path based on its position in sys.path
        r0rN)rrrcountrro)r
path_partsZmodule_partsr?)package_namerrrposition_in_sys_pathJsz/_rebuild_mod_path.<locals>.position_in_sys_pathNr)cSsg|]}t|qSr)r)r.rrrrrXs	)rmrr rr#r)Z	orig_pathrrrr)rrrrr:s		rcCs
tjz|tkrdStjd}}d|krdj|jddd}t||tkr{t|ytj	|j
}Wn!tk
rtd|YnXtj
|gj|tj
|gx|D]}t||qWWdtjXdS)z9Declare that package 'packageName' is a namespace packageNr0rzNot a package:r:)_impacquire_lockrrmrrorrrrrrrr
r>rrelease_lock)rrrrrrrr[s&
"



c
Cs_tjzCx<tj|fD](}t||}|r t||q WWdtjXdS)zDEnsure that previously-declared namespace packages include path_itemN)rrrrErrr)rrpackagerrrrr|s
cCs]tjj||jdd}t|}x(|jD]}t||kr8Pq8W|SdS)zBCompute an ns-package subpath for a filesystem or zipfile importerr0rNr:)rrrorrr)rrrrrZ
normalizedrrrrfile_ns_handlers"rcCsdS)Nr)rrrrrrrnull_ns_handlersrcCstjjtjj|S)z1Normalize a file/dir name for comparison purposes)rrnormcaserealpath)r^rrrrscCs=y||SWn*tk
r8t|||<}|SYnXdS)N)rr)r^rresultrrrrs

rcCs|jjdS)z7
    Determine if given path appears to be an egg.
    z.egg)r;r)rrrrrsrcCs.t|o-tjjtjj|ddS)z@
    Determine if given path appears to be an unpacked egg.
    zEGG-INFOzPKG-INFO)rrrrro)rrrrrsrcCsR|jd}|j}|rNdj|}ttj||tj|dS)Nr0)rr=rosetattrrmr)rr?rrrrrrs
rccst|tjrSxk|jD]-}|j}|r|jdr|VqWn-x*|D]"}xt|D]}|VqmWqZWdS)z9Yield non-empty/non-comment lines of a string or sequence#N)r rr
splitlinesrr<r)strsr5Zssrrrrs
z\w+(\.\w+)*$z
    (?P<name>[^-]+) (
        -(?P<ver>[^-]+) (
            -py(?P<pyver>[^-]+) (
                -(?P<plat>.+)
            )?
        )?
    )?
    c@seZdZdZffdddZddZddZd	d
dZdd
ZddddZ	e
jdZe
dddZe
ddZe
dddZe
dddZdS)rz3Object representing an advertised importable objectNcCskt|std|||_||_t||_tjddj|j	|_	||_
dS)NzInvalid module namezx[%s],)MODULErrrmodule_namer!attrsrrrorr)rrrrrrrrrrs		"zEntryPoint.__init__cCs`d|j|jf}|jr9|ddj|j7}|jr\|ddj|j7}|S)Nz%s = %s:r0z [%s]r)rrrror)rr5rrrrs		zEntryPoint.__str__cCsdt|S)NzEntryPoint.parse(%r))rI)rrrrrszEntryPoint.__repr__TcOsI|s|s|r)tjdtdd|r?|j|||jS)zH
        Require packages for this EntryPoint, then resolve it.
        zJParameters to load are deprecated.  Call .resolve and .require separately.rAri)rFrGDeprecationWarningrvr)rrvrfrrrrrszEntryPoint.loadcCsvt|jddgdd}ytjt|j|SWn7tk
rq}ztt|WYdd}~XnXdS)zD
        Resolve the entry point from its module and attrs.
        fromlistrlevelrN)	rr	functoolsreducerrrrrI)rrexcrrrr	s
zEntryPoint.resolvecCso|jr"|jr"td||jj|j}tj|||d|j}tttj|dS)Nz&Can't require() without a distributionr)	rrrrrrrrr)rr!r"rrXrrrrv	s
zEntryPoint.requirez]\s*(?P<name>.+?)\s*=\s*(?P<module>[\w.]+)\s*(:\s*(?P<attr>[\w.]+))?\s*(?P<extras>\[.*\])?\s*$cCs|jj|}|s-d}t|||j}|j|d}|dri|djdnf}||d|d|||S)aParse 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
        z9EntryPoint must be in 'name=module:attrs [extras]' formatrattrr0rr)patternrlrr	groupdict
_parse_extrasr)rsrcrrtr[resrrrrrr.	s#zEntryPoint.parsecCs6|s
fStjd|}|jr/t|jS)Nx)rrspecsrrr)rZextras_specrrrrrB	s		zEntryPoint._parse_extrascCst|std|i}xWt|D]I}|j||}|j|krjtd||j|||j<q.W|S)zParse an entry point groupzInvalid group namezDuplicate entry point)rrrrrr)rrqlinesrthisrr
rrrparse_groupK	szEntryPoint.parse_groupcCst|tr|j}nt|}i}xu|D]m\}}|dkrd|sXq7td|j}||krtd||j|||||<q7W|S)z!Parse a map of entry point groupsNz%Entry points must be listed in groupszDuplicate group name)r rTrXrrrrr%)rdatarmapsrqr#rrr	parse_mapX	szEntryPoint.parse_map)rrrrrrrrrrvrBrCrr*rrr%r(rrrrrs 	

		cCsQ|s
dStjj|}|djdrMtjj|dddS|S)Nrrzmd5=r:r:)r)rrurlparser<Z
urlunparse)rZparsedrrr_remove_md5_fragmentl	sr*cCs^dd}t||}tt|d}|jd\}}}t|jp]dS)z
    Given an iterable of lines from a Metadata file, return
    the value of the Version field, if present, or None otherwise.
    cSs|jjdS)Nzversion:)r;r<)rrrrrgz	sz$_version_from_file.<locals>.<lambda>rrN)rnextiter	partitionrr)r#Zis_version_lineZ
version_linesrrrrrrr_version_from_fileu	s
r.c	@seZdZdZdZddddededdZedddZ	dd	Z
ed
dZdd
Z
ddZddZddZddZddZddZeddZeddZddZed d!Zed"d#Zfd$d%Zd&d'Zdd(d)d*Zd+d,Zd-d.Zd/d0Zd1d2Zedd3d4Z d5d6Z!d7d8Z"dd9d:Z#d;d<Z$dd(d=d>Z%d?d@Z&dAdBZ'dCdDZ(edEdFZ)dS)Grz5Wrap an actual or potential sys.path entry w/metadatazPKG-INFONcCsgt|pd|_|dk	r0t||_||_||_||_||_|p]t|_	dS)NZUnknown)
rrr_versionr5rnrrr	_provider)rrrrrMr5rnrrrrr	s				zDistribution.__init__cKsdgd\}}}}tjj|\}}	|	jtkrt|	j}t|}
|
r|
jdddd\}}}}|||d|d|d|d	||jS)
NrrZverZpyverrsrrMr5rn)rrrr;_distributionImplEGG_NAMErq_reload_version)rrrrrVrrMr5rnrrlrrrr	szDistribution.from_locationcCs|S)Nr)rrrrr3	szDistribution._reload_versioncCs:|j|j|jt|j|jp*d|jp6dfS)Nr)parsed_versionrr)r*rr5rn)rrrrr8	szDistribution.hashcmpcCs
t|jS)N)hashr8)rrrrr	szDistribution.__hash__cCs|j|jkS)N)r8)rr#rrrr"	szDistribution.__lt__cCs|j|jkS)N)r8)rr#rrrr$	szDistribution.__le__cCs|j|jkS)N)r8)rr#rrrr'	szDistribution.__gt__cCs|j|jkS)N)r8)rr#rrrr&	szDistribution.__ge__cCs&t||jsdS|j|jkS)NF)r rr8)rr#rrrr%	szDistribution.__eq__cCs||kS)Nr)rr#rrrr(	szDistribution.__ne__cCs>y|jSWn,tk
r9|jj|_}|SYnXdS)N)_keyrrr;)rr)rrrr)	s

zDistribution.keycCs(t|ds!t|j|_|jS)N_parsed_version)rrPrMr7)rrrrr4	szDistribution.parsed_versioncCsytjj}t|j|}|s(dS|js5dStjdjjdd}t	j
|jt|t
dS)Na>
            '{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.
            rur)rrM
LegacyVersionr r7rFrGrr8rFrGrvarsr)rZLVZ	is_legacyrKrrr_warn_legacy_version	s	z!Distribution._warn_legacy_versioncCshy|jSWnVtk
rct|j|j}|dkr[d}t||j||SYnXdS)Nz(Missing 'Version:' header and/or %s file)r/rr.
_get_metadataPKG_INFOrr)rrMrKrrrrM	s
zDistribution.versioncCsy|jSWntk
rdgi}|_xdD]}xt|j|D]\}}|rd|kr|jdd\}}t|rg}nt|sg}t|pd}|j|gj	t
|qQWq5W|SYnXdS)Nrequires.txtdepends.txtrr)r=r>)Z_Distribution__dep_maprrr;rrrrr
rr)rdmrr+rr,rrr_dep_map
s 

"	'zDistribution._dep_mapcCs|j}g}|j|jdfxT|D]L}y|j|t|Wq/tk
rztd||fYq/Xq/W|S)z@List of Requirements needed for this distro if `extras` are usedNz%s has no such extra feature %r)r@rrErrr)rrr?Zdepsrrrrr
s	

zDistribution.requiresccs2|j|r.x|j|D]}|VqWdS)N)rr)rrrrrrr;"
szDistribution._get_metadataFcCs{|dkrtj}|j|d||tjkrwt|jx0|jdD]}|tjkrTt|qTWdS)z>Ensure distribution is importable on `path` (default=sys.path)Nr8znamespace_packages.txt)rmrrrrr;rr)rrr8Zpkgrrractivate'
s	
zDistribution.activatecCsLdt|jt|j|jp'tf}|jrH|d|j7}|S)z@Return what this distribution's standard .egg filename should bez
%s-%s-py%sr-)rrrMr5rArn)rr^rrrr2
s	zDistribution.egg_namecCs(|jrd||jfSt|SdS)Nz%s (%s))rrI)rrrrr=
s	zDistribution.__repr__cCsNyt|dd}Wntk
r0d}YnX|p:d}d|j|fS)NrMz[unknown version]z%s %s)rrrr)rrMrrrrC
s
zDistribution.__str__cCs+|jdrt|t|j|S)zADelegate all unrecognized public attributes to .metadata providerr)r<rrr0)rrrrr__getattr__K
szDistribution.__getattr__cKs(|jt|tjj|||S)N)rrrrr)rr^rrVrrrrQ
szDistribution.from_filenamecCsTt|jtjjr1d|j|jf}nd|j|jf}tj|S)z?Return a ``Requirement`` that matches this distribution exactlyz%s==%sz%s===%s)r r4rrMrcrrr)rspecrrrr$X
szDistribution.as_requirementcCsA|j||}|dkr7td||ff|jS)z=Return the `name` entry point of `group` or raise ImportErrorNzEntry point %r not found)r|rr)rrqrr
rrrrza
szDistribution.load_entry_pointcCsdy
|j}Wn4tk
rCtj|jd|}|_YnX|dk	r`|j|iS|S)z=Return the entry point map for `group`, or the full entry mapzentry_points.txtN)Z_ep_maprrr(r;rE)rrqZep_maprrrr{h
s

!zDistribution.get_entry_mapcCs|j|j|S)z<Return the EntryPoint object for `group`+`name`, or ``None``)r{rE)rrqrrrrr|t
szDistribution.get_entry_infoc
Cs|p|j}|sdSt|}tjj|}dd|D}xt|D]\}}||kr|ryPqdSqW||krW|jtkrW|r|||dkrdS|tjkr|j	|j
|||j
||PqWW|tjkr|j	|r,|j
d|n
|j|dSxHy|j||d}	Wnt
k
roPYq@X||	=||	=|	}q@WdS)aEnsure 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.
        NcSs(g|]}|rt|p!|qSr)r)r.rrrrr
s	z*Distribution.insert_on.<locals>.<listcomp>rr)rrrrri	enumeraterrrmcheck_version_conflictrr>rrr)
rrlocr8ZnlocZbdirZnpathrrZnprrrrx
sB




zDistribution.insert_oncCs|jdkrdStj|jd}t|j}x|jdD]}|tjksJ||ksJ|tkrzqJ|dkrqJt	tj|dd}|rt|j
|sJ|j
|jrqJtd|||jfqJWdS)	N
setuptoolsznamespace_packages.txtz
top_level.txt
pkg_resourcessiterhzIModule %s was already imported from %s, but %s is being added to sys.path)rHrGrI)r)rTrUr;rrrmrrrr<
issue_warning)rZnsprFmodnamefnrrrrE
s"z#Distribution.check_version_conflictcCs<y|jWn*tk
r7tdt|dSYnXdS)NzUnbuilt egg for FT)rMrrrJr)rrrrr:
s
	zDistribution.has_versioncKsYd}x0|jD]"}|j|t||dqW|jd|j|j|S)z@Copy this distribution, substituting in any changed keyword argsz<project_name version py_version platform location precedenceNr)rr
rr0r)rrVrQrrrrclone
s
 zDistribution.clonecCsdd|jDS)NcSsg|]}|r|qSrr)r.Zdeprrrr
s	z'Distribution.extras.<locals>.<listcomp>)r@)rrrrr
szDistribution.extras)*rrrrr<rArrr*rr3rr8rr"r$r'r&r%r(r)r4r:rMr@rr;rArrrrBrr$rzr{r|rrEr:rMrrrrrr	sN		
	Cc@seZdZddZdS)EggInfoDistributioncCs+t|j|j}|r'||_|S)a
        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.
        )r.r;r<r/)rZ
md_versionrrrr3
s	z#EggInfoDistribution._reload_versionN)rrrr3rrrrrN
srNc@s[eZdZdZdZejdZeddZ	eddZ
dd	Zd
S)DistInfoDistributionzGWrap an actual or potential sys.path entry w/metadata, .dist-info styleZMETADATAz([\(,])\s*(\d.*?)\s*([,\)])cCsXy|jSWnFtk
rS|j|j}tjjj||_|jSYnXdS)zParse and cache metadataN)Z	_pkg_inforrr<emailparserZParserZparsestr)rrrrr_parsed_pkg_info
s
z%DistInfoDistribution._parsed_pkg_infocCs:y|jSWn(tk
r5|j|_|jSYnXdS)N)_DistInfoDistribution__dep_mapr_compute_dependencies)rrrrr@s

zDistInfoDistribution._dep_mapcsdgi}|_gx3|jjdp1gD]}jt|q2Wfdd}t|d}|dj|xR|jjdpgD]8}t|j}tt|||||<qW|S)z+Recompute this distribution's dependencies.Nz
Requires-Distc3s<x5D]-}|js/|jjd|ir|VqWdS)Nr+)r,r-)r+r)rrrreqs_for_extras
"zBDistInfoDistribution._compute_dependencies.<locals>.reqs_for_extrazProvides-Extra)	rSrRZget_allrr	frozensetrrr)rr?rrUcommonr+Zs_extrar)rrrTs$z*DistInfoDistribution._compute_dependenciesN)rrrrr<rBrCZEQEQrrRr@rTrrrrrO
s
rOz.eggz	.egg-infoz
.dist-infoc
Osod}t}y-x&tj|j|kr:|d7}qWWntk
rPYnXtj|d|d|dS)NrrA)rQrmrrrrrFrG)rfrVrrZrrrrJ/s	
rJc@seZdZddZdS)RequirementParseErrorcCsdj|jS)Nr)rorf)rrrrr=szRequirementParseError.__str__N)rrrrrrrrrX<srXccstt|}xs|D]k}d|krD|d|jd}|jdry|ddj}|t|7}t|VqWdS)zYield ``Requirement`` objects for each specification in `strs`

    `strs` must be a string, or a (possibly-nested) iterable thereof.
    z #N\ri)r,rrrrr+r)rr#rrrrrAs
cspeZdZfddZddZddZddZd	d
ZddZe	d
dZ
S)rcsytt|j|Wn=tjjk
rY}ztt|WYdd}~XnX|j|_	t
|j}||j|_|_
dd|jD|_ttt|j|_|j
|jt|j|jrt|jndf|_t|j|_dS)z>DO NOT CALL THIS UNDOCUMENTED METHOD; use Requirement.parse()!NcSs"g|]}|j|jfqSr)r;rM)r.rCrrrr_s	z(Requirement.__init__.<locals>.<listcomp>)rrrrr ZInvalidRequirementrXrIrZunsafe_namerr;rr)	specifierr"r!rrrrVr,hashCmpr5_Requirement__hash)rZrequirement_stringrgr)rrrrUs%$zRequirement.__init__cCst|to|j|jkS)N)r rr\)rr#rrrr%iszRequirement.__eq__cCs||kS)Nr)rr#rrrr(oszRequirement.__ne__cCsDt|tr.|j|jkr%dS|j}|jj|ddS)NFZprereleasesT)r rr)rMr[contains)rrrrrrrs
	zRequirement.__contains__cCs|jS)N)r])rrrrr~szRequirement.__hash__cCsdt|S)NzRequirement.parse(%r))rI)rrrrrszRequirement.__repr__cCst|\}|S)N)r)r5rrrrrszRequirement.parse)rrrrr%r(rrrrarrr)rrrTscCst|kr|tfS|S)zJ
    Ensure object appears in the mro even
    for old-style classes.
    )object)classesrrr_always_objectsracCsPttjt|dt|}x"|D]}||kr.||Sq.WdS)z2Return an adapter factory for `ob` from `registry`rN)rainspectZgetmrorr)registryrbrtrrrrs'
rcCs)tjj|}tj|dddS)z1Ensure that the parent directory of `path` existsexist_okTN)rrrirmakedirs)rrirrrrscCsXtstdt|\}}|rT|rTt|rTt|t|ddS)z/Sandbox-bypassing version of ensure_directory()z*"os.mkdir" not supported on this platform.iN)rrrr
rNr	)rrir^rrrrNs
rNccsd}g}xt|D]y}|jdr|jdrs|sI|rT||fV|ddj}g}qtd|q|j|qW||fVdS)asSplit 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``.
    N[]rzInvalid section headingr:)rr<rrrrr>)r5ZsectionZcontentrrrrrs	cOs7tj}ztt_tj||SWd|t_XdS)N)rros_opentempfilemkstemp)rfrVZold_openrrrrs
		rignorecategoryr>cOs||||S)Nr)rrfrrrr_call_asides
rncs=t|d<|jfddtDdS)z=Set up global resource manager (deliberately not state-saved)Z_managerc3s3|])}|jds|t|fVqdS)rN)r<r)r.r)rrrr/sz_initialize.<locals>.<genexpr>N)rrRr)rZr)rr_initializes
	
rocCstj}tdd||j}|j}|j}|j}|}tdd|D|ddddg|_t	t
|jtj
tjtd	S)
aE
    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.
    r_rcss!|]}|jddVqdS)r8FN)rA)r.rrrrr/sz1_initialize_master_working_set.<locals>.<genexpr>cSs|jddS)Nr8T)rA)rrrrrgsz0_initialize_master_working_set.<locals>.<lambda>r(FN)rrrWrvr}r)rwr!rrrrrmrrQrRr)rrvr}rrwrrrr_initialize_master_working_sets
						rp)rZ
__future__rrmrrlrrBrrrrFrUrZpkgutilr;rnrrZemail.parserrPrjrFrrbrrrZimpZpkg_resources.externrZpkg_resources.extern.six.movesrrrrr	r
rrrriZos.pathr
rZimportlib.machinery	machineryrrrrrrrversion_infoRuntimeErrorrvrrHrr_rrMrcrKr8rLrPrSrWr\r]r`rcrdreZ
_sget_noneZ
_sset_noneru__all__	ExceptionrrrrrrrArrrrrrrxrprrjrCrkrrrrwrryrzr{r|rrrrTrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrZImpImporterrrrrrrrrrrrrrrrrlrrD
IGNORECASEr2rr*r.rrNrOr1rJrrrXrr rrarrrNrrfilterwarningsrnrQrorprrrr<module>s







+b										 


.
	a

	'

.!!

	
		f0
5


Back to Directory File Manager