
    vKg             	         % S r SSKJr  SSKr\R                  S:  a  \" S5      eSSKrSSKrSSKr	SSK
r
SSKrSSKrSSKrSSKrSSKrSSKrSSKrSSKrSSKrSSKrSSKrSSKrSSKrSSKrSSKrSSKrSSKrSSKrSSKrSSKrSSKrSSK r SSK!J"r"J#r#J$r$J%r%  SSKJ&r&  SSK'J(r(J)r)J*r*J+r+J,r,J-r-J.r.J/r/J0r0J1r1J2r2  \Rf                  Ri                  \Rf                  Rk                  \Rf                  Rm                  \Rf                  Rm                  \75      5      S	S
5      =r8\Rf                  ;  \8/-  5        \Rr                  Ru                  SS5        SSKJ;r<J=r=  SSK>J?r?J@r@   SSKJArAJBrBJCrC  SrDSSKFrGSSKHrGSSKIrGSSKJrGSSKKrGSSKLJMrMJNrNJOrO  SSKPJQrR  \((       a  SSKSJTrTJUrUJVrV  SSKWJXrX  SSKYJZrZJ[r[  \R                  " S\]SS9  \0" S5      r^\0" SSS9r_\1\`\"\1\`\"S   4      4   raS\bS'   \+S/S4   rcS\bS '   \+S/\1S!   4   rdS\bS"'   \1\`S4   reS\bS#'   \1S\e4   rfS\bS$'   \1S%   rgS\bS&'   \)rhS\bS''   \)riS\bS('   \1\j\R                  4   rlS\bS)'   \+\)/S*4   rmS\bS+'   \+\^\`\n/\"S   4   roS\bS,'   \+\^\`\`\R                  /\1\`S4   4   rpS\bS-'   \0" S.\o\)   \m\p\)   5      rq " S/ S0\/5      rr\R                  " S1\R                  5      ru " S2 S3\v5      rw\GR                  R                  rz0 r{S4\bS5'   SS6 jr|SS7 jr}SS8 jr~S9 rSS: jrS; rSS< jrS= =rrS> r/ S?Qr " S@ SA\5      r " SB SC\5      r " SD SE\5      r " SF SG\5      r " SH SI\5      r0 rSJ\bSK'   \R                  GR                   SL\R                  GR                   3rSMrSrSNrSrSOr      SSP jr\2SSQ j5       r\2SSR j5       rSSS jr\GR0                  ST 5       rSU rSV r\R                  " SW5      r\R                  " SX5      r\rSSY jr\2SSZ j5       r\2SS[ j5       rSS\ jrSS] jr\2 S     SS^ jj5       r\2SS_ j5       rSSS` jjrSSa jr " Sb Sc\/5      r " Sd S*\\/5      r " Se Sf5      r " Sg Sh\S\\`Si4   4   5      r " Sj Sk5      r\r " Sl Sm\5      r " Sn So5      rSSp jrSSq jrSSr jrSSs jrSt rSSu jrSSv jrSSw jrSSSx jjr " Sy Sz5      r\" \j\5        S{ r " S| S}\5      r " S~ S\5      r\GRw                  5          " S S\5      r\" 5       r " S S\\`S4   5      r " S S\5      r " S S\5      r\" \ GR                  \5         " S S\5      r " S S\5      r " S S\5      r\|" SS0 5      rS\bS'         SS jrSSS jjr S       SS jjr\" \ GR                  \5         S     SS jjr\" \j\5        SSS jjrS r " S S5      rSS jrSS jrS rS r\" \S5      (       a  \" \GR                  \5        \" \GR                  GR                  \5        \|" SS0 5      rS\bS'   \|" SS0 5      rS\bS'         SS jrS rSS jrSS jrSSS jjr        SS jr\" \S5      (       a  \" \GR                  \5        \" \ GR                  \5        \" \GR                  GR                  \5                  SS jr\" \j\5        \2SS j5       r\2SS j5       rSS jrSS jr\((       a  \2SS j5       r\2SS j5       rSS jrO\GR0                  S 5       rS rS rS rSS jr\R                  " S5      GR                  r\R                  " S\GR                  \GR                  -  5      GR                  r " S S5      rS r " S S5      r " S S\5      r " S S\5      r\\\S.rS rGS S jr " S S\GGR                  GR                  5      r " S S\GGR                  GR                  5      rS rGSS jrGSS jrSS jrGSS jrS r\GR                  " S\wSS9   " S S\5      r\R                  S:  a  SOSr\4GSS jjGr S GrG\G\" 5       4SS jj5       GrG\SS j5       Gr\((       a  \" 5       GrG\GR                  GrG\GR                  GrG\GR                  GrG\GR                  Gr	G\GR                  Gr
G\GR                  GrG\GR                  GrG\GR                  Gr\" 5       GrG\GR                  GrG\GR                   GrG\GR"                  GrG\GR&                  GrG\Grgg! \E a    SrD GNf = f(  a  
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)   	   zPython 3.9 or later is required)IterableIteratorMappingMutableSequence)get_importer)TYPE_CHECKINGAnyBinaryIOCallableLiteral
NamedTupleNoReturnProtocolTypeVarUnionoverload
setuptools_vendor	backports)openutime)isdirsplit)mkdirrenameunlinkTF)drop_commentjoin_continuationyield_lines)user_cache_dir)	BytesPathStrOrBytesPathStrPath)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	_AdapterTc                       \ rS rSr% S\S'   Srg)_ZipLoaderModule   zipimport.zipimporter
__loader__ N__name__
__module____qualname____firstlineno____annotations____static_attributes__rE       V/var/www/highfloat_scraper/venv/lib/python3.13/site-packages/pkg_resources/__init__.pyrA   rA      s    %%rM   rA   z,^v?(?P<safe>(?:[0-9]+!)?[0-9]+(?:\.[0-9]+)*)c                      \ rS rSrSrSrg)PEP440Warning   zU
Used when there is an issue with a version or specifier not complying with
PEP 440.
rE   NrG   rH   rI   rJ   __doc__rL   rE   rM   rN   rP   rP      s    rM   rP   zdict[str, str]_state_varsc                    U [         U'   U$ N)rT   )vartypevarnameinitial_values      rN   _declare_staterZ      s    "KrM   c                 |    0 n [        5       n[        R                  5        H  u  p#USU-      " X   5      X'   M     U $ )N_sget_)globalsrT   itemsstategkvs       rN   __getstate__rd      s>    E	A!!#X\?14( $LrM   c                ~    [        5       nU R                  5        H  u  p#US[        U   -      " X!U   U5        M      U $ )N_sset_)r]   r^   rT   r_   s       rN   __setstate__rg      s<    	A	([^
#$Q!a0 LrM   c                "    U R                  5       $ rV   )copyvals    rN   
_sget_dictrl      s    88:rM   c                F    UR                  5         UR                  U5        g rV   )clearupdatekeyobr`   s      rN   
_sset_dictrs      s    HHJIIerM   c                "    U R                  5       $ rV   )rd   rj   s    rN   _sget_objectru      s    rM   c                &    UR                  U5        g rV   )rg   rp   s      rN   _sset_objectrw      s    OOErM   c                     g rV   rE   argss    rN   <lambda>r{      s    rM   c                     [        5       n [        R                  U 5      nUbI  [        R                  S:X  a5  SSR                  [        5       SS 5      < SUR                  S5      < 3n U $ U $ ! [         a     U $ f = f)a-  Return 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.
Ndarwinmacosx-.r*   -r   )	get_build_platformmacosVersionStringmatchsysplatformjoin_macos_versgroup
ValueError)platms     rN   get_supported_platformr      sy     D  &A}1	%(XXkmBQ.?%@!''!*MD K4K  	K	s   3A. .
A<;A<)Grequire
run_scriptget_providerget_distributionload_entry_pointget_entry_mapget_entry_infoiter_entry_pointsresource_stringresource_streamresource_filenameresource_listdirresource_existsresource_isdirdeclare_namespaceworking_setadd_activation_listenerfind_distributionsset_extraction_pathcleanup_resourcesget_default_cacheEnvironment
WorkingSetResourceManagerr/   r2   
EntryPointResolutionErrorVersionConflictDistributionNotFoundUnknownExtraExtractionErrorrP   parse_requirementsparse_version	safe_namesafe_versionget_platformcompatible_platformsr"   split_sections
safe_extrato_filenameinvalid_markerevaluate_markerensure_directorynormalize_pathEGG_DISTBINARY_DISTSOURCE_DISTCHECKOUT_DISTDEVELOP_DISTIMetadataProviderr7   FileMetadataPathMetadataEggMetadataEmptyProviderempty_providerNullProviderEggProviderDefaultProviderZipProviderregister_finderregister_namespace_handlerregister_loader_typefixup_namespace_packagesr
   PkgResourcesDeprecationWarningrun_mainAvailableDistributionsc                  "    \ rS rSrSrSS jrSrg)r   i(  z.Abstract base for dependency resolution errorsc                Z    U R                   R                  [        U R                  5      -   $ rV   )	__class__rG   reprrz   selfs    rN   __repr__ResolutionError.__repr__+  s    ~~&&dii88rM   rE   Nreturnstr)rG   rH   rI   rJ   rS   r   rL   rE   rM   rN   r   r   (  s
    89rM   r   c                  \    \ rS rSrSrSr\S
S j5       r\SS j5       rS r	    SS jr
Srg	)r   i/  z
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 requiredc                     U R                   S   $ Nr   ry   r   s    rN   distVersionConflict.dist9      yy|rM   c                     U R                   S   $ N   ry   r   s    rN   reqVersionConflict.req=  r   rM   c                J    U R                   R                  " S0 [        5       D6$ NrE   	_templateformatlocalsr   s    rN   reportVersionConflict.reportA      ~~$$0vx00rM   c                D    U(       d  U $ U R                   U4-   n[        U6 $ )z\
If required_by is non-empty, return a version of self that is a
ContextualVersionConflict.
)rz   ContextualVersionConflict)r   required_byrz   s      rN   with_contextVersionConflict.with_contextD  s'     KyyK>)($//rM   rE   Nr   r/   r   r2   )r   zset[Distribution | str]r   z Self | ContextualVersionConflict)rG   rH   rI   rJ   rS   r   propertyr   r   r   r   rL   rE   rM   rN   r   r   /  sO     FI   1
02
0	)
0rM   r   c                  J    \ rS rSrSr\R                  S-   r\SS j5       rSr	g)r   iQ  zy
A VersionConflict that accepts a third parameter, the set of the
requirements that required the installed Distribution.
z by {self.required_by}c                     U R                   S   $ )Nr*   ry   r   s    rN   r   %ContextualVersionConflict.required_byY  r   rM   rE   N)r   zset[str])
rG   rH   rI   rJ   rS   r   r   r   r   rL   rE   rM   rN   r   r   Q  s,    
  )),DDI rM   r   c                  d    \ rS rSrSrSr\SS j5       r\SS j5       r\S 5       r	S r
SS jrS	rg
)r   i^  z&A requested distribution was not foundzSThe '{self.req}' distribution was not found and is required by {self.requirers_str}c                     U R                   S   $ r   ry   r   s    rN   r   DistributionNotFound.reqf  r   rM   c                     U R                   S   $ r   ry   r   s    rN   	requirersDistributionNotFound.requirersj  r   rM   c                \    U R                   (       d  gSR                  U R                   5      $ )Nzthe applicationz, )r   r   r   s    rN   requirers_str"DistributionNotFound.requirers_strn  s    ~~$yy((rM   c                J    U R                   R                  " S0 [        5       D6$ r   r   r   s    rN   r   DistributionNotFound.reportt  r   rM   c                "    U R                  5       $ rV   )r   r   s    rN   __str__DistributionNotFound.__str__w  s    {{}rM   rE   Nr   )r   zset[str] | Noner   )rG   rH   rI   rJ   rS   r   r   r   r   r   r   r  rL   rE   rM   rN   r   r   ^  sU    0	2 
     ) )
1rM   r   c                      \ rS rSrSrSrg)r   i{  z>Distribution doesn't have an "extra feature" of the given namerE   NrR   rE   rM   rN   r   r   {  s    HrM   r   z-dict[type[_ModuleLike], _ProviderFactoryType]_provider_factoriesr   r   r   c                    U[         U '   g)zRegister `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  )loader_typeprovider_factorys     rN   r   r     s     (8$rM   c                    g rV   rE   moduleOrReqs    rN   r   r         9<rM   c                    g rV   rE   r  s    rN   r   r     s    <?rM   c                \   [        U [        5      (       a3  [        R                  U 5      =(       d    [	        [        U 5      5      S   $  [        R                  U    n[        USS5      n[        [        U5      " U5      $ ! [         a!    [        U 5        [        R                  U    n NMf = f)z?Return an IResourceProvider for the named module or requirementr   rD   N)
isinstancer2   r   findr   r   r   modulesKeyError
__import__getattr_find_adapterr  )r  moduleloaders      rN   r   r     s    +{++,LK8H0I!0LL*[) V\40F,f5f==	  *;[)*s   
B   (B+*B+c                 :   [         R                  " 5       S   n U S:X  a\  Sn[        R                  R	                  U5      (       a6  [        US5       n[        R                  " U5      nS S S 5        SW;   a  US   n U R                  S5      $ ! , (       d  f       N*= f)Nr    z0/System/Library/CoreServices/SystemVersion.plistrbProductVersionr   )	r   mac_verospathexistsr   plistlibloadr   )versionplistfhplist_contents       rN   r   r     s~     #G"}B77>>%  eT"b (b 1 #=0'(89==	 #"s   B
Bc                *    SSS.R                  X 5      $ )Nppc)PowerPCPower_Macintosh)get)machines    rN   _macos_archr/    s    7;;GMMrM   c                 N   SSK Jn   U " 5       n[        R                  S:X  ar  UR	                  S5      (       d\   [        5       n[        R                  " 5       S   R                  SS5      nS[        US   5      [        US	   5      [        U5      4-  $ U$ ! [         a     U$ f = f)
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   )r   r}   r~       _zmacosx-%d.%d-%sr   )	sysconfigr   r   r   
startswithr   r   unamereplaceintr/  r   )r   r   r%  r.  s       rN   r   r     s     '>D
||x	(B(B	!mGhhjm++C5G$GAJGAJG$(   K	  	 K		s   AB 
B$#B$zmacosx-(\d+)\.(\d+)-(.*)zdarwin-(\d+)\.(\d+)\.(\d+)-(.*)c                ~   U b  Ub  X:X  a  g[         R                  U5      nU(       Ga  [         R                  U 5      nU(       dw  [        R                  U 5      nU(       aZ  [        UR	                  S5      5      nUR	                  S5      < SUR	                  S5      < 3nUS:X  a  US:  d  US:X  a  US:  a  gg	UR	                  S5      UR	                  S5      :w  d$  UR	                  S
5      UR	                  S
5      :w  a  g	[        UR	                  S5      5      [        UR	                  S5      5      :  a  g	gg	)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.
Tr   r   r*      z10.3   z10.4Fr   )r   r   darwinVersionStringr8  r   )providedrequiredreqMacprovMac
provDarwindversionmacosversions          rN   r   r     s    8+x/C  %%h/F$**84  -228<Jz//23*0,,q/6<<?KM$.1}$. ==v||A.'--2BfllSTo2U w}}Q 3v||A#77 rM   c                    g rV   rE   r   s    rN   r   r     s    >ArM   c                    g rV   rE   rE  s    rN   r   r   
  r  rM   c                    [        U [        5      (       a  [        R                  U 5      n [        U [        5      (       a  [	        U 5      n [        U [
        5      (       d  [        SU 5      eU $ )z@Return a current distribution object for a Requirement or stringz*Expected str, Requirement, or Distribution)r  r   r2   parser   r/   	TypeErrorrE  s    rN   r   r     sV    $  &$$$D!dL))DdKKKrM   c                6    [        U 5      R                  X5      $ )zDReturn `name` entry point of `group` for `dist` or raise ImportError)r   r   r   r   names      rN   r   r     s    D!225??rM   c                    g rV   rE   r   r   s     rN   r   r     s     (+rM   c                    g rV   rE   rN  s     rN   r   r      s    KNrM   c                6    [        U 5      R                  U5      $ )=Return the entry point map for `group`, or the full entry map)r   r   rN  s     rN   r   r   "  s    D!//66rM   c                6    [        U 5      R                  X5      $ z<Return the EntryPoint object for `group`+`name`, or ``None``)r   r   rK  s      rN   r   r   '  s    D!00==rM   c                  P    \ rS rSrS
S jrSS jrSS jrS
S jrSS jrSS jr	Sr
g	)r   i,  c                    g)z;Does the package's distribution contain the named metadata?NrE   r   rL  s     rN   has_metadataIMetadataProvider.has_metadata-      rM   c                    g)z'The named metadata resource as a stringNrE   rV  s     rN   get_metadataIMetadataProvider.get_metadata1  rY  rM   c                    g)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.NrE   rV  s     rN   get_metadata_lines$IMetadataProvider.get_metadata_lines5  s    
 	rM   c                    g)z>Is the named metadata a directory?  (like ``os.path.isdir()``)NrE   rV  s     rN   metadata_isdir IMetadataProvider.metadata_isdir<  rY  rM   c                    g)z?List of metadata names in the directory (like ``os.listdir()``)NrE   rV  s     rN   metadata_listdir"IMetadataProvider.metadata_listdir@  rY  rM   c                    g)z=Execute the named script in the supplied namespace dictionaryNrE   )r   script_name	namespaces      rN   r   IMetadataProvider.run_scriptD  rY  rM   rE   NrL  r   r   boolrL  r   r   r   rL  r   r   Iterator[str]rL  r   r   	list[str]rg  r   rh  dict[str, Any]r   None)rG   rH   rI   rJ   rW  r[  r^  ra  rd  r   rL   rE   rM   rN   r   r   ,  s     rM   r   c                  x    \ rS rSrSr      SS jr      SS jr      SS jrSS jrSS jr	SS jr
S	rg
)r7   iI  z3An object that provides access to package resourcesc                    g)zZReturn a true filesystem path for `resource_name`

`manager` must be a ``ResourceManager``NrE   r   managerresource_names      rN   get_resource_filename'IResourceProvider.get_resource_filenameL       	rM   c                    g)z_Return a readable file-like object for `resource_name`

`manager` must be a ``ResourceManager``NrE   rv  s      rN   get_resource_stream%IResourceProvider.get_resource_streamT  r{  rM   c                    g)z_Return the contents of `resource_name` as :obj:`bytes`

`manager` must be a ``ResourceManager``NrE   rv  s      rN   get_resource_string%IResourceProvider.get_resource_string\  r{  rM   c                    g)z,Does the package contain the named resource?NrE   r   rx  s     rN   has_resourceIResourceProvider.has_resourced  rY  rM   c                    g)z>Is the named resource a directory?  (like ``os.path.isdir()``)NrE   r  s     rN   r    IResourceProvider.resource_isdirh  rY  rM   c                    g)z?List of resource names in the directory (like ``os.listdir()``)NrE   r  s     rN   r   "IResourceProvider.resource_listdirl  rY  rM   rE   Nrw  r   rx  r   r   r   )rw  r   rx  r   r   r:   rw  r   rx  r   r   bytesrx  r   r   rk  rx  r   r   rp  )rG   rH   rI   rJ   rS   ry  r}  r  r  r   r   rL   rE   rM   rN   r7   r7   I  sk    =&7:	&7:	&7:	rM   c                     \ rS rSrSrS!S"S jjr\S 5       r\S 5       rS#S jr	S$S jr
S%S	 jr S!     S&S
 jjrS'S jrS(S jr   S)         S*S jjr\  S+           S,S jj5       r\ S!SSS.           S,S jjj5       r\    S-           S.S jj5       r    S-           S/S jjr  S0S jr\ S1         S2S jj5       r\ S!SS.         S2S jjj5       r\   S3         S4S jj5       r   S3         S5S jjrS6S jr S1     S7S jjrS8S jr  S9S jrS8S jrS rg):r   iq  zDA collection of active distributions on sys.path (or a similar list)Nc                    / U l         0 U l        0 U l        0 U l        / U l        Uc  [
        R                  nU H  nU R                  U5        M     g)z?Create working set from list of path entries (default=sys.path)N)entries
entry_keysby_keynormalized_to_canonical_keys	callbacksr   r!  	add_entry)r   r  entrys      rN   __init__WorkingSet.__init__t  sJ    "$79/1<>)AC?hhGENN5! rM   c                    U " 5       n SSK Jn   UR                  U5        U$ ! [         a    Us $ f = f! [         a    U R                  U5      s $ f = f)z!
Prepare the master working set.
r   )__requires__)__main__r  ImportErrorr   r   _build_from_requirements)clswsr  s      rN   _build_masterWorkingSet._build_master  sb    
 U	-	>JJ|$ 	  	I	  	>//==	>s   # 5 22AAc                @   U " / 5      n[        U5      nUR                  U[        5       5      nU H  nUR                  U5        M     [        R
                   H%  nXbR                  ;  d  M  UR                  U5        M'     UR                  [        R
                  SS& U$ )zA
Build a working set from a requirement spec. Rewrites sys.path.
N)r   resolver   addr   r!  r  r  )r  req_specr  reqsdistsr   r  s          rN   r  #WorkingSet._build_from_requirements  s|     W!(+

4/DFF4L  XXEJJ&U# 
 jj	rM   c                    U R                   R                  U/ 5        U R                  R                  U5        [	        US5       H  nU R                  X!S5        M     g)a  Add 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  
setdefaultr  appendr   r  )r   r  r   s      rN   r  WorkingSet.add_entry  sI     	""5"-E"&ud3DHHT%( 4rM   c                R    U R                   R                  UR                  5      U:H  $ )z9True if `dist` is the active distribution for its project)r  r-  rq   r   r   s     rN   __contains__WorkingSet.__contains__  s    {{txx(D00rM   c                   U R                   R                  UR                  5      nUcI  U R                  R                  UR                  5      nUb!  X1l        U R                   R                  U5      nUb  X!;  a  [	        X!5      eU$ )a  Find 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.
)r  r-  rq   r  r   )r   r   r   canonical_keys       rN   r  WorkingSet.find  sp     {{sww'< ==AA#''JM('{{}5!$,,rM   c                    ^^ UU4S jU  5       $ )zYield 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).
c              3     >#    U HB  nUR                  T5      R                  5        H  nTb  TUR                  :X  d  M  Uv   M     MD     g 7frV   )r   valuesrL  ).0r   r  r   rL  s      rN   	<genexpr>/WorkingSet.iter_entry_points.<locals>.<genexpr>  sK      
++E299;|tuzz1 E; s
   8AArE   r   r   rL  s    ``rN   r   WorkingSet.iter_entry_points  s    

 	
rM   c                    [         R                  " S5      R                  nUS   nUR                  5         XCS'   U R	                  U5      S   R                  X#5        g)z?Locate distribution for `requires` and run `script_name` scriptr   rG   r   N)r   	_getframe	f_globalsrn   r   r   )r   requiresrg  nsrL  s        rN   r   WorkingSet.run_script  sK    ]]1''*~

:Xq!,,[=rM   c              #     #    [        5       nU R                   HS  nX R                  ;  a  M  U R                  U    H,  nX1;  d  M
  UR                  U5        U R                  U   v   M.     MU     g7f)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)setr  r  r  r  )r   seenitemrq   s       rN   __iter__WorkingSet.__iter__  s[      uLLD??*t,?HHSM++c** - !s   A A1+A1TFc                   U(       a  UR                  U R                  X$S9  Uc  UR                  nU R                  R	                  U/ 5      nU R                  R	                  UR                  / 5      nU(       d  UR
                  U R                  ;   a  gXR                  UR
                  '   [        R                  R                  UR
                  5      nUR
                  U R                  U'   UR
                  U;  a  UR                  UR
                  5        UR
                  U;  a  UR                  UR
                  5        U R                  U5        g)a  Add `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.
r7  N)	insert_onr  locationr  r  rq   r  	packagingutilscanonicalize_namer  r  
_added_new)r   r   r  insertr7  keyskeys2normalized_names           rN   r  WorkingSet.add   s    $ NN4<<N@=MME))%4**4=="=488t{{2 $DHH#//;;DHHE=AXX))/:884KK!885 LL"rM   c                    g rV   rE   r   requirementsenv	installerreplace_conflictingextrass         rN   r  WorkingSet.resolve&  s      #rM   )r  r  c                   g rV   rE   r  s         rN   r  r  /  s      #rM   c                    g rV   rE   r  s         rN   r  r  9  s     !rM   c           	     "   [        U5      SSS2   n[        5       n0 n/ n[        5       n	[        R                  " [        5      n
U(       a  UR                  S5      nX;   a  M  U	R                  X5      (       d  M7  U R                  XXBX:U5      nUR                  UR                  5      SSS2   nUR                  U5        U H.  nX   R                  UR                  5        UR                  X'   M0     UR                  U5        U(       a  M  U$ )a6  List 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.
Nr  r   )listr  
_ReqExtrascollectionsdefaultdictpopmarkers_pass_resolve_distr  r  extendr  project_name)r   r  r  r  r  r  	processedbestto_activate
req_extrasr   r   r   new_requirementsnew_requirements                  rN   r  r  B  s
   B L)$B$/E	(**,\

 ##C( 	 ""1%C**377%%.Y[D
  $}}SZZ82> 01 $4,001A1AB.1jj
+ $4 MM#/ l4 rM   c                   UR                  UR                  5      nUc  U R                  R                  UR                  5      nUb  X;  ay  U(       ar  U n	Uc/  Uc  [        U R                  5      nO[        / 5      n[        / 5      n	UR                  XXSS9=oUR                  '   Uc  UR                  US 5      n
[        X5      eUR                  U5        X;  a  Xa   n[        X5      R                  U5      eU$ )N)r  )r-  rq   r  r   r  r   
best_matchr   r  r   r   )r   r   r  r  r  r  r   r  r   r  r   dependent_reqs               rN   r  WorkingSet._resolve_dist  s     xx <;;??377+D|4G;|)$,,7
 *"o'^'*~~Y (6 ( CGG} < +T :I.s>>t$?',M!$,99-HHrM   c                    g rV   rE   r   
plugin_envfull_envr  fallbacks        rN   find_pluginsWorkingSet.find_plugins  s	     FIrM   )r  c                   g rV   rE   r  s        rN   r  r    s	     FIrM   c                    g rV   rE   r  s        rN   r  r    s	     DGrM   c                j   [        U5      nUR                  5         0 n0 nUc  [        U R                  5      nX-  nOX!-   nU R	                  / 5      n	[        [        U	R                  U 5      5        U Hv  n
X    Hk  nUR                  5       /n U	R                  XU5      n[        [        U	R                  U5      5        UR                  [        R                  U5      5          Mt     Mx     [        U5      nUR                  5         X4$ ! [         a  nXU'   U(       a   SnAM   SnA  M  SnAff = f)a  Find 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)r  sortr   r  r   mapr  as_requirementr  ro   dictfromkeysr   )r   r  r  r  r  plugin_projects
error_infodistributionsr  
shadow_setr  r   r   	resolveesrc   sorted_distributionss                   rN   r  r    s!   X z*46
>@dll+CC'C^^B'
S&'+L"0**,- * 2 23Y GI Z^^Y78!((y)AB + 1 ,0  $M2!!##//) ' '(t$  s   D
D2D--D2c                n    U R                  [        U5      5      nU H  nU R                  U5        M     U$ )a  Ensure 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.
)r  r   r  )r   r  neededr   s       rN   r   WorkingSet.require   s4     0>?DHHTN  rM   c                    XR                   ;   a  gU R                   R                  U5        U(       d  gU  H  nU" U5        M     g)zkInvoke `callback` for all distributions

If `existing=True` (default),
call on all existing ones, as well.
N)r  r  )r   callbackexistingr   s       rN   	subscribeWorkingSet.subscribe0  s:     ~~%h'DTN rM   c                :    U R                    H  nU" U5        M     g rV   )r  )r   r   r  s      rN   r  WorkingSet._added_new@  s    HTN 'rM   c                    U R                   S S  U R                  R                  5       U R                  R                  5       U R                  R                  5       U R
                  S S  4$ rV   )r  r  ri   r  r  r  r   s    rN   rd   WorkingSet.__getstate__D  sW     LLOOO  "KK--224NN1
 	
rM   c                    Uu  p#pEnUS S  U l         UR                  5       U l        UR                  5       U l        UR                  5       U l        US S  U l        g rV   )r  ri   r  r  r  r  )r   	e_k_b_n_cr  r  r  r  r  s          rN   rg   WorkingSet.__setstate__U  sO    IRFvYqz))+kkm,H,M,M,O)"1rM   )r  r  r  r  r  rV   )r  Iterable[str] | Noner   rs  )r  r   r   rs  r   r/   r   rk  )r   r2   r   Distribution | None)r   r   rL  
str | Noner   zIterator[EntryPoint])r  r   rg  r   r   rs  )r   Iterator[Distribution])NTF)
r   r/   r  r  r  rk  r7  rk  r   rs  )FN)r  Iterable[Requirement]r  Environment | Noner  $_StrictInstallerType[_DistributionT]r  rk  r  tuple[str, ...] | Noner   zlist[_DistributionT])NNFN)r  r  r  r  r  _InstallerType | Noner  rk  r  r   r   list[Distribution])r  r  r  r  r  <_InstallerType | None | _StrictInstallerType[_DistributionT]r  rk  r  r   r   z)list[Distribution] | list[_DistributionT]r   T)
r  r   r  r  r  r  r  rk  r   z:tuple[list[_DistributionT], dict[Distribution, Exception]])NNT)
r  r   r  r  r  r!  r  rk  r   z8tuple[list[Distribution], dict[Distribution, Exception]])
r  r   r  r  r  r#  r  rk  r   zOtuple[list[Distribution] | list[_DistributionT], dict[Distribution, Exception]])r  r1   r   r"  )r  z Callable[[Distribution], object]r  rk  r   rs  r   rs  )r   z~tuple[list[str], dict[str | None, list[str]], dict[str, Distribution], dict[str, str], list[Callable[[Distribution], object]]])rG   rH   rI   rJ   rS   r  classmethodr  r  r  r  r  r   r   r  r  r   r  r  r  r   r  r  rd   rg   rL   rE   rM   rN   r   r   q  s   N"  &  *)12 .2

 *
	
 >+( !$$ $ 	$
 $ 
$L  %*)-#+#  # 8	#
 "# '# 
# #  #'# %*)-#+#  #
 8# "# '# 
# #  #'+/$))-!+!  ! )	!
 "! '! 
! ! #'RV$))-J+J  J P	J
 "J 'J 
3JX	>  II %I 8	I
 I 
DI I  (,I II %I
 8I I 
DI I  (,+/GG %G )	G
 G 
BG G (,RVX0X0 %X0 P	X0
 X0
X0t" LP8DH	 


"&rM   r   c                  &    \ rS rSrSrSSS jjrSrg)r  i^  z6
Map each requirement to the extras that demanded it.
Nc                   ^ TR                   (       + =(       d1    [        U4S jU R                  TS5      U=(       d    S-    5       5      $ )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.
c              3  \   >#    U H"  nTR                   R                  S U05      v   M$     g7f)extraNmarkerevaluate)r  r*  r   s     rN   r  *_ReqExtras.markers_pass.<locals>.<genexpr>k  s/      %
> JJ% 011>s   ),rE   )r  )r,  anyr-  )r   r   r  s    ` rN   r  _ReqExtras.markers_passc  s@     ::~ 
 %
#r*fo>%
 "
 	
rM   rE   rV   )r   r2   r  r   )rG   rH   rI   rJ   rS   r  rL   rE   rM   rN   r  r  ^  s    
 
rM   r  .c                     \ rS rSrSrS\" 5       \4       SS jjrSS jrSS jr	SSS jjr
SS jrSS	 jr\ S         SS
 jj5       r\  S         SS jj5       r  S         SS jjr\      S S j5       r\ S     S!S jj5       r\ S     S"S jj5       r S     S#S jjrS$S jrS%S jrS%S jrSrg)&r   iq  z5Searchable snapshot of distributions on a search pathNc                L    0 U l         X l        X0l        U R                  U5        g)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)_distmapr   pythonscan)r   search_pathr   r4  s       rN   r  Environment.__init__t  s!    , 8: 		+rM   c                    U R                   SL =(       d.    UR                  SL =(       d    UR                  U R                   :H  nU=(       a     [        UR                  U R                  5      $ )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)r4  
py_versionr   r   )r   r   	py_compats      rN   can_addEnvironment.can_add  sX     KK4 .$&.$++- 	
 O1$--OOrM   c                T    U R                   UR                     R                  U5        g)z"Remove `dist` from the environmentN)r3  rq   remover  s     rN   r>  Environment.remove  s    dhh&&t,rM   c                    Uc  [         R                  nU H&  n[        U5       H  nU R                  U5        M     M(     g)a<  Scan `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)r   r!  r   r  )r   r6  r  r   s       rN   r5  Environment.scan  s7     ((KD*40 1  rM   c                Z    UR                  5       nU R                  R                  U/ 5      $ )zReturn 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.

)lowerr3  r-  )r   r  distribution_keys      rN   __getitem__Environment.__getitem__  s+     (--/}}  !1266rM   c                    U R                  U5      (       ax  UR                  5       (       ab  U R                  R                  UR                  / 5      nX;  a6  UR                  U5        UR                  [        R                  " S5      SS9  gggg)zCAdd `dist` if we ``can_add()`` it and it has not already been addedhashcmpT)rq   reverseN)	r;  has_versionr3  r  rq   r  r  operator
attrgetter)r   r   r  s      rN   r  Environment.add  ss    <<$"2"2"4"4MM,,TXXr:E T"

x229=t
L ! #5rM   c                    g rV   rE   r   r   r   r  r  s        rN   r  Environment.best_match  s     rM   c                    g rV   rE   rO  s        rN   r  rP    s     "rM   c                     UR                  U5      nUb  U$ XR                      H  nXQ;   d  M
  Us  $    U R                  X5      $ ! [         a    U(       d  e Sn NJf = f)ah  Find 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  r   rq   obtain)r   r   r   r  r  r   s         rN   r  rP    sk    &	##C(D
 KMD{ " {{3**  	&D	s   A AAc                    g rV   rE   r   requirementr  s      rN   rS  Environment.obtain  s    
 rM   c                    g rV   rE   rU  s      rN   rS  rW    s    
 rM   c                    g rV   rE   rU  s      rN   rS  rW     s    
 "rM   c                $    U(       a  U" U5      $ S$ )a  Obtain 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.NrE   rU  s      rN   rS  rW    s      *3y%<<rM   c              #  l   #    U R                   R                  5        H  nX   (       d  M  Uv   M     g7f)z=Yield the unique project names of the available distributionsN)r3  r  r   rq   s     rN   r  Environment.__iter__  s(     ==%%'Cyy	 (s   %4	4c                    [        U[        5      (       a  U R                  U5        U $ [        U[        5      (       a'  U H  nX    H  nU R                  U5        M     M!     U $ [	        SU< S35      e)z2In-place addition of a distribution or environmentz
Can't add z to environment)r  r/   r  r   rI  )r   otherprojectr   s       rN   __iadd__Environment.__iadd__  sh    e\**HHUO  {++ !NDHHTN + !
  UDEErM   c                D    U R                  / SSS9nX4 H  nX#-  nM	     U$ )z4Add an environment or distribution to an environmentN)r   r4  r   )r   r_  newr  s       rN   __add__Environment.__add__*  s.    nnR$tn<;CJC 
rM   )r3  r   r4  )r6  r  r   r  r4  r  r   rs  r  )r   r/   r   rs  rV   )r6  r  r   rs  )r  r   r   r"  F)
r   r2   r   r   r  r  r  rk  r   r.   NF)
r   r2   r   r   r  r!  r  rk  r   r  )
r   r2   r   r   r  r#  r  rk  r   r  )rV  r2   r  r  r   r.   )rV  r2   r  z$Callable[[Requirement], None] | Noner   rs  )rV  r2   r  r!  r   r  )rV  r2   r  z\Callable[[Requirement], None] | _InstallerType | None | _StrictInstallerType[_DistributionT]r   r  )r   rn  )r_  zDistribution | Environmentr   r(   )rG   rH   rI   rJ   rS   r   PY_MAJORr  r;  r>  r5  rE  r  r   r  rS  r  ra  rf  rL   rE   rM   rN   r   r   q  s   ? -157%	)  	
 
6P-	7M  %*   8	
 " 
  
 ,0$)""  " )	"
 "" 
" " SW$)++  + P	+
 "+ 
+B   8 
	 
  ;?  8 
	 
  ,0" " )" 
	" " 26= =/= 
=$
rM   r   c                  8    \ rS rSr% SrS\S'   S\S'   S\S'   S	rg
)r   i6  a4  An 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
r   rw  r   
cache_pathzBaseException | Noneoriginal_errorrE   N)rG   rH   rI   rJ   rS   rK   rL   rE   rM   rN   r   r   6  s     O((rM   r   c                     \ rS rSr% SrSrS\S'   SS jr      SS jr      SS jr	      SS	 jr
      SS
 jr      SS jr      SS jrSS jrSSS jjr\SS j5       rSS jrSS jrSS S jjrSrg)!r   iJ  z'Manage resource extraction and packagesNr  extraction_pathc                    0 U l         g rV   )cached_filesr   s    rN   r  ResourceManager.__init__O  s
    68rM   c                6    [        U5      R                  U5      $ )zDoes the named resource exist?)r   r  r   package_or_requirementrx  s      rN   r   ResourceManager.resource_existsS  s     23@@OOrM   c                6    [        U5      R                  U5      $ )z,Is the named resource an existing directory?)r   r   rt  s      rN   r   ResourceManager.resource_isdirY  s     23BB=QQrM   c                6    [        U5      R                  X5      $ )z4Return a true filesystem path for specified resource)r   ry  rt  s      rN   r   !ResourceManager.resource_filename_  s      23II
 	
rM   c                6    [        U5      R                  X5      $ )z9Return a readable file-like object for specified resource)r   r}  rt  s      rN   r   ResourceManager.resource_streamg        23GG
 	
rM   c                6    [        U5      R                  X5      $ )z)Return specified resource as :obj:`bytes`)r   r  rt  s      rN   r   ResourceManager.resource_stringo  r}  rM   c                6    [        U5      R                  U5      $ )z1List the contents of the named resource directory)r   r   rt  s      rN   r    ResourceManager.resource_listdirw  s     23DD]SSrM   c                "   [         R                  " 5       S   nU R                  =(       d
    [        5       n[        R
                  " S5      R                  5       n[        UR                  " S0 [        5       D65      nXl
        X$l        Xl        Ue)z5Give an error message for problems extracting file(s)r   a  
            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.
            rE   )r   exc_inforo  r   textwrapdedentlstripr   r   r   rw  rl  rm  )r   old_excrl  tmplerrs        rN   extraction_error ResourceManager.extraction_error}  sv     ,,.#))@->-@

" &(# 	$ dkk5FH56#$	rM   c                    U R                   =(       d
    [        5       n[        R                  R                  " X1S-   /UQ76 n [        U5        U R                  U5        SU R                  U'   U$ ! [         a    U R                  5          N>f = f)af  Return 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)
ro  r   r   r!  r   _bypass_ensure_directory	Exceptionr  _warn_unsafe_extraction_pathrq  )r   archive_namenamesextract_pathtarget_paths        rN   get_cache_pathResourceManager.get_cache_path  s     ++B/@/Bggll<1FOO	$$[1 	)),7)-+&  	$!!#	$s   A0 0BBc                   [         R                  S:X  a(  U R                  [         R                  S   5      (       d  g[         R                  " U 5      R
                  nU[        R                  -  (       d  U[        R                  -  (       a6  SR                  " S0 [        5       D6n[        R                  " U[        5        gg)a  
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.
ntwindirNzExtraction 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).rE   )r   rL  r5  environstatst_modeS_IWOTHS_IWGRPr   r   warningswarnUserWarning)r!  modemsgs      rN   r  ,ResourceManager._warn_unsafe_extraction_path  s     77d?4??2::h3G#H#H wwt}$$$,,$"5: f ! x!C MM#{+ #6rM   c                    [         R                  S:X  a=  [         R                  " U5      R                  S-  S-  n[         R                  " X5        gg)a  Perform 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.
posixim  i  N)r   rL  r  r  chmod)r   tempnamefilenamer  s       rN   postprocessResourceManager.postprocess  s?     77gWWX&..%76ADHHX$ rM   c                H    U R                   (       a  [        S5      eXl        g)ab  Set 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)rq  r   ro  r   r!  s     rN   r   #ResourceManager.set_extraction_path  s    & TUU#rM   c                    / $ )a  
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.
rE   )r   forces     rN   r   !ResourceManager.cleanup_resources  s	     	rM   )rq  ro  r%  )ru  r5   rx  r   r   rk  )ru  r5   rx  r   r   r   )ru  r5   rx  r   r   r:   )ru  r5   rx  r   r   r  )ru  r5   rx  r   r   rp  )r   r   rE   )r  r   r  zIterable[StrPath]r   r   )r  r%   r  r%   r   rs  r!  r   r   rs  rh  )r  rk  r   rp  )rG   rH   rI   rJ   rS   ro  rK   r  r   r   r   r   r   r   r  r  staticmethodr  r  r   r   rL   rE   rM   rN   r   r   J  s    1"&OZ&9P&1PBEP	PR&1RBER	R
&1
BE
	

&1
BE
	

&1
BE
	
T&1TBET	T<2 , ,4%($0 rM   r   c                 `    [         R                  R                  S5      =(       d	    [        SS9$ )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)r   r  r-  _user_cache_dirrE   rM   rN   r   r   
  s"     ::>>,-W1WWrM   c                2    [         R                  " SSU 5      $ )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   )resubrL  s    rN   r   r     s    
 66"C..rM   c                     [        [        R                  R                  U 5      5      $ ! [        R                  R                   a-    U R                  SS5      n [        R                  " SSU 5      s $ f = f)z:
Convert an arbitrary string to a standard version string
r2  r   r  r   )r   r  r%  VersionInvalidVersionr7  r  r  )r%  s    rN   r   r     sb    69$$,,W566++ 6//#s+vv&W556s   '* AA54A5c                    U R                  SS5      n [        R                  U 5      nU(       a  US   nU [        U5      S nOSnU nS[	        U5       3R                  S5      nU SU 3$ )a  Fallback when ``safe_version`` is not safe enough
>>> parse_version(_forgiving_version('0.23ubuntu1'))
<Version('0.23.dev0+sanitized.ubuntu1')>
>>> parse_version(_forgiving_version('0.23-'))
<Version('0.23.dev0+sanitized')>
>>> parse_version(_forgiving_version('0.-_'))
<Version('0.dev0+sanitized')>
>>> parse_version(_forgiving_version('42.+?1'))
<Version('42.dev0+sanitized.1')>
>>> parse_version(_forgiving_version('hello world'))
<Version('0.dev0+sanitized.hello.world')>
r2  r   safeN0z
sanitized.z.dev0+)r7  _PEP440_FALLBACKsearchlen_safe_segmentstrip)r%  r   r  restlocals        rN   _forgiving_versionr  '  sx     ooc3'G##G,EV}s4y{#t,-.44S9EV6%!!rM   c                    [         R                  " SSU 5      n [         R                  " SSU 5      n [         R                  " SSU 5      R                  S5      $ )z/Convert an arbitrary string into a safe segmentr  r   z-[^A-Za-z0-9]+z\.[^A-Za-z0-9]+r   z.-)r  r  r  )segments    rN   r  r  @  sG    ff%sG4Gff%sG4G66$c7399$??rM   c                N    [         R                  " SSU 5      R                  5       $ )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.-]+r3  )r  r  rC  )r*  s    rN   r   r   G  s!     66#S%06688rM   c                &    U R                  SS5      $ )ztConvert a project or version name to its filename-escaped form

Any '-' characters are currently replaced with '_'.
r   r3  r  r  s    rN   r   r   P  s    
 <<S!!rM   c                j     [        U 5        g! [         a  nSUl        SUl        Us SnA$ SnAff = f)zc
Validate text as a PEP 508 environment marker; return an exception
if invalid or False otherwise.
NF)r   SyntaxErrorr  lineno)textes     rN   r   r   X  s9    

 	  
s    
2-22c                     [         R                  R                  U 5      nUR                  5       $ ! [         R                  R                   a  n[        U5      UeSnAff = f)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)r  markersMarkerr-  InvalidMarkerr  )r  r*  r,  r  s       rN   r   r   f  sR    $""))$/  ** $!n!#$s   .1 A AA c                  6   \ rS rSr% SrSrS\S'   SrS\S'   SrS\S'   SS	 jr	      SS
 jr
      S S jr      S!S jrS"S jrS rS#S jrS$S jrS%S jrS"S jrS#S jrS&S jrS'S jrS(S jrS)S jrS)S jrS*S jrS+S jr\S,S j5       rS-S jrSrg).r   iu  zETry to implement resources and metadata for arbitrary PEP 302 loadersNr  egg_nameegg_infozLoaderProtocol | Noner  c                    [        USS 5      U l        [        R                  R	                  [        USS5      5      U l        g )NrD   __file__r  )r  r  r   r!  dirnamemodule_path)r   r  s     rN   r  NullProvider.__init__|  s0    flD977??76:r+JKrM   c                :    U R                  U R                  U5      $ rV   )_fnr  rv  s      rN   ry  "NullProvider.get_resource_filename  s     xx((-88rM   c                L    [         R                  " U R                  X5      5      $ rV   )ioBytesIOr  rv  s      rN   r}   NullProvider.get_resource_stream  s     zz$227JKKrM   c                X    U R                  U R                  U R                  U5      5      $ rV   )_getr  r  rv  s      rN   r   NullProvider.get_resource_string  s$     yy$"2"2MBCCrM   c                X    U R                  U R                  U R                  U5      5      $ rV   )_hasr  r  r  s     rN   r  NullProvider.has_resource  s"    yy$"2"2MBCCrM   c                :    U R                  U R                  U5      $ rV   )r  r  rV  s     rN   _get_metadata_pathNullProvider._get_metadata_path  s    xxt,,rM   c                j    U R                   (       d  gU R                  U5      nU R                  U5      $ ri  )r  r  r  r   rL  r!  s      rN   rW  NullProvider.has_metadata  s*    }}&&t,yyrM   c                    U R                   (       d  gU R                  U5      nU R                  U5      n UR                  S5      $ ! [         a*  nU=R
                  SR                  X5      -  sl        e S nAff = f)Nr  utf-8z in {} file at path: {})r  r  r  decodeUnicodeDecodeErrorreasonr   )r   rL  r!  valueexcs        rN   r[  NullProvider.get_metadata  sl    }}&&t,		$	<<((! 	 JJ3::4FFJ		s   A 
A;%A66A;c                6    [        U R                  U5      5      $ rV   r"   r[  rV  s     rN   r^  NullProvider.get_metadata_lines      4,,T233rM   c                X    U R                  U R                  U R                  U5      5      $ rV   )_isdirr  r  r  s     rN   r   NullProvider.resource_isdir  s"    {{488D$4$4mDEErM   c                    [        U R                  =(       a+    U R                  U R                  U R                  U5      5      5      $ rV   )rk  r  r   r  rV  s     rN   ra  NullProvider.metadata_isdir  s.    DMMPdkk$((4==$2O&PQQrM   c                X    U R                  U R                  U R                  U5      5      $ rV   )_listdirr  r  r  s     rN   r   NullProvider.resource_listdir  s"    }}TXXd&6&6FGGrM   c                ~    U R                   (       a+  U R                  U R                  U R                   U5      5      $ / $ rV   )r  r  r  rV  s     rN   rd  NullProvider.metadata_listdir  s,    ====$--!>??	rM   c                2   SU-   nU R                  U5      (       d#  [        SR                  " S
0 [        5       D65      eU R	                  U5      R                  SS5      nUR                  SS5      nU R                  U R                  U5      nXRS'   [        R                  R                  U5      (       a$  [        U5      n[        XeS5      n[        XrU5        g SS	KJn  [!        U5      SUR#                  S5      U4X'   [        XES5      n	[        XU5        g )Nzscripts/z<Script {script!r} not found in metadata at {self.egg_info!r}z

r  execr   )cacherE   )rW  r   r   r   r[  r7  r  r  r   r!  r"  _read_utf8_with_fallbackcompiler  	linecacher  r  r   )
r   rg  rh  scriptscript_textscript_filenamesourcecoder  script_codes
             rN   r   NullProvider.run_script  s   k)  ((!NUU h  ''/77E!))$5((4==&9 /*77>>/**-o>F6F;D),' K !!$'	&E" "+GK3rM   c                    [        S5      eNz9Can't perform this operation for unregistered loader typeNotImplementedErrorr  s     rN   r  NullProvider._has      !G
 	
rM   c                    [        S5      er  r  r  s     rN   r   NullProvider._isdir  r  rM   c                    [        S5      er  r  r  s     rN   r  NullProvider._listdir  r  rM   c                    Uc  [        S5      eU R                  U5        U(       a0  [        R                  R                  " U/UR                  S5      Q76 $ U$ )Nz^`base` parameter in `_fn` is `None`. Either override this method or check the parameter first./)rI  _validate_resource_pathr   r!  r   r   )r   baserx  s      rN   r  NullProvider._fn  sR    <p  	$$]377<<@}':':3'?@@rM   c                
   [         R                  R                  U R                  [        R
                  5      ;   =(       dK    [        R                  " U 5      =(       d.    [        R                  " U 5      =(       d    U R                  S5      nU(       d  gSnU R                  S5      (       d  [        R                  " U 5      (       a&  [        R                  " U 5      (       d  [        U5      e[        USS S-   [        5        g)a   
Validate the resource paths according to the docs.
https://setuptools.pypa.io/en/latest/pkg_resources.html#basic-resource-access

>>> warned = getfixture('recwarn')
>>> warnings.simplefilter('always')
>>> vrp = NullProvider._validate_resource_path
>>> vrp('foo/bar.txt')
>>> bool(warned)
False
>>> vrp('../foo/bar.txt')
>>> bool(warned)
True
>>> warned.clear()
>>> vrp('/foo/bar.txt')
>>> bool(warned)
True
>>> vrp('foo/../../bar.txt')
>>> bool(warned)
True
>>> warned.clear()
>>> vrp('foo/f../bar.txt')
>>> bool(warned)
False

Windows path separators are straight-up disallowed.
>>> vrp(r'\foo/bar.txt')
Traceback (most recent call last):
...
ValueError: Use of .. or absolute path in a resource path is not allowed.

>>> vrp(r'C:\foo/bar.txt')
Traceback (most recent call last):
...
ValueError: Use of .. or absolute path in a resource path is not allowed.

Blank values are allowed

>>> vrp('')
>>> bool(warned)
False

Non-string values are not.

>>> vrp(None)
Traceback (most recent call last):
...
AttributeError: ...
\Nz=Use of .. or absolute path in a resource path is not allowed.r  z/ and will raise exceptions in a future release.)r   r!  pardirr   	posixpathsepisabsntpathr5  r   issue_warningDeprecationWarning)r!  invalidr  s      rN   r$  $NullProvider._validate_resource_path  s    l GGNNdjj77 %t$%||D!% t$	 	 M OOD!!V\\$%7%7QUAVAVS/! 	HHH	
rM   c                    [        U R                  S5      (       a,  U R                  (       a  U R                  R                  U5      $ [        S5      e)Nget_dataz=Can't perform this operation for loaders without 'get_data()')hasattrr  r3  r  r  s     rN   r  NullProvider._get;  s>    4;;
++;;''--!K
 	
rM   )r  r  r  r;   r   rs  r  )rw  r   rx  r   r   r   r  r  rj  rl  rm  r  ro  rq  r   rk  )r   rp  )r%  r  rx  r   r%  r   r  )rG   rH   rI   rJ   rS   r  rK   r  r  r  ry  r}  r  r  r  rW  r[  r^  r   ra  r   rd  r   r  r   r  r  r  r$  r  rL   rE   rM   rN   r   r   u  s    OHjHj$(F!(L9&97:9	9
L&L7:L	L
D&D7:D	D
D-4FRH
4:





 H
 H
T
rM   r   c              #  x   #    SnX:w  a/  U v   U n[         R                  R                  U 5      u  pX:w  a  M.  gg7f)z*
yield all parents of path including path
N)r   r!  r   )r!  lastr3  s      rN   _parentsr;  G  s6      D
,
''--% ,s   4::c                  @   ^  \ rS rSrSrSU 4S jjrS rSS jrSrU =r	$ )	r   iR  z&Provider based on a virtual filesystemc                D   > [         TU ]  U5        U R                  5         g rV   )superr  _setup_prefixr   r  r   s     rN   r  EggProvider.__init__U  s     rM   c                    [        [        [        U R                  5      5      n[	        US 5      nU=(       a    U R                  U5        g   g rV   )filter_is_egg_pathr;  r  next_set_egg)r   eggseggs      rN   r?  EggProvider._setup_prefixY  s;     lHT-=-=$>?4"c""rM   c                    [         R                  R                  U5      U l        [         R                  R	                  US5      U l        Xl        g )NEGG-INFO)r   r!  basenamer  r   r  egg_rootr  s     rN   rF  EggProvider._set_egg`  s3    ((.T:6rM   )r  r  rM  r6  r  )
rG   rH   rI   rJ   rS   r  r?  rF  rL   __classcell__rd  s   @rN   r   r   R  s    0# rM   r   c                  f    \ rS rSrSrSS jrSS jrS r      SS jrSS jr	\
SS j5       rS	rg
)r   if  z6Provides access to package resources in the filesystemc                @    [         R                  R                  U5      $ rV   )r   r!  r"  r  s     rN   r  DefaultProvider._hasi  s    ww~~d##rM   c                @    [         R                  R                  U5      $ rV   )r   r!  r   r  s     rN   r   DefaultProvider._isdirl  s    ww}}T""rM   c                .    [         R                  " U5      $ rV   )r   listdirr  s     rN   r  DefaultProvider._listdiro  s    zz$rM   c                N    [        U R                  U R                  U5      S5      $ Nr  )r   r  r  rv  s      rN   r}  #DefaultProvider.get_resource_streamr  s"     DHHT--}=tDDrM   c                p    [        US5       nUR                  5       sS S S 5        $ ! , (       d  f       g = frY  )r   read)r   r!  streams      rN   r  DefaultProvider._getw  s#    $;;= s   '
5c                x    SnU H2  n[        [        R                  U[        S 5      5      n[	        X05        M4     g )N)SourceFileLoaderSourcelessFileLoader)r  	importlib	machinerytyper   )r  loader_namesrL  
loader_clss       rN   	_registerDefaultProvider._register{  s5    
 !D !4!4dDJGJ 1 !rM   rE   Nr7  )rw  objectrx  r   r   zio.BufferedReaderr8  r%  )rG   rH   rI   rJ   rS   r  r   r  r}  r  r&  rg  rL   rE   rM   rN   r   r   f  sN    @$# EE.1E	E
! 2 2rM   r   c                  L    \ rS rSr% SrSrS\S'   S =rrSS jr	S r
SS	 jrS
rg)r   i  z.Provider that returns nothing for all requestsNr  r  c                    gri  rE   r  s     rN   r{   EmptyProvider.<lambda>  s    urM   c                    g)NrM   rE   r  s     rN   r  EmptyProvider._get  s    rM   c                    / $ rV   rE   r  s     rN   r  EmptyProvider._listdir  s    	rM   c                    g rV   rE   r   s    rN   r  EmptyProvider.__init__  s    rM   rE   r8  r%  )rG   rH   rI   rJ   rS   r  rK   r   r  r  r  r  rL   rE   rM   rN   r   r     s*    8 #K",,FTrM   r   c                  0    \ rS rSrSr\SS j5       r\rSrg)ZipManifestsi  z
zip manifest builder
c                   ^ [         R                  " U5       mU4S jTR                  5        5       n[        U5      sSSS5        $ ! , (       d  f       g= f)z
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.
c              3     >#    U H6  nUR                  S [        R                  5      TR                  U5      4v   M8     g7f)r#  N)r7  r   r+  getinfo)r  rL  zfiles     rN   r  %ZipManifests.build.<locals>.<genexpr>  s<      
 -D LLbff-MM$' -s   =A N)zipfileZipFilenamelistr  )r  r!  r^   rx  s      @rN   buildZipManifests.build  s@     __T"e
 "NN,E ; #""s   %A
ArE   Nr!  r   r   dict[str, zipfile.ZipInfo])	rG   rH   rI   rJ   rS   r&  r}  r$  rL   rE   rM   rN   rt  rt    s"    
  $ DrM   rt  !MemoizedZipManifests.manifest_modc                  8    \ rS rSrSr " S S\5      rSS jrSrg)	MemoizedZipManifestsi  z
Memoized zipfile manifests.
c                  *    \ rS rSr% S\S'   S\S'   Srg)r  i  r  manifestfloatmtimerE   NrF   rE   rM   rN   manifest_mod!MemoizedZipManifests.manifest_mod  s    ,,rM   r  c                   [         R                  R                  U5      n[         R                  " U5      R                  nX;  d  X   R
                  U:w  a$  U R                  U5      nU R                  X25      X'   X   R                  $ )zG
Load a manifest at path or return a suitable manifest already loaded.
)	r   r!  normpathr  st_mtimer  r}  r  r  )r   r!  r  r  s       rN   r$  MemoizedZipManifests.load  sn     ww%&&tz//58zz$'H**8;DJz"""rM   rE   Nr  )	rG   rH   rI   rJ   rS   r   r  r$  rL   rE   rM   rN   r  r    s    z #rM   r  c                     ^  \ rS rSr% SrSrS\S'   \" 5       rS\S'   SU 4S jjr	S	 r
S
 r\S 5       r      SS jr\S 5       rSS jrS rS rS rSS jrSS jrS rSS jrSS jrSrU =r$ )r   i  z"Resource support for zips and eggsNlist[str] | NoneeagersrC   r  c                |   > [         TU ]  U5        U R                  R                  [        R
                  -   U l        g rV   )r>  r  r  archiver   r+  zip_prer@  s     rN   r  ZipProvider.__init__  s*     {{**RVV3rM   c                   UR                  [        R                  5      nXR                  R                  :X  a  gUR                  U R                  5      (       a  U[        U R                  5      S  $ [        U< SU R                  < 35      e)Nr   is not a subpath of )	rstripr   r+  r  r  r5  r  r  AssertionErrorr   fspaths     rN   _zipinfo_nameZipProvider._zipinfo_name  si     rvv&[[(((T\\**#dll+-..FDLLQRRrM   c                *   U R                   U-   nUR                  U R                  [        R                  -   5      (       a8  U[        U R                  5      S-   S  R                  [        R                  5      $ [        U< SU R                  < 35      e)Nr   r  )r  r5  rM  r   r+  r  r   r  )r   zip_pathr  s      rN   _partsZipProvider._parts  so     (T]]RVV344#dmm,q02399"&&AAFDMMRSSrM   c                `    U R                   R                  U R                  R                  5      $ rV   )_zip_manifestsr$  r  r  r   s    rN   zipinfoZipProvider.zipinfo  s#    ""''(;(;<<rM   c                8   U R                   (       d  [        S5      eU R                  U5      nU R                  5       nSR	                  U R                  U5      5      U;   a)  U H#  nU R                  XR                  U5      5        M%     U R                  X5      $ )Nz5resource_filename() only supported for .egg, not .zipr#  )r  r  _resource_to_zip_get_eager_resourcesr   r  _extract_resource_eager_to_zip)r   rw  rx  r  r  rL  s         rN   ry  !ZipProvider.get_resource_filename  s     }}%G  ((7**,88DKK)*f4&&w0B0B40HI %%g88rM   c                j    U R                   nU R                  S-   n[        R                  " U5      nX14$ )N)r   r   r  )	file_size	date_timetimemktime)zip_statsizer  	timestamps       rN   _get_date_and_sizeZipProvider._get_date_and_size  s3    !!&&3	KK	*	rM   c                   X R                  5       ;   ah  U R                  5       U    H2  nU R                  U[        R                  R	                  X#5      5      nM4     [        R                  R                  W5      $ U R                  U R                  U   5      u  pV[        (       d  [        S5      e U R                  (       d  [        S5      eUR                  U R                  U R                  U5      5      nU R                  Xr5      (       a  U$ [        S[        R                  R                  U5      S9u  p[        R                  " XR                   R#                  U5      5        [        R$                  " U5        ['        XU45        UR)                  X5         [+        X5        U$ ! [         an    [        R                  R-                  U5      (       aH  U R                  Xr5      (       a  Us $ [        R.                  S:X  a  [1        U5        [+        X5        Us $ e f = f! [         a    UR3                  5          W$ f = f)Nz>"os.rename" and "os.unlink" are not supported on this platformzT"egg_name" is empty. This likely means no egg could be found from the "module_path".z	.$extract)dirr  )_indexr  r   r!  r   r  r  r  WRITE_SUPPORTOSErrorr  r  r  _is_current_mkstempwriter  r3  closer   r  r   isfilerL  r   r  )
r   rw  r  rL  r:  r  _size	real_pathoutftmpnams
             rN   r  ZipProvider._extract_resource  s   {{}$h/--grww||H7ST 0 77??4((224<<3IJ	}P %	'==j   ..t}}dkk(>STI	44  #GGOOI.LD HHT;;//9:HHTN&i012v)& #  77>>),,''	<<  )(Dy)v1((  	'$$&		'sE   3AH' BH' F, ,AH$2H' 4,H$ H' "H$$H' 'IIc                   U R                  U R                  U   5      u  p4[        R                  R	                  U5      (       d  g[        R
                  " U5      nUR                  U:w  d  UR                  U:w  a  gU R                  R                  U5      n[        US5       nUR                  5       nSSS5        Xh:H  $ ! , (       d  f       UW:H  $ = f)z;
Return True if the file_path is current for this zip_path
Fr  N)r  r  r   r!  r  r  st_sizer  r  r3  r   r\  )	r   	file_pathr  r  r  r  zip_contentsffile_contentss	            rN   r  ZipProvider._is_currentB  s     11$,,x2HI	ww~~i((wwy!<<44==I#={{++H5)T"aFFHM #,, #"},,s   $C
Cc                    U R                   cI  / nS H;  nU R                  U5      (       d  M  UR                  U R                  U5      5        M=     Xl         U R                   $ )N)znative_libs.txtzeager_resources.txt)r  rW  r  r^  )r   r  rL  s      rN   r   ZipProvider._get_eager_resourcesR  sU    ;;FB$$T**MM$"9"9$"?@ C !K{{rM   c                |    U R                   $ ! [         a    0 nU R                   H  nUR                  [        R
                  5      nU(       d  M+  [        R
                  R                  US S 5      nXA;   a  X   R                  US   5        Mj  UR                  5       /X'   U(       a  M[  M     Xl         Us $ f = f)Nr  )		_dirindexAttributeErrorr  r   r   r+  r   r  r  )r   indr!  partsparents        rN   r  ZipProvider._index[  s    	>>! 	C

266*eVV[[s4F}**595',yy{m e % !NJ	s    ?B;AB;,B;:B;c                r    U R                  U5      nX R                  ;   =(       d    X R                  5       ;   $ rV   )r  r  r  )r   r  r  s      rN   r  ZipProvider._hasl  s-    %%f-<<'D8{{}+DDrM   c                F    U R                  U5      U R                  5       ;   $ rV   )r  r  r  s     rN   r   ZipProvider._isdirp  s    !!&)T[[]::rM   c                r    [        U R                  5       R                  U R                  U5      S5      5      $ r   )r  r  r-  r  r  s     rN   r  ZipProvider._listdirs  s+    DKKM%%d&8&8&@"EFFrM   c                X    U R                  U R                  U R                  U5      5      $ rV   )r  r  rM  r  s     rN   r  ZipProvider._eager_to_zipv  s"    !!$((4==-"HIIrM   c                X    U R                  U R                  U R                  U5      5      $ rV   )r  r  r  r  s     rN   r  ZipProvider._resource_to_zipy  s$    !!$((4+;+;]"KLLrM   )r  r  r  )r  rA   r   rs  r  )rw  r   r   r   r7  )rx  r   )rG   rH   rI   rJ   rS   r  rK   r  r  r  r  r  r   r  ry  r  r  r  r  r  r  r  r   r  r  r  rL   rO  rd  s   @rN   r   r     s    ,#F#)+N!!4ST = =9&97:9	9  4l- "E;GJM MrM   r   c                  P    \ rS rSrSrSS jrS rSS jrSS jrSS jr	SS jr
S	rg
)r   i  a  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.
c                    Xl         g rV   r!  r  s     rN   r  FileMetadata.__init__  s    	rM   c                    U R                   $ rV   r  rV  s     rN   r  FileMetadata._get_metadata_path  s    yyrM   c                l    US:H  =(       a)    [         R                  R                  U R                  5      $ )NPKG-INFO)r   r!  r  rV  s     rN   rW  FileMetadata.has_metadata  s#    z!?bggnnTYY&??rM   c                    US:w  a  [        S5      e[        U R                  SSS9 nUR                  5       nS S S 5        U R	                  W5        U$ ! , (       d  f       N!= f)Nr  z(No metadata except PKG-INFO is availabler  r7  )encodingerrors)r  r   r!  r\  _warn_on_replacement)r   rL  r  metadatas       rN   r[  FileMetadata.get_metadata  sV    :EFF$))gi@AvvxH A!!(+ A@s   A
A!c                x    SnX!;   a3  SnUR                   " S0 [        5       D6n[        R                  " U5        g g )Nu   �z2{self.path} could not be properly decoded in UTF-8rE   )r   r   r  r  )r   r  replacement_charr  r  s        rN   r  !FileMetadata._warn_on_replacement  s7     'GD++))CMM# (rM   c                6    [        U R                  U5      5      $ rV   r  rV  s     rN   r^  FileMetadata.get_metadata_lines  r  rM   r  N)r!  r&   r   rs  rj  rl  r%  rm  )rG   rH   rI   rJ   rS   r  r  rW  r[  r  r^  rL   rE   rM   rN   r   r     s&    	@4rM   r   c                  "    \ rS rSrSrSS jrSrg)r   i  aC  Metadata 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)
c                    Xl         X l        g rV   )r  r  )r   r!  r  s      rN   r  PathMetadata.__init__  s     rM   )r  r  N)r!  r   r  r   r   rs  rG   rH   rI   rJ   rS   r  rL   rE   rM   rN   r   r     s    &!rM   r   c                  "    \ rS rSrSrSS jrSrg)r   i  z Metadata provider for .egg filesc                ,   UR                   [        R                  -   U l        Xl        UR
                  (       a:  [        R                  R                  UR                   UR
                  5      U l        OUR                   U l        U R                  5         g)z-Create a metadata provider from a zipimporterN)
r  r   r+  r  r  prefixr!  r   r  r?  )r   importers     rN   r  EggMetadata.__init__  sa      ''"&&0??!ww||H,<,<hooND'//DrM   )r  r  r  N)r  rC   r   rs  r  rE   rM   rN   r   r     s
    *	rM   r   r  _distribution_findersz dict[type, _DistFinderType[Any]]c                    U[         U '   g)ah  Register `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_typedistribution_finders     rN   r   r     s     ,?-(rM   c                J    [        U 5      n[        [        U5      nU" X U5      $ )z.Yield distributions accessible via `path_item`)r
   r  r  )	path_itemonlyr  finders       rN   r   r     s&    I&H0(;F(t,,rM   c              #    #    U R                   R                  S5      (       a  g[        U 5      nUR                  S5      (       a  [        R                  XS9v   U(       a  gUR                  S5       H  n[        U5      (       aK  [        R                  R                  X5      n[        [        R                  " U5      U5      nU Sh  vN   M^  UR                  5       R                  S5      (       d  M  [        R                  R                  X5      n[        [        R                  " U5      5      nXWl        [        R!                  XU5      v   M     g N7f)z8
Find eggs in zip files; possibly multiple nested eggs.
z.whlNr  r  r  )
.dist-info	.egg-info)r  endswithr   rW  r/   from_filenamer   rD  r   r!  r   find_eggs_in_zip	zipimportzipimporterrC  r  from_location)r  r   r  r  subitemsubpathr  submetas           rN   r	  r	    s       (( 	8$HZ(((((FF,,R0  ggll96G$Y%:%:7%CWME]]_%%&ABBggll96G!)"7"7"@AG&,,YII 1 s   CE
E(E7A"Ec                    gr   rE   )r  r   r  s      rN   find_nothingr  	  s     rM   c           
   #    ^#    [        T5      m[        T5      (       a?  [        R                  T[	        T[
        R                  R                  TS5      5      S9v   gU4S j[        T5       5       n[        U5       H?  n[
        R                  R                  TU5      n[        TXB5      nU" U5       Sh  vN   MA     g N	7f)z6Yield distributions accessible on a sys.path directoryrK  r  Nc              3  b   >#    U H%  n[         R                  R                  TU5      v   M'     g 7frV   )r   r!  r   )r  childr   s     rN   r  find_on_path.<locals>.<genexpr>	  s%     S;R%rww||Iu--;Rs   ,/)_normalize_cached_is_unpacked_eggr/   r  r   r   r!  r   safe_listdirsorteddist_factory)r  r   r  r  r  fullpathfactorys    `     rN   find_on_pathr  	  s     !),I	""((!)RWW\\)Z-PQ ) 
 	
 	S<	;RSG 77<<	51y%68$$$ ! 	%s   B5C8C9
Cc                   UR                  5       nUR                  S5      nUR                  S5      =(       a<    [        R                  R	                  [        R                  R                  X5      5      nU=(       d    UnU(       a  [        $ U(       d  [        U5      (       a  [        $ U(       d  UR                  S5      (       a  [        $ [        5       $ )z*Return a dist_factory for the given entry.r  r  z	.egg-link)rC  r  r   r!  r   r   distributions_from_metadatarD  r   resolve_egg_linkNoDists)r   r  r  rC  is_egg_infois_dist_infois_metas          rN   r  r  %	  s    KKME..-K>>,/ BGGMM
Y&5L )\G  	$ U++   {33  YrM   c                  ,    \ rS rSrSrSS jrSS jrSrg)	r!  i8	  z?
>>> bool(NoDists())
False

>>> list(NoDists()('anything'))
[]
c                    gri  rE   r   s    rN   __bool__NoDists.__bool__A	  s    rM   c                    [        S5      $ r   )iter)r   r  s     rN   __call__NoDists.__call__D	  s    BxrM   rE   N)r   Literal[False])r  ri  )rG   rH   rI   rJ   rS   r'  r+  rL   rE   rM   rN   r!  r!  8	  s    rM   r!  c                     [         R                  " U 5      $ ! [        [        4 a     g[         aH  nUR
                  [
        R                  [
        R                  [
        R                  4;  a  e  SnAgSnAff = f)zA
Attempt to list contents of path, but suppress some exceptions.
NrE   )	r   rV  PermissionErrorNotADirectoryErrorr  errnoENOTDIREACCESENOENT)r!  r  s     rN   r  r  H	  sk    zz$/0     775==%,,EE Fs    A;	A;>A66A;c              #  ~  #    [         R                  R                  U 5      n[         R                  R                  U 5      (       a0  [	        [         R
                  " U 5      5      S:X  a  g [        X5      nO[        U 5      n[         R                  R                  U 5      n[        R                  UUU[        S9v   g 7f)Nr   )
precedence)r   r!  r  r   r  rV  r   r   rL  r/   r  r   )r!  rootr  r  s       rN   r  r  X	  s     77??4 D	ww}}Trzz$ A%".t":%GGT"E

$
$	 %  s   B;B=c              #     #    [        U 5      R                  5        H   nUR                  5       nU(       d  M  Uv   M"     g7f)z)
Yield non-empty lines from file at path
N)r  
splitlinesr  )r!  lines     rN   non_empty_linesr;  j	  s4      ).99;zz|4J <s
   2A	Ac                j   ^  [        T 5      nU 4S jU 5       n[        [        U5      n[        US5      $ )zU
Given a path to an .egg-link, resolve distributions
present in the referenced path.
c              3     >#    U HB  n[         R                  R                  [         R                  R                  T5      U5      v   MD     g 7frV   )r   r!  r   r  )r  refr!  s     rN   r  #resolve_egg_link.<locals>.<genexpr>z	  s4      <LSRWW__T*C00<Ls   A	ArE   )r;  r  r   rE  )r!  referenced_pathsresolved_pathsdist_groupss   `   rN   r   r   t	  s;    
 't,<LN (.9KR  rM   ImpImporter_namespace_handlerszdict[type, _NSHandlerType[Any]]_namespace_packageszdict[str | None, list[str]]c                    U[         U '   g)ar  Register `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)rD  )r  namespace_handlers     rN   r   r   	  s    " *;&rM   c                   [        U5      nUc  g UR                  U 5      nU(       a  UR                  OSnWc  g[        R                  R                  U 5      nUc<  [        R                  " U 5      =n[        R                  U '   / Ul        [        U 5        O[        US5      (       d  [!        SU 5      e[#        [$        U5      nU" X!X5      nUb?  UR                  nUR'                  U5        [(        R*                  " U 5        [-        XU5        U$ ! [         a]    [        R
                  " 5          [        R                  " S5        UR                  U 5      nSSS5         GM/  ! , (       d  f        GN?= ff = f)zEEnsure that named package includes a subpath of path_item (if needed)Nignore__path__Not a package:)r
   	find_specr  r  r  catch_warningssimplefilterfind_moduler   r  r-  types
ModuleTyperJ  _set_parent_nsr4  rI  r  rD  r  rb  import_module_rebuild_mod_path)	packageNamer   r  specr  r  handlerr  r!  s	            rN   
_handle_nsrX  	  s=    I&H/!!+. !%$~[[__[)F~,1,<,<[,II[){#VZ(((+66/:Gh;?GG,$V4N1  7$$&!!(+))+6F '&&&7s)   D E:2(E&E:&
E6	0E:6E:c                8  ^^^ [         R                   Vs/ sH  n[        U5      PM     snmU4S jmUU4S jn[        XS9nU Vs/ sH  n[        U5      PM     nn[	        UR
                  [        5      (       a  XRR
                  SS& gXRl        gs  snf s  snf )ze
Rebuild module.__path__ ensuring that all entries are ordered
corresponding to their sys.path order
c                ^   >  TR                  U 5      $ ! [         a    [        S5      s $ f = f)z
Workaround for #520 and #513.
inf)indexr   r  )r  sys_paths    rN   safe_sys_path_index._rebuild_mod_path.<locals>.safe_sys_path_index	  s0    	 >>%(( 	 <	 s    ,,c                   > U R                  [        R                  5      nTR                  S5      S-   nUSU*  nT" [	        [        R                  R                  U5      5      5      $ )zB
Return the ordinal of the path based on its position in sys.path
r   r   N)r   r   r+  countr  r   )r!  
path_partsmodule_partsr  package_namer^  s       rN   position_in_sys_path/_rebuild_mod_path.<locals>.position_in_sys_path	  sX     ZZ'
#))#.2>\M*"#4RVV[[5G#HIIrM   )rq   N)r   r!  r  r  r  rJ  r  )	orig_pathrd  r  pre  new_pathr^  r]  s    `    @@rN   rT  rT  	  s    
 /2hh7h!!$h7H J i:H.67h!!$hH7&//4((%"5 8* 8s   BBc                   SU < S3n[         R                  " U[        SS9  [        R                  " 5          U [
        ;   a   [        R                  " 5         g[        R                  nU R                  S5      u  n  nU(       a>  [        U5        U[
        ;  a  [        U5         [        R                  U   R                  n[
        R!                  U=(       d    S/ 5      R#                  U 5        [
        R!                  U / 5        U H  n[%        X5        M     [        R                  " 5         g! [         a  n[        SU5      UeSnAff = f! [        R                  " 5         f = f)z9Declare that package 'packageName' is a namespace packagez4Deprecated call to `pkg_resources.declare_namespace(z)`.
Implementing implicit namespace packages (as specified in PEP 420) is preferred to `pkg_resources.declare_namespace`. See https://setuptools.pypa.io/en/latest/references/keywords.html#keyword-namespace-packagesr*   r+   Nr   rK  )r  r  r/  _impacquire_lockrE  release_lockr   r!  
rpartitionr   r  r  rJ  r  rI  r  r  rX  )rU  r  r!  r  r3  r  r   s          rN   r   r   	  s6    ?{o N3 	3  MM#)a8--2 	/ &)XX"--c21f%006"A{{6*33 	&&v~r:AA+N&&{B7I {.  	 " A 0&9q@A 	s7   
E AE &D1 AE 1
E;EEE E'c                   [         R                  " 5          [        R                  US5       H"  n[	        X 5      nU(       d  M  [        X25        M$     [         R                  " 5         g! [         R                  " 5         f = f)zDEnsure that previously-declared namespace packages include path_itemrE   N)rk  rl  rE  r-  rX  r   rm  )r   r  packager  s       rN   r   r   
  s\    *..vr:G 4Gw(: ;
 	s   )A) A) )B c                    [         R                  R                  XR                  S5      S   5      n[	        U5      nUR
                   H  n[	        U5      U:X  d  M    g   U$ )zBCompute an ns-package subpath for a filesystem or zipfile importerr   r  N)r   r!  r   r   r  rJ  )r  r   rU  r  r  
normalizedr  s          rN   file_ns_handlerrs   
  sU     ggll9&7&7&<R&@AG"7+JT"j0  
 rM   c                    g rV   rE   )r  r   rU  r  s       rN   null_ns_handlerru  9
  s     rM   c                    g rV   rE   r  s    rN   r   r   E
  s    .1rM   c                    g rV   rE   rw  s    rN   r   r   G
  s    25rM   c           	         [         R                  R                  [         R                  R                  [         R                  R	                  [        U 5      5      5      5      $ )z1Normalize a file/dir name for comparison purposes)r   r!  normcaserealpathr  _cygwin_patchrw  s    rN   r   r   I
  s:    77BGG,,RWW-=-=mH>U-VWXXrM   c                l    [         R                  S:X  a  [        R                  R	                  U 5      $ U $ )z
Contrary to POSIX 2008, on Cygwin, getcwd (3) contains
symlink components. Using
os.path.abspath() works around this limitation. A fix in os.getcwd()
would probably better, in Cygwin even more so, except
that this seems to be by design...
cygwin)r   r   r   r!  abspathrw  s    rN   r|  r|  N
  s'     ),(@277??8$NhNrM   c                    g rV   rE   rw  s    rN   r  r  \
  s    58rM   c                    g rV   rE   rw  s    rN   r  r  ^
  r  rM   c                    g rV   rE   rw  s    rN   r  r  `
  s    CrM   c                    [        U 5      $ rV   )r   rw  s    rN   r  r  d
  s    h''rM   c                <    [        U 5      =(       d    [        U 5      $ )z/
Determine if given path appears to be an egg.
)_is_zip_eggr  r  s    rN   rD  rD  i
  s     t6 0 66rM   c                    U R                  5       R                  S5      =(       a<    [        R                  R	                  U 5      =(       a    [
        R                  " U 5      $ )N.egg)rC  r  r   r!  r  rz  
is_zipfiler  s    rN   r  r  p
  sC    

f% 	%GGNN4 	%t$rM   c                    U R                  5       R                  S5      =(       a>    [        R                  R	                  [        R                  R                  U SS5      5      $ )z8
Determine if given path appears to be an unpacked egg.
r  rK  r  )rC  r  r   r!  r  r   r  s    rN   r  r  x
  sE     ::<  ( RWW^^
T:z2. rM   c                    U R                  S5      nUR                  5       nU(       aA  SR                  U5      n[        [        R
                  U   U[        R
                  U    5        g g )Nr   )r   r  r   setattrr   r  )rU  r  rL  r  s       rN   rR  rR  
  sP    c"E99;D%F#T3;;{+CD rM   z\w+(\.\w+)*$z
    (?P<name>[^-]+) (
        -(?P<ver>[^-]+) (
            -py(?P<pyver>[^-]+) (
                -(?P<plat>.+)
            )?
        )?
    )?
    c                     \ rS rSrSr   S           SS jjrSS jrSS jr\   S       SS jj5       r	\        SS j5       r	 S       SS	 jjr	SS
 jr
  S     SS jjr\R                  " S5      r\SSS jj5       r\S 5       r\ S       SS jj5       r\ S     S S jj5       rSrg)!r   i
  z3Object representing an advertised importable objectNc                    [        U5      (       d  [        SU5      eXl        X l        [	        U5      U l        [	        U5      U l        XPl        g )NzInvalid module name)MODULEr   rL  module_nametupleattrsr  r   )r   rL  r  r  r  r   s         rN   r  EntryPoint.__init__
  sC     k""2K@@	&5\
Fm	rM   c                   U R                   < SU R                  < 3nU R                  (       a!  USSR                  U R                  5      -   -  nU R                  (       a!  USSR                  U R                  5      -  -  nU$ )Nz = :r   z [%s],)rL  r  r  r   r  )r   ss     rN   r  EntryPoint.__str__
  sa    D$4$45::sxx

+++A;;388DKK000ArM   c                    S[        U 5      -  $ )NzEntryPoint.parse(%r)r   r   s    rN   r   EntryPoint.__repr__
  s    %D	11rM   c                    g rV   rE   )r   r   r  r  s       rN   r$  EntryPoint.load
       "rM   c                    g rV   rE   r   r   rz   kwargss       rN   r$  r  
  r  rM   c                    U(       a  U(       d  U(       a  [         R                  " S[        SS9  U(       a  U R                  " U0 UD6  U R	                  5       $ )z8
Require packages for this EntryPoint, then resolve it.
zJParameters to load are deprecated.  Call .resolve and .require separately.r*   r+   )r  r  r   r   r  r  s       rN   r$  r  
  sF     $&MM'.	  LL$)&)||~rM   c                    [        U R                  S/SS9n [        R                  " [        U R
                  U5      $ ! [         a  n[        [        U5      5      UeSnAff = f)z4
Resolve the entry point from its module and attrs.
rG   r   )fromlistlevelN)	r  r  	functoolsreducer  r  r  r  r   )r   r  r  s      rN   r  EntryPoint.resolve
  sY     D,,
|1M	1##GTZZ@@ 	1c#h'S0	1s   %> 
A"AA"c                >   U R                   (       d&  U R                  (       a  [        O[        nU" SU 5      eU R                   R	                  U R                  5      n[
        R                  XAX R                  S9n[        [        [
        R                  U5      5        g )Nz&Can't require() without a distribution)r  )
r   r  r   r  r  r   r  r  r  r  )r   r  r  	error_clsr  r^   s         rN   r   EntryPoint.require
  sl    
 yy(,IDdKK yy!!$++.##Dy#MS%()rM   z]\s*(?P<name>.+?)\s*=\s*(?P<module>[\w.]+)\s*(:\s*(?P<attr>[\w.]+))?\s*(?P<extras>\[.*\])?\s*$c                
   U R                   R                  U5      nU(       d  Sn[        XA5      eUR                  5       nU R	                  US   5      nUS   (       a  US   R                  S5      OSnU " US   US   XvU5      $ )zParse 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]' formatr  attrr   rE   rL  r  )patternr   r   	groupdict_parse_extrasr   )r  srcr   r   r  resr  r  s           rN   rH  EntryPoint.parse
  s     KKc"MCS&&kkm""3x=1*-f+F!!#&23v;HudCCrM   c                    U(       d  g[         R                  SU-   5      nUR                  (       a  [        eUR                  $ )NrE   x)r2   rH  specsr   r  )r  extras_specr   s      rN   r  EntryPoint._parse_extras  s4    k 1299zzrM   c                    [        U5      (       d  [        SU5      e0 n[        U5       HH  nU R                  XS5      nUR                  U;   a  [        SXR                  5      eXdUR                  '   MJ     U$ )zParse an entry point groupzInvalid group namezDuplicate entry point)r  r   r"   rH  rL  )r  r   linesr   thisr:  eps          rN   parse_groupEntryPoint.parse_group  sl     e}}1599 "&D4&Bww$ !8%IIM	 '
 rM   c                   [        U[        5      (       a  UR                  5       nO[        U5      n0 nU HQ  u  pVUc  U(       d  M  [	        S5      eUR                  5       nXT;   a  [	        SU5      eU R                  XVU5      XE'   MS     U$ )z!Parse a map of entry point groupsz%Entry points must be listed in groupszDuplicate group name)r  r  r^   r   r   r  r  )r  datar   _datamapsr   r  s          rN   	parse_mapEntryPoint.parse_map.  s     dD!!JJLE"4(E+-!LE} !HIIKKME} !7??//%=DK " rM   )r  r   r  r  rL  )rE   rE   N)rL  r   r  r   r  Iterable[str]r  r  r   r  r   rs  r   )TNN)r   zLiteral[True]r  r  r  r!  r   r9   )r   r-  rz   r   r  r   r   r9   r$  )r   rk  rz   #Environment | _InstallerType | Noner  r  r   r9   )r   r9   )NN)r  r  r  r!  r   rs  rV   )r  r   r   r  r   r(   )r   r   r  r1   r   r  r   zdict[str, Self])r  z4str | Iterable[str] | dict[str, str | Iterable[str]]r   r  r   zdict[str, dict[str, Self]])rG   rH   rI   rJ   rS   r  r  r   r   r$  r  r   r  r  r  r&  rH  r  r  r  rL   rE   rM   rN   r   r   
  s   =  " "$(  	
  " 
 2  "&"&+/	""  " )	"
 
" " "" " 	"
 
" "  3 6	
 
,1 #'+/** )* 
	*$ jj	#G D D&   
 %)	  "	
 
 "  %)B " 
$	 rM   r   c                    S n[        X5      n[        [        U5      S5      nUR                  S5      u    pE[	        UR                  5       5      =(       d    S$ )zx
Given an iterable of lines from a Metadata file, return
the value of the Version field, if present, or None otherwise.
c                @    U R                  5       R                  S5      $ )Nzversion:)rC  r5  )r:  s    rN   is_version_line+_version_from_file.<locals>.is_version_lineM  s    zz|&&z22rM   r  r  N)rC  rE  r*  	partitionr   r  )r  r  version_linesr:  r3  r  s         rN   _version_from_filer  G  sL    3 ?2M]#R(D..%KAq&.$.rM   c                  x  ^  \ rS rSrSrSrSSSS\S\4               S.S jjr\	 S/         S0S jj5       r
S r\S 5       rS1S	 jrS2S
 jrS2S jrS2S jrS2S jrS3S jrS3S jr\S 5       r\S 5       r\S 5       r\S 5       r\S 5       r\    S4S j5       rS rS5S6S jjrS rS rS r S7S8S jjr!S r"S9S jr#S9S jr$S:S jr%U 4S  jr&\	 S/       S;S! jj5       r'S" r(S<S# jr)\*S/S=S$ jj5       r+\*S>S% j5       r+S/S?S& jjr+S@S' jr,  S7     SAS( jjr-S) r.SBS* jr/SCS+ jr0\S, 5       r1S-r2U =r3$ )Dr/   iV  z5Wrap an actual or potential sys.path entry w/metadatar  Nc                    [        U=(       d    S5      U l        Ub  [        U5      U l        XPl        X`l        Xl        Xpl        U=(       d    [        U l	        g )NUnknown)
r   r  r   _versionr9  r   r  r6  r   	_provider)r   r  r  r  r%  r9  r   r6  s           rN   r  Distribution.__init__[  sH     &l&?i@(1DM$  $!3^rM   c                @   S /S-  u  pVpx[         R                  R                  U5      u  p)U	R                  5       [        ;   a@  [        U	R                  5          n [        U5      n
U
(       a  U
R                  SSSS5      u  pVpxU " UU4UUUUS.UD6R                  5       $ )Nr1  rL  verpyverr   )r  r%  r9  r   )r   r!  splitextrC  _distributionImplEGG_NAMEr   _reload_version)r  r  rL  r  kwr  r%  r9  r   extr   s              rN   r  Distribution.from_locationn  s     8<fqj3z((299;++#CIIK0CX&E>CkkE7F?;z 
 &!
 
 /
	rM   c                    U $ rV   rE   r   s    rN   r  Distribution._reload_version  s    rM   c                    U R                   U R                  U R                  U R                  U R                  =(       d    SU R
                  =(       d    S4$ )Nr  )_forgiving_parsed_versionr6  rq   r  r9  r   r   s    rN   rH  Distribution.hashcmp  sD     **OOHHMMOO!rMMR
 	
rM   c                ,    [        U R                  5      $ rV   )hashrH  r   s    rN   __hash__Distribution.__hash__  s    DLL!!rM   c                4    U R                   UR                   :  $ rV   rH  r   r_  s     rN   __lt__Distribution.__lt__      ||emm++rM   c                4    U R                   UR                   :*  $ rV   r  r  s     rN   __le__Distribution.__le__      ||u}},,rM   c                4    U R                   UR                   :  $ rV   r  r  s     rN   __gt__Distribution.__gt__  r  rM   c                4    U R                   UR                   :  $ rV   r  r  s     rN   __ge__Distribution.__ge__  r  rM   c                j    [        XR                  5      (       d  gU R                  UR                  :H  $ ri  )r  r   rH  r  s     rN   __eq__Distribution.__eq__  s'    %00||u}},,rM   c                    X:X  + $ rV   rE   r  s     rN   __ne__Distribution.__ne__        rM   c                     U R                   $ ! [         a&    U R                  R                  5       =U l         nUs $ f = frV   )_keyr  r  rC  r\  s     rN   rq   Distribution.key  s@    	99 	"//5577DIJ	s    ->>c                   [        U S5      (       d'   [        U R                  5      U l        U R                  $ U R                  $ ! [        R                  R
                   af  nSU R                   S3n[        US5      (       a  UR                  U5        e [        R                  R                  [        U5       SU 35      S eS nAff = f)N_parsed_versionz
(package: )add_noter2  )	r4  r   r%  r  r  r  r  r  r   )r   exinfos      rN   parsed_versionDistribution.parsed_version  s    t.//V'4T\\'B$ ###t### $$33 V#D$5$5#6a82z**KK%''66#b'!D67JKQUUVs   A C	#A!CC	c           
         U R                   $ ! [        R                  R                   a  n[	        [        U R                  5      5      U l        SR                  [        US/ 5      5      nS[        U5       SU SU R                   SU R                   S3	n[        R                  " U[        5        U R                  s S nA$ S nAff = f)Nr
  	__notes__zg!!


            *************************************************************************
            zl

            This is a long overdue deprecation.
            For the time being, `pkg_resources` will use `z`
            as a replacement to avoid breaking existing environments,
            but no future compatibility is guaranteed.

            If you maintain package z you should implement
            the relevant changes to adequate the project to PEP 440 immediately.
            *************************************************************************
            

!!
            )r  r  r%  r  r   r  r  r   r  r   r  r  r  r/  )r   r  notesr  s       rN   r  &Distribution._forgiving_parsed_version  s    	(&&&  // 	(#01CDLL1Q#RD IIgb+r:;EWIRw ; <@;O;O:P Q% &*%6%6$7 8C MM#12''')	(s    CBC=CCc                     U R                   $ ! [         ab  nU R                  5       nUcC  U R                  U R                  5      nSR                  U R                  U5      n[        X@5      UeUs S nA$ S nAff = f)Nz4Missing 'Version:' header and/or {} file at path: {})r  r  _get_version_get_metadata_path_for_displayPKG_INFOr   r   )r   r  r%  r!  r  s        rN   r%  Distribution.version  su    	==  		'')G::4==IMUUMM4 !+2N		s    
A:AA5/A:5A:c                     U R                   $ ! [         a2    U R                  U R                  5       5      U l          U R                   $ f = f)zf
A map of extra to its list of (direct) requirements
for this distribution, including the null extra.
)_Distribution__dep_mapr  _filter_extras_build_dep_mapr   s    rN   _dep_mapDistribution._dep_map  sH    	H>>! 	H!001D1D1FGDN~~	Hs    .A
	A
c                ^   [        [        SU 5      5       H  nUnU R                  U5      nUR                  S5      u  p$nU=(       a"    [	        U5      =(       d    [        U5      (       + nU(       a  / n[        U5      =(       d    SnU R                  U/ 5      R                  U5        M     U $ )z
Given a mapping of extras to dependencies, strip off
environment markers and filter out any dependencies
not matching the markers.
Nr  )	r  rC  r  r  r   r   r   r  r  )dmr*  	new_extrar  r3  r,  fails_markers          rN   r  Distribution._filter_extras  s     &r*+E$)I66%=D#(??3#7 I&! v&Eof.E*E  "9-5IMM)R(//5 , 	rM   c                    0 nS HP  n[        U R                  U5      5       H/  u  p4UR                  U/ 5      R                  [	        U5      5        M1     MR     U$ )N)zrequires.txtzdepends.txt)r   _get_metadatar  r  r   )r   r  rL  r*  r  s        rN   r  Distribution._build_dep_map  sT    1D-d.@.@.FGeR(//0B40HI  H 2 	rM   c                    U R                   n/ nUR                  UR                  SS5      5        U H!  n UR                  U[        U5         5        M#     U$ ! [         a  n[        U < SU< 35      UeSnAff = f)z@List of Requirements needed for this distro if `extras` are usedNrE   z has no such extra feature )r  r  r-  r   r  r   )r   r  r  depsr  r  s         rN   r  Distribution.requires  s|    ]]"$BFF4$%CBz#/0  	  "9=sCs   A
A;#A66A;c                ^     U R                   R                  U5      nU$ ! [         a     gf = f)z;
Return the path to the given metadata file, if available.
z[could not detect])r  r  r  r  s      rN   r  +Distribution._get_metadata_path_for_display+  s8    		( >>44T:D   	('	(s    
,,c              #  p   #    U R                  U5      (       a  U R                  U5       S h  vN   g g  N7frV   )rW  r^  rV  s     rN   r  Distribution._get_metadata<  s2     T""..t444 #4s   +646c                N    U R                  U R                  5      n[        U5      $ rV   )r  r  r  )r   r  s     rN   r  Distribution._get_version@  s!    ""4==1!%((rM   c                (   Uc  [         R                  nU R                  XS9  U[         R                  L a]  U R                  bO  [	        U R                  5        U R                  S5       H$  nU[         R                  ;   d  M  [        U5        M&     ggg)z>Ensure distribution is importable on `path` (default=sys.path)Nr  namespace_packages.txt)r   r!  r  r  r   r  r  r   )r   r!  r7  pkgs       rN   activateDistribution.activateD  sr    <88Dt-388 9$T]]3))*BC#++%%c* D !:rM   c                    [        U R                  5      < S[        U R                  5      < SU R                  =(       d    [        < 3nU R
                  (       a  USU R
                  -   -  nU$ )z@Return what this distribution's standard .egg filename should ber   z-py)r   r  r%  r9  rj  r   )r   r  s     rN   r  Distribution.egg_nameO  sU     ))*%OO'x'
 ==dmm++HrM   c                b    U R                   (       a  U < SU R                   < S3$ [        U 5      $ )Nz (r  )r  r   r   s    rN   r   Distribution.__repr__[  s"    == $dmm44t9rM   c                ~     [        U SS 5      nU=(       d    SnU R                  < SU< 3$ ! [         a    S n N,f = f)Nr%  z[unknown version]r2  )r  r   r  )r   r%  s     rN   r  Distribution.__str__a  sI    	dIt4G 00++W55  	G	s   - <<c                p    UR                  S5      (       a  [        U5      e[        U R                  U5      $ )zADelegate all unrecognized public attributes to .metadata providerr3  )r5  r  r  r  )r   r  s     rN   __getattr__Distribution.__getattr__i  s-    ??3 &&t~~t,,rM   c                   > [        [        [        TU ]  5       5      [        S U R                  R                  5        5       5      -  5      $ )Nc              3  R   #    U H  oR                  S 5      (       a  M  Uv   M      g7fr3  N)r5  )r  r  s     rN   r  'Distribution.__dir__.<locals>.<genexpr>r  s     X#;4??SVCW$$#;s   '	')r  r  r>  __dir__r  )r   r   s    rN   r:  Distribution.__dir__o  s@    !"X4>>#9#9#;XXY
 	
rM   c                x    U R                   " [        U5      [        R                  R	                  U5      U40 UD6$ rV   )r  r  r   r!  rL  )r  r  r  r  s       rN   r  Distribution.from_filenameu  s:       h')9)9()CX
QS
 	
rM   c                   [        U R                  [        R                  R                  5      (       a  U R
                  < SU R                  < 3nOU R
                  < SU R                  < 3n[        R                  U5      $ )z?Return a ``Requirement`` that matches this distribution exactlyz==z===)r  r  r  r%  r  r  r2   rH  )r   rV  s     rN   r   Distribution.as_requirement  s^    d))9+<+<+D+DEE#00$2E2EFD $ 1 143F3FGD  &&rM   c                l    U R                  X5      nUc  [        SX4< S35      eUR                  5       $ )z=Return the `name` entry point of `group` or raise ImportErrorzEntry point z
 not found)r   r  r$  )r   r   rL  r  s       rN   r   Distribution.load_entry_point  s3      -:UMKLLwwyrM   c                    g rV   rE   r   r   s     rN   r   Distribution.get_entry_map  s    UXrM   c                    g rV   rE   rC  s     rN   r   rD    s    BErM   c                    [        U S5      (       d*  [        R                  U R                  S5      U 5      U l        Ub  U R                  R                  U0 5      $ U R                  $ )rQ  _ep_mapzentry_points.txt)r4  r   r  r  rG  r-  rC  s     rN   r   rD    s[    tY''%//""#56DL <<##E2..||rM   c                B    U R                  U5      R                  U5      $ rS  )r   r-  r  s      rN   r   Distribution.get_entry_info  s    !!%(,,T22rM   c                   U=(       d    U R                   nU(       d  g[        U5      n[        R                  R	                  U5      nU Vs/ sH  of=(       a    [        U5      =(       d    UPM!     nn[        U5       H  u  phX:X  a  U(       a    O  gX:X  d  M  U R                  [        :X  d  M2  U(       d
  XGUS ;   a    gU[        R                  L a  U R                  5         UR                  Xb5        UR                  Xd5          OQ   U[        R                  L a  U R                  5         U(       a  UR                  SU5        gUR                  U5        g  UR                  XFS-   5      n	Xy	 X	 U	nM  s  snf ! [         a     gf = f)ad  Ensure 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.
Nr   r   )r  r  r   r!  r  	enumerater6  r   r   check_version_conflictr  r  r\  r   )
r   r!  locr7  nlocbdirrh  npathr  nps
             rN   r  Distribution.insert_on  sb   2 "T]] %wwt$<@ADq,)!,11DA 'GA| $//X"=  T12Y%6388#//1A#Q%# (& sxx++-As#  C  [[1u- Itx = BB   	s   %E7E< <
F	F	c           
     2   U R                   S:X  a  g [        R                  U R                  S5      5      n[	        U R
                  5      nU R                  S5       H  nU[        R                  ;  d  X1;   d
  U[        ;   a  M(  US;   a  M0  [        [        R                  U   SS 5      nU(       aA  [	        U5      R                  U5      (       d   UR                  U R
                  5      (       a  M  [        SU< SU< SU R
                  < S	35        M     g )
Nr   r)  ztop_level.txt)pkg_resourcesr   siter  zModule z was already imported from z, but z is being added to sys.path)rq   r  r  r  r   r  r   r  rE  r  r5  r.  )r   nsprM  modnamefns        rN   rL  #Distribution.check_version_conflict  s    88|#mmD../GHIT]]+))/:Gs{{*>11AAW-z4@Br"--c22bmmDMM6R6R")2t}}> ;rM   c                     U R                     g! [         a    [        S[        U 5      -   5         g[         a     gf = f)NzUnbuilt egg for FT)r%  r   r.  r   SystemErrorr   s    rN   rJ  Distribution.has_version  sD    	LL   	,tDz9: 		s    !>	>>c           	         SnUR                  5        H  nUR                  U[        XS5      5        M!     UR                  SU R                  5        U R                  " S0 UD6$ )z@Copy this distribution, substituting in any changed keyword argsz<project_name version py_version platform location precedenceNr  rE   )r   r  r  r  r   )r   r  r  r  s       rN   cloneDistribution.clone  sP    NKKMDMM$D 9: "
j$..1~~###rM   c                T    U R                    Vs/ sH  o(       d  M  UPM     sn$ s  snf rV   )r  )r   deps     rN   r  Distribution.extras  s     #}}4}}444s   	%%)	__dep_maprG  r  r  r  r  r  r   r6  r  r9  )r  r  r  r8   r  r  r%  r  r9  r  r   r  r6  r8  r   rs  rV   )
r  r   rL  r&   r  r8   r  r8  r   r/   r   r8  )r_  r/   r   rk  r_  ri  r   rk  )r  #dict[str | None, list[Requirement]]r   rf  r  )r  r  r   zlist[Requirement]ri  )r!  r  r7  rk  r   rs  r   )r  r   )r  r&   r  r8   r  r8  r   r/   )r   r   rL  r   r   r9   )r   rs  r    dict[str, dict[str, EntryPoint]])r   r   r   dict[str, EntryPoint])r   r  )r   r   rL  r   r   EntryPoint | None)r!  rp  r7  rk  r   rs  r7  )r  z$str | int | IResourceProvider | Noner   r(   )4rG   rH   rI   rJ   rS   r  rj  r   r  r&  r  r  r   rH  r  r  r  r  r  r  r  rq   r  r  r%  r  r  r  r  r  r  r  r  r+  r  r   r  r4  r:  r  r   r   r   r   r   r  rL  rJ  r^  r  rL   rO  rd  s   @rN   r/   r/   V  s{   ?H  $"&#'"!)#"44  4 !	4
 4 4 4 4 
4& 
 #'	   	
  
 6 
 
",-,--!   $ $ ( (2   	 	 /	, ,"5)	+
6-
  #'

  
 	

 

 
' X XE E3 	GG 	G
 
GR4	$ 5 5rM   c                      \ rS rSrS rSrg)EggInfoDistributioni  c                @    U R                  5       nU(       a  Xl        U $ )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   
md_versions     rN   r  #EggInfoDistribution._reload_version   s     &&(
&MrM   )r  N)rG   rH   rI   rJ   r  rL   rE   rM   rN   rk  rk    s    rM   rk  c                  j    \ rS rSrSrSr\R                  " S5      r\	S 5       r
\	S 5       rS
S jrSrg	)DistInfoDistributioni2  zJ
Wrap an actual or potential sys.path entry
w/metadata, .dist-info style.
METADATAz([\(,])\s*(\d.*?)\s*([,\)])c                     U R                   $ ! [         a\    U R                  U R                  5      n[        R
                  R                  5       R                  U5      U l         U R                   s $ f = f)zParse and cache metadata)	_pkg_infor  r[  r  emailparserParserparsestr)r   r  s     rN   _parsed_pkg_info%DistInfoDistribution._parsed_pkg_info;  s]    	">>! 	"((7H"\\002;;HEDN>>!	"s    A#A43A4c                ~     U R                   $ ! [         a$    U R                  5       U l         U R                   s $ f = frV   )_DistInfoDistribution__dep_mapr  _compute_dependenciesr   s    rN   r  DistInfoDistribution._dep_mapE  s:    	">>! 	"!779DN>>!	"s    +<<c                L  ^ S/ 0U l         / mU R                  R                  S5      =(       d    /  H  nTR                  [	        U5      5        M     U4S jn[
        R                  " [        R                  U" S5      5      5      nU R                   S   R                  U5        U R                  R                  S5      =(       d    /  HH  n[        UR                  5       5      nU" U5       Vs/ sH  ofU;  d  M
  UPM     snU R                   U'   MJ     U R                   $ s  snf )z+Recompute this distribution's dependencies.NzRequires-Distc              3     >#    T H<  nUR                   (       a$  UR                   R                  SU 05      (       d  M8  Uv   M>     g 7f)Nr*  r+  )r*  r   r  s     rN   reqs_for_extraBDistInfoDistribution._compute_dependencies.<locals>.reqs_for_extraV  s5     zzSZZ%8%8'59I%J%JI s
   7A	AzProvides-Extra)r{  rx  get_allr  r   rP  MappingProxyTyper  r  r   r  )r   r   r  commonr*  s_extrarr  s          @rN   r|  *DistInfoDistribution._compute_dependenciesM  s    ?CRj"$((00AGRGCKK*3/0 H	
 ''nT6J(KLt##F+**223CDJJE /G)%0'0aVO0'DNN7# K ~~	's   /D!;D!)rc  rs  N)r   rf  )rG   rH   rI   rJ   rS   r  r  r  EQEQr   rx  r  r|  rL   rE   rM   rN   rp  rp  2  sH    
 H::45D" " " "rM   rp  )r  r  r  c                    Sn[        5       n [        R                  " U5      R                  UL a*  US-  n[        R                  " U5      R                  UL a  M*  [
        R                  " U SUS-   0UD6  g ! [         a     N(f = f)Nr   r,   )r]   r   r  r  r   r  r  )rz   r  r  ra   s       rN   r.  r.  n  s~    E	A mmE",,1QJE mmE",,1 MM4UQY44  s   AA7 7
BBc                b    [        [        [        [        [        [	        U 5      5      5      5      $ )z
Yield ``Requirement`` objects for each specification in `strs`.

`strs` must be a string, or a (possibly-nested) iterable thereof.
)r  r2   r!   r    r"   )strss    rN   r   r   {  s#     {-c,D@Q.RSTTrM   c                      \ rS rSrSrSrg)RequirementParseErrori  z,Compatibility wrapper for InvalidRequirementrE   NrR   rE   rM   rN   r  r    s    2rM   r  c                     ^  \ rS rSr% S\S'   SU 4S jjrSS jrSS jr    SS jrSS jr	SS	 jr
\SS
 j5       rSrU =r$ )r2   i  ztuple[str, ...]r  c                h  > [         TU ]  U5        U R                  U l        [	        U R                  5      nX"R                  5       sU l        U l        U R                   Vs/ sH  o3R                  UR                  4PM     snU l        [        [        [        U R                  5      5      U l        U R                  U R                   U R                  [#        U R                  5      U R$                  (       a  ['        U R$                  5      OS4U l        [+        U R(                  5      U l        gs  snf )z>DO NOT CALL THIS UNDOCUMENTED METHOD; use Requirement.parse()!N)r>  r  rL  unsafe_namer   rC  r  rq   	specifierrK  r%  r  r  r  r   r  url	frozensetr,  r   hashCmpr  _Requirement__hash)r   requirement_stringr  rV  r   s       rN   r  Requirement.__init__  s    +,99 +&24F4F4H#48@DO}}dll3O
C
DKK89HHHHNNdkk" $C
 4<<( Ps   ! D/c                b    [        U[        5      =(       a    U R                  UR                  :H  $ rV   )r  r2   r  r  s     rN   r  Requirement.__eq__  s!    %-O$,,%--2OOrM   c                    X:X  + $ rV   rE   r  s     rN   r  Requirement.__ne__  r  rM   c                    [        U[        5      (       a(  UR                  U R                  :w  a  gUR                  nOUnU R                  R                  USS9$ )NFT)prereleases)r  r/   rq   r%  r  contains)r   r  r%  s      rN   r  Requirement.__contains__  sV     dL))xx488#llGG
 ~~&& ' 
 	
rM   c                    U R                   $ rV   )r  r   s    rN   r  Requirement.__hash__  s    {{rM   c                    S[        U 5      -  $ )NzRequirement.parse(%r)r  r   s    rN   r   Requirement.__repr__  s    &T22rM   c                     [        U 5      u  nU$ rV   )r   )r  r   s     rN   rH  Requirement.parse  s    #A&
rM   )__hashr  r  rq   r  r  r  )r  r   r   rs  re  )r  z3Distribution | packaging.specifiers.UnparsedVersionr   rk  rd  r   )r  zstr | Iterable[str]r   r2   )rG   rH   rI   rJ   rK   r  r  r  r  r  r   r  rH  rL   rO  rd  s   @rN   r2   r2     sN     )"P!
G
	
&3  rM   c                .    [         U ;  a
  U [         4-   $ U $ )z>
Ensure object appears in the mro even
for old-style classes.
)ri  )classess    rN   _always_objectr    s    
 W&""NrM   c                    [        [        R                  " [        US[	        U5      5      5      5      nU H  nX0;   d  M
  X   s  $    [        SU  SU 35      e)z2Return an adapter factory for `ob` from `registry`r   zCould not find adapter for z and )r  inspectgetmror  rd  rI  )registryrr   rP  ts       rN   r  r    sT    7>>'"k48*LMNE=; 
 1(5E
FFrM   c                l    [         R                  R                  U 5      n[         R                  " USS9  g)z1Ensure that the parent directory of `path` existsT)exist_okN)r   r!  r  makedirs)r!  r  s     rN   r   r     s"    ggood#GKK$'rM   c                    [         (       d  [        S5      e[        U 5      u  pU(       a2  U(       a*  [        U5      (       d  [	        U5         [        US5        gggg! [         a     gf = f)z/Sandbox-bypassing version of ensure_directory()z*"os.mkdir" not supported on this platform.i  N)r  r  r   r   r  r   FileExistsError)r!  r  r  s      rN   r  r    s`    =BCCdG8E'NN )	'5! %38w  		s   A 
A+*A+c              #  (  #    Sn/ n[        U 5       Hv  nUR                  S5      (       aL  UR                  S5      (       a*  U(       d  U(       a  X4v   USS R                  5       n/ nMY  [	        SU5      eUR                  U5        Mx     X4v   g7f)a_  Split 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[]r   r  zInvalid section heading)r"   r5  r  r  r   r  )r  sectioncontentr:  s       rN   r   r     s      GGA??3}}S!!g!**q***, !:DAANN4   
s   BBc                     [         R                  n [        [         l        [        R                  " U 0 UD6U[         l        $ ! U[         l        f = frV   )r   r   os_opentempfilemkstemp)rz   r  old_opens      rN   r  r    s;    wwH,, (s   $A ArI  )categoryr  c                      \ rS rSrSrSrg)r   i  z
Base class for warning about deprecations in ``pkg_resources``

This class is not derived from ``DeprecationWarning``, and as such is
visible by default.
rE   NrR   rE   rM   rN   r   r     s    rM   r   )r   
   localec                P    [        U SSS9 nUR                  5       sSSS5        $ ! , (       d  f       g= f! [         ac    SU < SU< SU < S3n[        R                  " U[
        S	S
9  [        U SUS9 nUR                  5       sSSS5        s $ ! , (       d  f        g= ff = f)z5See setuptools.unicode_utils._read_utf8_with_fallbackr  r  )r  Nz        ********************************************************************************
        `encoding="utf-8"` fails with z, trying `encoding=z`.

        This fallback behaviour is considered **deprecated** and future versions of
        `setuptools/pkg_resources` may not implement it.

        Please encode a   with "utf-8" to ensure future builds will succeed.

        If this file was produced by `setuptools` itself, cleaning up the cached files
        and re-building/re-installing the package with a newer version of `setuptools`
        (e.g. by updating `build-system.requires` in its `pyproject.toml`)
        might solve the problem.
        ********************************************************************************
        r*   r+   )r   r\  r  r  r  r   )filefallback_encodingr  r  s       rN   r  r  %  s    $g.!668 /.. ''+h.ABSAV W
 h 	" 	c9aH$&78A668 9888's;   8 '	8 
58 8 >B%6B
B%
B!	B%!B%c                    U " U0 UD6  U $ rV   rE   )r  rz   r  s      rN   _call_asider  B  s    tvHrM   c                l   ^ [        5       mTU S'   U R                  U4S j[        T5       5       5        g)z=Set up global resource manager (deliberately not state-saved)_managerc              3  n   >#    U H+  nUR                  S 5      (       a  M  U[        TU5      4v   M-     g7fr8  )r5  r  )r  rL  rw  s     rN   r  _initialize.<locals>.<genexpr>L  s2       Ds# 	'ww%& s   55N)r   ro   r  )ra   rw  s    @rN   _initializer  G  s3     GAjMHH L rM   c                    [        SS[        R                  5       5      n U R                  nU R                  nU R
                  nU R                  nUn[        S U  5       5        U" S SS9  / U l        [        [        U R                  [        R                  5      5        [        5       R                  [!        5       5        g)a%  
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.
ri  r   c              3  <   #    U H  oR                  S S9v   M     g7f)Fr  Nr+  )r  r   s     rN   r  1_initialize_master_working_set.<locals>.<genexpr>l  s     	?;4---
&;s   c                     U R                  SS9$ )NTr  r  rE  s    rN   r{   0_initialize_master_working_set.<locals>.<lambda>n  s    T]]4]0rM   F)r  N)rZ   r   r  r   r   r  r   r  r  r  r  r  r   r!  r]   ro   r   )r   r   r   r   r   r   s         rN   _initialize_master_working_setr  S  s     !=*:R:R:TUK!!G#55)33''JH
 
	?;	??0 K[""CHH	-.IVXrM   )rW   r   rX   r   rY   r-   r   r-   )r   rr  )r`   rr  r   rr  r%  )r
  ztype[_ModuleLike]r  r<   r   rs  )r  r   r   r7   )r  r2   r   r/   )r  zstr | Requirementr   z IResourceProvider | Distribution)r=  r  r>  r  r   rk  )r   r.   r   r.   )r   r5   r   r/   )r   zDistribution | _PkgReqTyper   r/   )r   r6   r   r   rL  r   r   r9   rV   )r   r6   r   rs  r   rg  )r   r6   r   r   r   rh  )r   r6   r   r  )r   r6   r   r   rL  r   r   ri  r   rl  )r%  r   r   r   )r*  r   r   r   )r  r   r   zSyntaxError | Literal[False])r  r   r*  r  r   rk  )r  type[_T]r  z_DistFinderType[_T]r   rs  rh  )r   r   r  rk  r   zIterable[Distribution])r  rC   r   r   r  rk  r   r  )r  object | Noner   r  r  zbool | None)r  r  )r!  r%   )r!  r   )r  r  rG  z_NSHandlerType[_T]r   rs  )r  types.ModuleTyper   rs  )rU  r   r   rs  )r   r   r  r  r   rs  )r  ri  r   r&   rU  r   r  r  )
r  ri  r   r  rU  r  r  z_ModuleLike | Noner   rs  )r  r&   r   r   )r  r$   r   r  )r  r%   r   zstr | bytes)r  r%   )r  r1   r   zmap[Requirement])r  zMapping[type, _AdapterT]rr   ri  r   r?   )r!  r%   r   rs  )r  r1   r   z&Iterator[tuple[str | None, list[str]]])r  r   r   r   (  rS   
__future__r   r   version_infoRuntimeErrorrk  r  email.parserrt  r1  r  rb  importlib.abcimportlib.machineryr  r  r-  rK  r   pkgutilr   r#  r*  r  r  r  r  r  rP  r  rz  r
  collections.abcr   r   r   r	   r
   typingr   r   r   r   r   r   r   r   r   r   r   r!  r  r   r  r  vendor_pathr  r  r   r  r   os.pathr   r   r   r   r   r  r  packaging.markersr  packaging.requirementspackaging.specifierspackaging.utilspackaging.versionjaraco.textr    r!   r"   platformdirsr#   r  	_typeshedr$   r%   r&   _typeshed.importlibr'   typing_extensionsr(   r)   r  r/  r-   r.   r   r1   rK   r3   r4   r5   r6   r8   r9   r:   ri  rQ  r;   r<   rk  r=   r>   r?   rA   r  Ir  RuntimeWarningrP   r%  r  r   rT   rZ   rd   rg   rl   rs   ru   rw   
_sget_none
_sset_noner   __all__r  r   r   r   r   r   r  majorminorrj  r   r   r   r   r   r   r   r  r   r/  r   r   r<  r   r   r   r   r   r   r   r7   r   r  r  r  r   r   r   r   r   r   r   r  r  r   r   r   r   r   r;  r   r   rg  r   r   rt  r  r   r  r   r   r   r  r   r   r	  r  r  r  r!  r  r  r;  r   r4  rC  rc  
FileFinderrD  rE  r   rX  rT  r   r   rs  ru  r   r|  r  rD  r  r  rR  r   r  VERBOSE
IGNORECASEr  r   r  r/   rk  rp  r  r.  r   r  InvalidRequirementr  r2   r  r  r   r  r   r  filterwarningsWarningr   _LOCALE_ENCODINGr  r  r]   r  r  __resource_managerr   r   r   r   r   r   r   r   r   r   r   r  r   r   r   rE   rM   rN   <module>r     s&  & # 
f
8
99          	   	     	         H H      bggoobggooh>W.XZfhq!rr+{~  |D  |D  D  IT  HU  U  V T " &  ((M
      D D :<<21 B	 T])@c8E#x7M2M,N#OOP
I P"*M?<L+L"M i M$m_e<P6Q%QR	 RsM12Y 2~{:;Y ; !:;y ;!$ Y $   vu'7'778Y 8"*C52E+E"F i F%r3ox7O&OP P$b#sE4D4D%EuSRVYGW%WX	 X%';^C=P	
&x & ::MrttT N  !!)) ^  

 - ,
Z0Sl9i 90o 0D
 
? :I? I FH B G$$%Qs'7'7'='=&>?	8"	86J	8		8 
 < 
 <	 ? 
 ?
> 
 
N2 ZZ ;< jj!CD !.b 
 A 
 A	 < 
 <@
 
%)+
+"+%+ 
+ 
 N 
 N7
>
 :%)8 %Pj& j&Z
mU38_45 
&~ ~D % )l )(} }@X/	6"2@9"$L
 L
^ V\ *&, (2k 2@    L $ 4@@A 8#< #.iM+ iMX Y**K 8&4= &4R!? !2+  ;I
#R; 7 
	?	?2E	?		?- CHJ#J03J;?JJ8 	%%'7 8 IN(2:E  %%(&   $
! 7M""G''6 	##.. =7E
!28 4  4B
!24 0 
;;0B;	;("J#D(V	  	$ 7M""w22OD 900/ B 9..99? K  	
 
 6? 3 
 1 
 1	 5 
 5Y
O  8 8< <G __( (7E 
O	$	*	*:: JJ % 	l l^/F5 F5R, &2< 2l $& 
5U3I22EE 38)((44 8vG(
4 	  = FW   #//7:8  ;K  :
 )      F (*(88O'66N*<<(88O(88O)::,@@*<<,K!!G#55)33''JH# Mq  Ms   "e" "e.-e.