bg UdZddlmZddlZejdkr edddlZddlZddlZ ddl Z ddl Z ddl Z ddl Z ddlZ ddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddl Z ddl!m"Z"m#Z#m$Z$m%Z%ddlm&Z&ddl'm(Z(m)Z)m*Z*m+Z+m,Z,m-Z-m.Z.m/Z/m0Z0m1Z1m2Z2ej34ej35ej36ej36e7d d xZ8ej3ve8gzej9:d ddd lm;Zm?Z?m@Z@ ddlmAZAmBZBmCZCdZDn #eE$rdZDYnwxYwddlFZGddlHZGddlIZGddlJZGddlKZGddlLmMZMmNZNmOZOddlPmQZRe(rddlSmTZTmUZUmVZVddlWmXZXddlYmZZZm[Z[ej\de]de0dZ^e0ddZ_e1e`e"e1e`e"dffZadebd<e+dgdfZcdebd <e+dge1d!fZddebd"<e1e`dfZedebd#<e1deefZfdebd$<e1d%Zgdebd&<e)Zhdebd'<e)Zidebd(<e1ejejkfZldebd)<e+e)gd*fZmdebd+<e+e^e`enge"dfZodebd,<e+e^e`e`ejkge1e`dffZpdebd-<e0d.eoe)emepe)ZqGd/d0e/Zrejsd1ejtZuGd2d3evZweGjxjyZziZ{d4ebd5<dd;Z|dd=Z}dd?Z~d@ZddBZdCZddDZdExZZdFZgdGZGdHdIeZGdJdKeZGdLdMeZGdNdOeZGdPdQeZiZdRebdS<ejjdTejjZdUZdZdVZdZdWZdd[Ze2dd]Ze2dd^ZddaZe jdbZdcZddZejsdeZejsdfZeZddkZe2ddmZe2d dnZd!dpZd"dsZe2 d#d$duZe2d%dwZd#d&dxZd'dzZGd{d|e/ZGd}d*ee/ZGd~dZGddedee`dffZGddZeZGddeZGddZd(dZd)dZd*dZd(dZdZd+dZd)dZd,dZd#d-dZGddZeejedZGddeZGddeZeGddeZeZGddee`dfZGddeZGddeZee jeGddeZGddeZGddeZe|ddiZdebd<d.dZƐd/d0dZ d/d1dZee jeȦ d/d2dZeejeɦd/d3dZdZGdd¦Z̐d4dńZ͐d5dƄZdDŽZdȄZeedɦreejeʦee jjeʦe|ddiZdebd<e|ddiZdebd<d6dЄZdфZؐd7dԄZِd8dքZڐd#d9d؄Zېd:dۄZeedɦreejeܦee jeܦee jjeܦd;d݄Zeejeݦe2ddZސd?dZe(r e2ddZne jdZdZdZdZddZejsdjZejsdejejzjZGddZdZGddZGddeZGddeZeeedZdZd@dZGddeGjjZGddeGjjZdZdAdZdBdZddZdCd Zd Zejd ewd Gd deZejdkrdndZefdDdZdZeefddZeddZe(reZejZejZejZej Z ej Z ej Z ej Z ej Z eZejZejZejZejZeZdSdS(Ea 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. This module is deprecated. Users are directed to :mod:`importlib.resources`, :mod:`importlib.metadata` and :pypi:`packaging` instead. ) annotationsN) zPython 3.9 or later is required)IterableIteratorMappingMutableSequence) get_importer) TYPE_CHECKINGAnyBinaryIOCallableLiteral NamedTupleNoReturnProtocolTypeVarUnionoverload setuptools_vendor backports)openutime)isdirsplit)mkdirrenameunlinkTF) drop_commentjoin_continuation yield_lines)user_cache_dir) BytesPathStrOrBytesPathStrPath)LoaderProtocol)Self TypeAliaszbpkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html stacklevel_T_DistributionT Distribution)bound _NestedStrr) Requirement_StrictInstallerType)r/N_InstallerType _PkgReqType _EPDistType)IResourceProviderN _MetadataType_ResolvedEntryPoint_ResourceStream _ModuleLiker7_ProviderFactoryType_DistFinderType_NSHandlerType _AdapterTceZdZUded<dS)_ZipLoaderModulezipimport.zipimporter __loader__N__name__ __module__ __qualname____annotations__M/opt/cloudlinux/venv/lib64/python3.11/site-packages/pkg_resources/__init__.pyrArAs%%%%%%rJrAz,^v?(?P(?:[0-9]+!)?[0-9]+(?:\.[0-9]+)*)ceZdZdZdS) PEP440Warningza Used when there is an issue with a version or specifier not complying with PEP 440. NrErFrG__doc__rIrJrKrMrMsrJrMzdict[str, str] _state_varsvartypestrvarname initial_valuereturnc|t|<|SN)rP)rQrSrTs rK_declare_staterXs"K rJdict[str, Any]ci}t}tD]"\}}|d|z||||<#|S)N_sget_)globalsrPitemsstategkvs rK __getstate__rcsU E A!!##))1"1X\?1Q4((a LrJr_ct}|D],\}}|dt|z||||-|S)N_sset_)r\r]rPr^s rK __setstate__rfsT A 111$([^ #$Q!a0000 LrJc*|SrW)copyvals rK _sget_dictrks 88::rJNonecX|||dSrW)clearupdatekeyobr_s rK _sset_dictrss'HHJJJIIerJc*|SrW)rcris rK _sget_objectrus     rJc0||dSrW)rfrps rK _sset_objectrwsOOErJcdSrWrIargss rKr{srJc t}t|}|ctjdkrSddt ddd|d}n#t$rYnwxYw|S)aQReturn this platform's maximum compatible version. distutils.util.get_platform() normally reports the minimum version of macOS that would be required to *use* extensions produced by distutils. But what we want when checking compatibility is to know the version of macOS that we are *running*. To allow usage of packages that explicitly require a newer version of macOS, 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. Ndarwinmacosx-.r*-r) get_build_platformmacosVersionStringmatchsysplatformjoin _macos_versgroup ValueError)platms rKget_supported_platformrs   D  &&A}11 %(XXkmmBQB.?%@%@%@%@!''!***MDD    D  KsAA>> B  B )Grequire run_script get_providerget_distributionload_entry_point get_entry_mapget_entry_infoiter_entry_pointsresource_stringresource_streamresource_filenameresource_listdirresource_existsresource_isdirdeclare_namespace working_setadd_activation_listenerfind_distributionsset_extraction_pathcleanup_resourcesget_default_cache Environment WorkingSetResourceManagerr/r2 EntryPointResolutionErrorVersionConflictDistributionNotFound UnknownExtraExtractionErrorrMparse_requirements parse_version safe_name safe_version get_platformcompatible_platformsr"split_sections safe_extra to_filenameinvalid_markerevaluate_markerensure_directorynormalize_pathEGG_DIST BINARY_DIST SOURCE_DIST CHECKOUT_DIST DEVELOP_DISTIMetadataProviderr7 FileMetadata PathMetadata EggMetadata EmptyProviderempty_provider NullProvider EggProviderDefaultProvider ZipProviderregister_finderregister_namespace_handlerregister_loader_typefixup_namespace_packagesr PkgResourcesDeprecationWarningrun_mainAvailableDistributionsceZdZdZddZdS)rz.Abstract base for dependency resolution errorsrUrRcD|jjt|jzSrW) __class__rEreprrzselfs rK__repr__zResolutionError.__repr__+s~&di88rJNrUrR)rErFrGrOrrIrJrKrr(s.88999999rJrcTeZdZdZdZeddZeddZdZdd Z d S)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 requiredrUr/c|jdSNrryrs rKdistzVersionConflict.dist9y|rJr2c|jdSNryrs rKreqzVersionConflict.req=rrJc>|jjditSNrI _templateformatlocalsrs rKreportzVersionConflict.reportA!$t~$00vxx000rJ required_byset[Distribution | str] Self | ContextualVersionConflictc2|s|S|j|fz}t|S)zt If required_by is non-empty, return a version of self that is a ContextualVersionConflict. )rzContextualVersionConflict)rrrzs rK with_contextzVersionConflict.with_contextDs* KyK>)($//rJNrUr/rUr2)rrrUr) rErFrGrOrpropertyrrrrrIrJrKrr/sFI XX111 0 0 0 0 0 0rJrc>eZdZdZejdzZeddZdS)rz A VersionConflict that accepts a third parameter, the set of the requirements that required the installed Distribution. z by {self.required_by}rUset[str]c|jdS)Nr*ryrs rKrz%ContextualVersionConflict.required_byYrrJN)rUr)rErFrGrOrrrrrIrJrKrrQsL  ),DDI XrJrcjeZdZdZdZed dZeddZedZd 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}rUr2c|jdSrryrs rKrzDistributionNotFound.reqfrrJset[str] | Nonec|jdSrryrs rK requirerszDistributionNotFound.requirersjrrJcH|jsdSd|jS)Nzthe applicationz, )rrrs rK requirers_strz"DistributionNotFound.requirers_strns&~ %$$yy(((rJc>|jjditSrrrs rKrzDistributionNotFound.reporttrrJrRc*|SrW)rrs rK__str__zDistributionNotFound.__str__ws{{}}rJNr)rUrr) rErFrGrOrrrrrrrrIrJrKrr^s00 2 XX))X) 111rJrceZdZdZdS)rz>Distribution doesn't have an "extra feature" of the given nameNrNrIrJrKrr{sHHHHrJrz-dict[type[_ModuleLike], _ProviderFactoryType]_provider_factoriesrrr loader_typetype[_ModuleLike]provider_factoryc|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)r)rrs rKrrs(8 $$$rJ moduleOrReqcdSrWrIrs rKrr9<rJcdSrWrIrs rKrrs>%  :eT"" 2b ( b 1 1  2 2 2 2 2 2 2 2 2 2 2 2 2 2 2=00'(89 ==  sA22A69A6c4ddd||S)Nppc)PowerPCPower_Macintosh)get)machines rK _macos_archr)s  7 7 ; ;GW M MMrJc~ddlm}|}tjdkr|ds t }t jddd}dt|dt|d t|fzS#t$rYnwxYw|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 macOS. r)rr}r~ _zmacosx-%d.%d-%sr) sysconfigrrr startswithrrunamereplaceintr)r)rrrr(s rKrrs '&&&&& <>>D |x (B(B !mmGhjjm++C55G$GAJGAJG$$(      D  KsA5B-- B:9B:zmacosx-(\d+)\.(\d+)-(.*)zdarwin-(\d+)\.(\d+)\.(\d+)-(.*)provided str | Nonerequiredboolc||||krdSt|}|rGt|}|st|}|rit|d}|dd|d}|dkr|dks |dkr|d krdSd S|d|dks,|d |d krd St|dt|dkrd 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. NTrrr*z10.3z10.4Fr)rrdarwinVersionStringr2r)r3r5reqMacprovMac provDarwindversion macosversions rKrrss8+x8/C/Ct % %h / /F $**844 -228<AcrJcdSrWrIrAs rKrr rrJDistribution | _PkgReqTypect|trt|}t|trt |}t|t st d||S)z@Return a current distribution object for a Requirement or stringz*Expected str, Requirement, or Distribution)r rRr2parserr/ TypeErrorrAs rKrr so$'  &&$ $$"D!! dL ) )LDdKKK KrJrnamecHt|||S)zDReturn `name` entry point of `group` for `dist` or raise ImportError)rrrrrGs rKrrs D ! ! 2 25$ ? ??rJ dict[str, dict[str, EntryPoint]]cdSrWrIrrs rKrrs (+srJdict[str, EntryPoint]cdSrWrIrLs rKrr sKN3rJcFt||S)=Return the entry point map for `group`, or the full entry map)rrrLs rKrr"s D ! ! / / 6 66rJEntryPoint | NonecHt|||SzeZdZddZddZddZdd Zdd ZddZdS)rrGrRrUr6cdS)z;Does the package's distribution contain the named metadata?NrIrrGs rK has_metadatazIMetadataProvider.has_metadata- rJcdS)z'The named metadata resource as a stringNrIrVs rK get_metadatazIMetadataProvider.get_metadata1rXrJ Iterator[str]cdS)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.NrIrVs rKget_metadata_linesz$IMetadataProvider.get_metadata_lines5s rJcdS)z>Is the named metadata a directory? (like ``os.path.isdir()``)NrIrVs rKmetadata_isdirz IMetadataProvider.metadata_isdir<rXrJ list[str]cdS)z?List of metadata names in the directory (like ``os.listdir()``)NrIrVs rKmetadata_listdirz"IMetadataProvider.metadata_listdir@rXrJ script_name namespacerYrlcdS)z=Execute the named script in the supplied namespace dictionaryNrI)rrcrds rKrzIMetadataProvider.run_scriptDrXrJNrGrRrUr6rGrRrUrRrGrRrUr[rGrRrUr`rcrRrdrYrUrl) rErFrGrWrZr]r_rbrrIrJrKrr,s                          rJrcBeZdZdZddZdd Zdd Zdd ZddZddZ dS)r7z3An object that provides access to package resourcesmanagerr resource_namerRrUcdS)zbReturn a true filesystem path for `resource_name` `manager` must be a ``ResourceManager``NrIrrlrms rKget_resource_filenamez'IResourceProvider.get_resource_filenameL rJr:cdS)zgReturn a readable file-like object for `resource_name` `manager` must be a ``ResourceManager``NrIros rKget_resource_streamz%IResourceProvider.get_resource_streamTrqrJbytescdS)zgReturn the contents of `resource_name` as :obj:`bytes` `manager` must be a ``ResourceManager``NrIros rKget_resource_stringz%IResourceProvider.get_resource_string\rqrJr6cdS)z,Does the package contain the named resource?NrIrrms rK has_resourcezIResourceProvider.has_resourcedrXrJcdS)z>Is the named resource a directory? (like ``os.path.isdir()``)NrIrxs rKrz IResourceProvider.resource_isdirhrXrJr`cdS)z?List of resource names in the directory (like ``os.listdir()``)NrIrxs rKrz"IResourceProvider.resource_listdirlrXrJNrlrrmrRrUrR)rlrrmrRrUr:rlrrmrRrUrtrmrRrUr6rmrRrUr`) rErFrGrOrprsrvryrrrIrJrKr7r7Is==                          rJceZdZdZdNdOdZedZed ZdPd ZdQdZ dRdZ dNdSdZ dTdZ dUdZ dVdWd#Ze dXdYd.Ze dNd dd/dYd0Ze dZd[d3Z dZd\d6Zd]d7Ze d^d_d=Ze dNdd>d_d?Ze d`dadAZ d`dbdCZdcdEZ d^dddIZdedJZdfdLZdedMZdS)grzDA collection of active distributions on sys.path (or a similar list)NentriesIterable[str] | NonerUrlcg|_i|_i|_i|_g|_| t j}|D]}||dS)z?Create working set from list of path entries (default=sys.path)N)r entry_keysby_keynormalized_to_canonical_keys callbacksrr add_entry)rrentrys rK__init__zWorkingSet.__init__ts`"$ 79/1 <>)AC ?hG " "E NN5 ! ! ! ! " "rJc|} ddlm}n#t$r|cYSwxYw ||n%#t$r||cYSwxYw|S)z1 Prepare the master working set. r) __requires__)__main__r ImportErrorrr_build_from_requirements)clswsrs rK _build_masterzWorkingSet._build_masters SUU  - - - - - - -   III   > JJ| $ $ $ $ > > >// == = = = > s ""<AAc8|g}t|}||t}|D]}||tjD] }||jvr||!|jtjdd<|S)zQ Build a working set from a requirement spec. Rewrites sys.path. N)rresolveraddrrrr)rreq_specrreqsdistsrrs rKrz#WorkingSet._build_from_requirementssSWW!(++ 4//  D FF4LLLLX $ $EBJ&& U###j  rJrrRc|j|g|j|t |dD]}|||ddS)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 setdefaultrappendrr)rrrs rKrzWorkingSet.add_entrysn ""5"--- E"""&ud33 ) )D HHT5% ( ( ( ( ) )rJrr/r6cH|j|j|kS)z9True if `dist` is the active distribution for its project)rr'rqrrs rK __contains__zWorkingSet.__contains__s{tx((D00rJrr2Distribution | Nonec|j|j}|B|j|j}|!||_|j|}|||vrt |||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. )rr'rqrr)rrr canonical_keys rKr zWorkingSet.findsy{sw'' < =AA#'JJM('{}55  C!$,, , rJrrGr4Iterator[EntryPoint]c$fd|DS)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). c3K|]=}|D]} |jk|V>dSrW)rvaluesrG).0rrrrGs rK z/WorkingSet.iter_entry_points..sq  ++E2299;;  |tuz11  21111   rJrIrrrGs ``rKrzWorkingSet.iter_entry_pointss4         rJrequiresrcctjdj}|d}|||d<||d||dS)z?Locate distribution for `requires` and run `script_name` scriptrrErN)r _getframe f_globalsrnrr)rrrcnsrGs rKrzWorkingSet.run_scripts` ]1   '*~  : Xq!,,["=====rJIterator[Distribution]c#Kt}|jD]D}||jvr |j|D]*}||vr$|||j|V+EdS)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. N)setrrrr)rseenitemrqs rK__iter__zWorkingSet.__iter__s uuL + +D4?**t, + +d??HHSMMM+c**** +  + +rJTFinsertr1c*|r||j||||j}|j|g}|j|jg}|s|j|jvrdS||j|j<tj |j}|j|j |<|j|vr| |j|j|vr| |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. r1N) insert_onrlocationrrrqr packagingutilscanonicalize_namerr _added_new)rrrrr1keyskeys2normalized_names rKrzWorkingSet.adds $  A NN4<N @ @ @ =ME))%44**4="== 48t{22 F $ DH#/;;DHEE=AX)/: 84   KK ! ! ! 85 LL " " " rJ requirementsIterable[Requirement]envEnvironment | None installer$_StrictInstallerType[_DistributionT]replace_conflictingextrastuple[str, ...] | Nonelist[_DistributionT]cdSrWrIrrrrrrs rKrzWorkingSet.resolve&s  #srJ)rrcdSrWrIrs rKrzWorkingSet.resolve/s  #srJ_InstallerType | Nonelist[Distribution]cdSrWrIrs rKrzWorkingSet.resolve9s !SrJ<_InstallerType | None | _StrictInstallerType[_DistributionT])list[Distribution] | list[_DistributionT]c @t|ddd}t}i}g}t} tjt} |r|d} | |vr| | |s3|| ||||| |} | | j ddd} | | | D],}| | | j | j | |<-| | ||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. Nrr) listr _ReqExtras collections defaultdictpop markers_pass _resolve_distrrextendr project_name)rrrrrr processedbest to_activate req_extrasrrrnew_requirementsnew_requirements rKrzWorkingSet.resolveBsOBL))$$B$/ EE (**, \\  #C ( (  ""1%%Ci**377 %%T.Y [D $}}SZ882>     0 1 1 1$4 9 9O,001ABBB.1j ?++ MM#   / 4rJc||j}||j|j}|||vr|r|} |5|t|j}ntg}t g} ||| ||x}||j<|&||d} t|| ||||vr+||} t|| | |S)N)r) r'rqrrrr best_matchrrrr) rrrrrrrrrrr dependent_reqs rKrzWorkingSet._resolve_distsxx   <;??37++D|C4G;|)$,77 *"oo'^^'*~~Y>>   t $ $ $ s??',M!$,,99-HH H rJ plugin_envrfull_envfallback:tuple[list[_DistributionT], dict[Distribution, Exception]]cdSrWrIrrrrrs rK find_pluginszWorkingSet.find_pluginss FISrJ)rcdSrWrIrs rKrzWorkingSet.find_pluginss FISrJ8tuple[list[Distribution], dict[Distribution, Exception]]cdSrWrIrs rKrzWorkingSet.find_pluginss DG3rJOtuple[list[Distribution] | list[_DistributionT], dict[Distribution, Exception]]ct|}|i}i}|t|j}||z }n||z}|g} tt | j||D]} || D]} | g} | | ||} tt | j| | t | n$#t$r}||| <|rYd}~Yd}~nd}~wwxYwt|}|||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) rsortrrrmapras_requirementrrodictfromkeysr)rrrrrplugin_projects error_info distributionsr shadow_setrrr resolveesrbsorted_distributionss rKrzWorkingSet.find_pluginssXz**46 >@  dl++C : CCZ'C^^B''  S & &'''+  L"<0  **,,- * 2 23Y G GIZ^Y77888!((y)A)ABBBE''(Jt$ " $M22!!####Z//s$D  D-D((D-r1c~|t|}|D]}|||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)rrneededrs rKrzWorkingSet.require sC0>>??  D HHTNNNN rJcallback Callable[[Distribution], object]existingcx||jvrdS|j||sdS|D] }||dS)zInvoke `callback` for all distributions If `existing=True` (default), call on all existing ones, as well. N)rr)rrrrs rK subscribezWorkingSet.subscribe0sa t~ % % F h'''  F  D HTNNNN  rJc0|jD] }||dSrW)r)rrrs rKrzWorkingSet._added_new@s,  H HTNNNN  rJ~tuple[list[str], dict[str | None, list[str]], dict[str, Distribution], dict[str, str], list[Callable[[Distribution], object]]]c|jdd|j|j|j|jddfSrW)rrrhrrrrs rKrczWorkingSet.__getstate__Ds] LO O " " K      - 2 2 4 4 N111    rJc|\}}}}}|dd|_||_||_||_|dd|_dSrW)rrhrrrr)r e_k_b_n_crrrrrs rKrfzWorkingSet.__setstate__UsgIRFv;Yqqqz ))++kkmm ,H,M,M,O,O)"111rJrW)rrrUrl)rrRrUrlrr/rUr6)rr2rUr)rrRrGr4rUr)rrRrcrRrUrl)rUr)NTF) rr/rr4rr6r1r6rUrl)FN) rrrrrrrr6rrrUr)NNFN) rrrrrrrr6rrrUr) rrrrrrrr6rrrUrrT) rrrrrrrr6rUr)NNT) rrrrrrrr6rUr) rrrrrrrr6rUr)rr1rUr)rrrr6rUrlrUrl)rUr)rErFrGrOr classmethodrrrrr rrrrrrrrrrrrcrfrIrJrKrrqs+NN " " " " "[&[* ) ) ) )11112.2     >>>>++++(! $$$$$L %*)- ####X##'# %*)-#####X##'+/$))- !!!!X!#'RV$))- JJJJJX>  IIIIXI(,I  IIIIIXI(,+/ GGGGXG(,RV X0X0X0X0X0t"LP     "&&&&&&rJrceZdZdZdd dZdS) rz> Map each requirement to the extras that demanded it. Nrr2rrc|j p3tfd|d|pdzDS)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. c3PK|] }jd|iV!dS)extraNmarkerevaluate)rrrs rKrz*_ReqExtras.markers_pass..ksL% %  J  % 0 1 1% % % % % % rJrI)r)ranyr')rrrs ` rKrz_ReqExtras.markers_passcs_:~ % % % % #r**fo>% % % " "  rJrW)rr2rr)rErFrGrOrrIrJrKrr^s7        rJr.ceZdZdZdeefd3d Zd4dZd5dZd6d7dZ d8dZ d5dZ e d9d:dZ e d;dd&Ze d6d?d(Ze d6d@d)Z d6dAd+ZdBd-ZdCd1ZdCd2ZdS)Drz5Searchable snapshot of distributions on a search pathN search_pathrrr4pythonrUrlcZi|_||_||_||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.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)_distmaprrscan)rrrrs rKrzEnvironment.__init__ts1,8:     +rJrr/r6c~|jdup|jdup|j|jk}|ot|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)r py_versionrr)rr py_compats rKcan_addzEnvironment.can_addsO K4  .$& .$+-  O1$-OOOrJcP|j|j|dS)z"Remove `dist` from the environmentN)rrqremovers rKrzEnvironment.removes% dh&&t,,,,,rJcz| tj}|D])}t|D]}||*dS)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)rrrr)rrrrs rKrzEnvironment.scansW  (K  D*400     rJrrRrc`|}|j|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. )lowerrr')rrdistribution_keys rK __getitem__zEnvironment.__getitem__s/(--//}  !12666rJc(||rx|rf|j|jg}||vrD|||tjdddSdSdSdS)zCAdd `dist` if we ``can_add()`` it and it has not already been addedhashcmpT)rqreverseN) r has_versionrrrqrroperator attrgetter)rrrs rKrzEnvironment.adds <<   M$"2"2"4"4 MM,,TXr::E5   T""" x29==t LLLLL  M M M M  rJFrr2rrrrrr.cdSrWrIrrrrrs rKrzEnvironment.best_matchs rJrrcdSrWrIr,s rKrzEnvironment.best_matchs "crJrc ||}n#t$r|sd}YnwxYw||S||jD] }||vr|cS |||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)r rrqobtain)rrrrrrs rKrzEnvironment.best_matchs& ##C((DD   & DDD   KM  Ds{{ {{3 ***s ** requirementcdSrWrIrr0rs rKr/zEnvironment.obtains rJ$Callable[[Requirement], None] | NonecdSrWrIr2s rKr/zEnvironment.obtains srJcdSrWrIr2s rKr/zEnvironment.obtains "crJ\Callable[[Requirement], None] | _InstallerType | None | _StrictInstallerType[_DistributionT]c |r ||ndS)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.NrIr2s rKr/zEnvironment.obtains *3rBrIrJrKrrqs??-15577% 6 P P P P----      7 7 7 7MMMM %* X ,0$) """"X"SW$) +++++BX ;?X ,0""""X"26 =====$    rJrc2eZdZUdZded<ded<ded<dS) 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 rrlrR cache_pathzBaseException | Noneoriginal_errorN)rErFrGrOrHrIrJrKrr6s?  OOO((((((rJrceZdZUdZdZded<d'dZd(d Zd(dZd)dZ d*dZ d+dZ d,dZ d-dZ d.d/dZed'dZd0d!Zd1d#Zd2d3d&ZdS)4rz'Manage resource extraction and packagesNr4extraction_pathrUrlci|_dSrW) cached_filesrs rKrzResourceManager.__init__Os68rJpackage_or_requirementr5rmrRr6cFt||S)zDoes the named resource exist?)rryrrMrms rKrzResourceManager.resource_existsSs!233@@OOOrJcFt||S)z,Is the named resource an existing directory?)rrrOs rKrzResourceManager.resource_isdirYs!233BB=QQQrJcHt|||S)z4Return a true filesystem path for specified resource)rrprOs rKrz!ResourceManager.resource_filename_s*233II -   rJr:cHt|||S)z9Return a readable file-like object for specified resource)rrsrOs rKrzResourceManager.resource_streamg*233GG -   rJrtcHt|||S)z)Return specified resource as :obj:`bytes`)rrvrOs rKrzResourceManager.resource_stringorSrJr`cFt||S)z1List the contents of the named resource directory)rrrOs rKrz ResourceManager.resource_listdirws!233DD]SSSrJrc$tjd}|jp t}t jd}t|jdit}||_ ||_ ||_ |)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. NrI) rexc_inforJrtextwrapdedentlstriprrrrlrGrH)rold_excrGtmplerrs rKextraction_errorz ResourceManager.extraction_error}s,..#)@->-@-@    " &((# $kdk55FHH5566 #$ rJrI archive_namenamesIterable[StrPath]c|jp t}tjj||dzg|R} t |n$#t $r|YnwxYw||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-tmpT) rJrrrr_bypass_ensure_directory Exceptionr^_warn_unsafe_extraction_pathrL)rr_r` extract_path target_paths rKget_cache_pathzResourceManager.get_cache_paths+B/@/B/B gl<1FOOOO  $ $[ 1 1 1 1 $ $ $  ! ! # # # # # $ )),777)-+&sAA#"A#cLtjdkr'|tjdsdStj|j}|tjzs|tjzr5djdit}tj |tdSdS)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. ntwindirNzExtraction path is writable by group/others and vulnerable to attack when used with get_resource_filename ({path}). Consider a more secure location (set with .set_extraction_path or the PYTHON_EGG_CACHE environment variable).rI) rrGr/environstatst_modeS_IWOTHS_IWGRPrrwarningswarn UserWarning)rmodemsgs rKrez,ResourceManager._warn_unsafe_extraction_paths 7d??4??2:h3G#H#H? Fwt}}$ $,  ,$"5 ,: !!xx!!C M#{ + + + + + , ,rJtempnamer%filenamectjdkr6tj|jdzdz}tj||dSdS)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)rrGrmrnchmod)rrvrwrts rK postprocesszResourceManager.postprocesssM 7g  WX&&.%76AD HXt $ $ $ $ $  rJrc@|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)rLrrJrrs rKrz#ResourceManager.set_extraction_paths-&   VTUU U#rJFforcecgS)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. rI)rr~s rKrz!ResourceManager.cleanup_resourcess  rJr )rMr5rmrRrUr6)rMr5rmrRrUrR)rMr5rmrRrUr:)rMr5rmrRrUrt)rMr5rmrRrUr`)rUrrI)r_rRr`rarUrR)rvr%rwr%rUrlrrRrUrlrC)r~r6rUr`)rErFrGrOrJrHrrrrrrrr^rh staticmethodrer{rrrIrJrKrrJsS11"&O&&&&9999PPPP RRRR             TTTT <2,,,\,4%%%%($$$$0       rJrc`tjdptdS)z Return the ``PYTHON_EGG_CACHE`` environment variable or a platform-relevant user cache dir for an app named "Python-Eggs". PYTHON_EGG_CACHEz Python-Eggs)appname)rrlr'_user_cache_dirrIrJrKrr s) :>>, - - W1W1W1WWrJc.tjdd|S)zConvert an arbitrary string to a standard distribution name Any runs of non-alphanumeric/. characters are replaced with a single '-'. [^A-Za-z0-9.]+r)resubrGs rKrrs 6"C . ..rJrc ttj|S#tjj$r/|dd}t jdd|cYSwxYw)zB Convert an arbitrary string to a standard version string r,rrr)rRrrVersionInvalidVersionr1rr)rs rKrrsu69$,,W55666   +666//#s++v&W555556s+.AA10A1c|dd}t|}|r |d}|t|d}nd}|}dt |d}|d|S)aFallback when ``safe_version`` is not safe enough >>> parse_version(_forgiving_version('0.23ubuntu1')) >>> parse_version(_forgiving_version('0.23-')) >>> parse_version(_forgiving_version('0.-_')) >>> parse_version(_forgiving_version('42.+?1')) >>> parse_version(_forgiving_version('hello world')) r,rsafeN0z sanitized.z.dev0+)r1_PEP440_FALLBACKsearchlen _safe_segmentstrip)rrrrestlocals rK_forgiving_versionr'sooc3''G  # #G , ,E V}s4yy{{# .t,, . . 4 4S 9 9E ! !% ! !!rJctjdd|}tjdd|}tjdd|dS)z/Convert an arbitrary string into a safe segmentrrz-[^A-Za-z0-9]+z\.[^A-Za-z0-9]+rz.-)rrr)segments rKrr@sMf%sG44Gf%sG44G 6$c7 3 3 9 9$ ? ??rJrcRtjdd|S)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-)rrr")rs rKrrGs% 6#S% 0 0 6 6 8 88rJc.|ddS)z|Convert a project or version name to its filename-escaped form Any '-' characters are currently replaced with '_'. rr-rrs rKrrPs <<S ! !!rJtextSyntaxError | Literal[False]cv t|n'#t$r}d|_d|_|cYd}~Sd}~wwxYwdS)zo Validate text as a PEP 508 environment marker; return an exception if invalid or False otherwise. NF)r SyntaxErrorrwlineno)res rKrrXs[    5s 6166c tj|}|S#tjj$r}t ||d}~wwxYw)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)rmarkersMarkerr InvalidMarkerr)rrrrs rKrrfs`$"))$//     *$$$!nn!#$s25A AAceZdZUdZdZded<dZded<dZded<d.d Zd/dZ d0dZ d1dZ d2dZ dZ d3dZd4dZd5dZd2dZd3dZd6d!Zd7d"Zd8d&Zd9d'Zd9d(Zd:d)Zd;d+ZedrzETry to implement resources and metadata for arbitrary PEP 302 loadersNr4egg_nameegg_infozLoaderProtocol | Nonerrr;rUrlct|dd|_tjt|dd|_dS)NrC__file__r)rrrrdirname module_path)rrs rKrzNullProvider.__init__|s=flD99 7??76:r+J+JKKrJrlrrmrRc8||j|SrW)_fnrros rKrpz"NullProvider.get_resource_filenamesxx(-888rJr cRtj|||SrW)ioBytesIOrvros rKrsz NullProvider.get_resource_streams$z$227MJJKKKrJrtc^|||j|SrW)_getrrros rKrvz NullProvider.get_resource_strings'yy$"2MBBCCCrJr6c^|||j|SrW)_hasrrrxs rKryzNullProvider.has_resources%yy$"2MBBCCCrJc8||j|SrW)rrrVs rK_get_metadata_pathzNullProvider._get_metadata_pathsxx t,,,rJrGch|jsdS||}||SrD)rrrrrGrs rKrWzNullProvider.has_metadatas4} 5&&t,,yyrJc|jsdS||}||} |dS#t$r*}|xjd||z c_d}~wwxYw)Nrutf-8z in {} file at path: {})rrrdecodeUnicodeDecodeErrorreasonr)rrGrvalueexcs rKrZzNullProvider.get_metadatas} 2&&t,, $ <<(( (!    JJ3::4FF FJJ   sA A>%A99A>r[cFt||SrWr"rZrVs rKr]zNullProvider.get_metadata_lines4,,T22333rJc^|||j|SrW)_isdirrrrxs rKrzNullProvider.resource_isdirs%{{488D$4mDDEEErJct|jo-|||j|SrW)r6rrrrVs rKr_zNullProvider.metadata_isdirs3DMPdkk$((4=$2O2O&P&PQQQrJr`c^|||j|SrW)_listdirrrrxs rKrzNullProvider.resource_listdirs%}}TXXd&6 FFGGGrJcp|jr.|||j|SgSrW)rrrrVs rKrbzNullProvider.metadata_listdirs4 = @==$-!>!>?? ? rJrcrdrYcd|z}||s&tdjd it||dd}|dd}||j|}||d<tj |r3t|}t||d}t|||dSdd lm}t!|d|d|f||<t||d} t| ||dS) Nzscripts/z