python (3.11.7)

(root)/
lib/
python3.11/
site-packages/
setuptools/
__pycache__/
discovery.cpython-311.pyc

*e?Q	dZddlZddlZddlmZddlmZddlmZddlm	Z	m
Z
mZmZm
Z
mZmZmZmZmZddlZddlmZddlmZeeejfZe
egefZe
eZejj Z!e	rdd	l"m#Z#d
edefdZ$Gd
dZ%Gdde%Z&Gdde&Z'Gdde%Z(Gdde'Z)Gdde(Z*dededeefdZ+GddZ,deedeefdZ-deedeefd Z.deed!eeefd"edeefd#Z/d$ed!eeefd"edefd%Z0deed&edeeeffd'Z1dS)(u_Automatic discovery of Python modules and packages (for inclusion in the
distribution) and other config values.

For the purposes of this module, the following nomenclature is used:

- "src-layout": a directory representing a Python project that contains a "src"
  folder. Everything under the "src" folder is meant to be included in the
  distribution when packaging the project. Example::

    .
    ├── tox.ini
    ├── pyproject.toml
    └── src/
        └── mypkg/
            ├── __init__.py
            ├── mymodule.py
            └── my_data_file.txt

- "flat-layout": a Python project that does not use "src-layout" but instead
  have a directory under the project root for each package::

    .
    ├── tox.ini
    ├── pyproject.toml
    └── mypkg/
        ├── __init__.py
        ├── mymodule.py
        └── my_data_file.txt

- "single-module": a project that contains a single Python script direct under
  the project root (no directory used)::

    .
    ├── tox.ini
    ├── pyproject.toml
    └── mymodule.py

Nfnmatchcase)glob)Path)

TYPE_CHECKINGCallableDictIterableIteratorListMappingOptionalTupleUnion)log)convert_path)Distributionpathreturncdtj|SN)osrbasenameisidentifier)rs V/BuggyBox/python/3.11.7/bootstrap/lib/python3.11/site-packages/setuptools/discovery.py_valid_namerIs$
7D!!..000ceZdZUdZdZeedfed<dZeedfed<e				dde
d	eed
eedeefdZ
e	de
d	ed
edefd
ZededefdZdS)_Finderz@Base class that exposes functionality for module/package finders.ALWAYS_EXCLUDEDEFAULT_EXCLUDE.*whereexcludeincluderc	|p|j}t|tt	||jg|j|R|j|S)aFReturn a list of all Python items (packages or modules, depending on
        the finder implementation) found within directory 'where'.

        'where' is the root directory which will be searched.
        It should be supplied as a "cross-platform" (i.e. URL-style) path;
        it will be converted to the appropriate local path syntax.

        'exclude' is a sequence of names to exclude; '*' can be used
        as a wildcard in the names.
        When finding packages, 'foo.*' will exclude all subpackages of 'foo'
        (but not 'foo' itself).

        'include' is a sequence of names to include.
        If it's specified, only the named items will be included.
        If it's not specified, all found items will be included.
        'include' can contain shell style wildcard patterns just like
        'exclude'.
        )r"list
_find_iterrstr
_build_filterr!clsr&r'r(s    rfindz_Finder.findTsp40S0NNSZZ((!!@3#5@@@@!!7+



	
rctr)NotImplementedErrorr.s    rr+z_Finder._find_iterws!!rpatternscfdS)z
        Given a list of patterns, return a callable that will be true only if
        the input matches at least one of the patterns.
        c<tfdDS)Nc38K|]}t|VdSrr).0patnames  r	<genexpr>z:_Finder._build_filter.<locals>.<lambda>.<locals>.<genexpr>s-KK3D# 6 6KKKKKKr)any)r9r3s`r<lambda>z'_Finder._build_filter.<locals>.<lambda>s%CKKKK(KKKKKrr )r3s`rr-z_Finder._build_filter{sLKKKKrN)r#r r$)__name__
__module____qualname____doc__r!rr,__annotations__r"classmethod_Pathr
rr0_FilterStrIterr+staticmethodr-r rrrrNsJJ&(NE#s(O(((')OU38_)))!#!'	 
 
 
# 
#	 


c 
 
 
[ 
D"u"w""W"""["LLLLL\LLLrrc	beZdZdZdZededededefdZ	e
ded	edefd
Z
dS)
PackageFinderzI
    Generate a list of all Python packages found within a directory
    )ez_setupz*__pycache__r&r'r(rc#Ktjt|dD]\}}}|dd}g|dd<|D]}tj||}	tj|	|}
|
tjjd}d|vs||	|s||r||s|V|	|dS)zy
        All the packages found in 'where' that pass the 'include' filter, but
        not the 'exclude' filter.
        T)followlinksNr#)
rwalkr,rjoinrelpathreplacesep_looks_like_packageappend)r/r&r'r(rootdirsfilesall_dirsdir	full_pathrel_pathpackages            rr+zPackageFinder._find_iters"$U!F!F!F	!	!D$AAAwHDG
!
!GLLs33	7??9e<<"**27;<<#::S%<%<Y%P%P:77##"GGG,<,<"!MMMC    
!	!	!rr
_package_namec|tjtj|dS)z%Does a directory look like a package?__init__.py)rrisfilerM)rr[s  rrQz!PackageFinder._looks_like_packages(w~~bgll4??@@@rN)r=r>r?r@r!rBrCrDrEr+rFr,boolrQr rrrHrHs2N!u!w!!W!!![!6A%AAAAA\AAArrHc2eZdZedededefdZdS)PEP420PackageFinder_pathr[rcdS)NTr )rbr[s  rrQz'PEP420PackageFinder._looks_like_packagestrN)r=r>r?rFrCr,r_rQr rrrarasG5\rrac	PeZdZdZededededefdZe	e
ZdS)ModuleFinderzYFind isolated Python modules.
    This function will **not** recurse subdirectories.
    r&r'r(rc#HKttj|dD]q}tjtj|\}}||sW||r||s|VrdS)Nz*.py)rrrrMsplitextr_looks_like_module)r/r&r'r(filemodule_exts       rr+zModuleFinder._find_iterseV4455		D7++BG,<,<T,B,BCCLFD))&11
wv
wwv
		rN)r=r>r?r@rBrCrDrEr+rFrrhr rrrereshuwW[&k22rrecteZdZdZeedeDZ	edede	de
fdZdS)FlatLayoutPackageFinder) cibindocdocs
documentationmanpagesnews	changelogtesttests	unit_test
unit_testsexampleexamplesscriptstoolsutilutilspythonbuilddistvenvenvrequirementstasksfabfile
site_scons	benchmark
benchmarksexercise	exercises[._]*c#$K|]}||dfVdS)z.*Nr )r7ps  rr:z!FlatLayoutPackageFinder.<genexpr>s,&G&Ga888}&G&G&G&G&G&Grrbpackage_namerc|d}|dp|dd}|o td|ddDS)Nr#r-stubsc3>K|]}|VdSr)r)r7r9s  rr:z>FlatLayoutPackageFinder._looks_like_package.<locals>.<genexpr>s.(S(S):):)<)<(S(S(S(S(S(Sr)splitrendswithall)rbrnamesroot_pkg_is_valids    rrQz+FlatLayoutPackageFinder._looks_like_packagesl""3''!!H1133RuQx7H7H7R7R SS(S(Sqrr(S(S(S%S%SSrN)r=r>r?_EXCLUDEtuple
chain_iterr"rFrCr,r_rQr rrrmrms$HLeJJ&G&Gh&G&G&GGGHHO T5TTTTT\TTTrrmceZdZdZdS)FlatLayoutModuleFinder)setupconftestrvrwrzr{rtoxfilenoxfilepavementdodorrz[Ss][Cc]onstruct	conanfilemanagerrrrrN)r=r>r?r"r rrrrsO4*)rrroot_pkgpkg_dirc\t|}gfd|DzS)Nc>g|]}d|fS)r#)rM)r7nrs  r
<listcomp>z)_find_packages_within.<locals>.<listcomp>s)AAAQ8Q-00AAAr)rar0)rrnesteds`  r_find_packages_withinrs8
 
%
%g
.
.F:AAAA&AAAAArc$eZdZdZddZdZdZedefdZ	ede
eeffd	ZddZ
d
edefdZd
edefdZdefdZdefdZdefdZdefdZdefdZdeedefdZdZdeefdZdeefdZdS)ConfigDiscoveryzFill-in metadata and options that can be automatically derived
    (from other metadata/options, the file system or conventions)
    distributionrc>||_d|_d|_d|_dS)NF)r_called	_disabled_skip_ext_modules)selfrs  r__init__zConfigDiscovery.__init__$s% 	!&rcd|_dS)z+Internal API to disable automatic discoveryTN)rrs r_disablezConfigDiscovery._disable*s
rcd|_dS)aInternal API to disregard ext_modules.

        Normally auto-discovery would not be triggered if ``ext_modules`` are set
        (this is done for backward compatibility with existing packages relying on
        ``setup.py`` or ``setup.cfg``). However, ``setuptools`` can call this function
        to ignore given ``ext_modules`` and proceed with the auto-discovery if
        ``packages`` and ``py_modules`` are not given (e.g. when using pyproject.toml
        metadata).
        TN)rrs r_ignore_ext_modulesz#ConfigDiscovery._ignore_ext_modules.s"&rrc2|jjptjSr)rsrc_rootrcurdirrs r	_root_dirzConfigDiscovery._root_dir:sy!.RY.rc6|jjiS|jjSr)rpackage_dirrs r_package_dirzConfigDiscovery._package_dir?s9 (Iy$$rFTc|dur|js|jrdS|||r|d|_dS)aAutomatically discover missing configuration fields
        and modifies the given ``distribution`` object in-place.

        Note that by default this will only have an effect the first time the
        ``ConfigDiscovery`` object is called.

        To repeatedly invoke automatic discovery (e.g. when the project
        directory changes), please use ``force=True`` (or create a new
        ``ConfigDiscovery`` instance).
        FNT)rr_analyse_package_layoutanalyse_name)rforcer9ignore_ext_moduless    r__call__zConfigDiscovery.__call__EsXE>>t|>t~>F$$%7888	 rrc|p|j}|jjdup|}|jjdup0|jjdup"|p t|jdo|jjS)zF``True`` if the user has specified some form of package/module listingN
configuration)rrext_modulespackages
py_moduleshasattrr)rrrs   r_explicitly_specifiedz%ConfigDiscovery._explicitly_specifiedZsw/I43I90D8N<NOId*
Oy#4/
O
Oty/22Nty7N		
rc||rdStjd|p'|p|S)NTzLNo `packages` or `py_modules` configuration, performing automatic discovery.)rrdebug_analyse_explicit_layout_analyse_src_layout_analyse_flat_layout)rrs  rrz'ConfigDiscovery._analyse_package_layoutfsy%%&899	4	
#	
	
	

))++
+''))
+((**		
rcx|j}|dd|j|sdSt	jd|t
fd|D}t||j	_
t	jd|j	j
dS)zAThe user can explicitly give a package layout via ``package_dir``NFz(`explicit-layout` detected -- analysing c3zK|]5\}}t|tj|V6dSr)rrrrM)r7pkg
parent_dirroot_dirs   rr:z;ConfigDiscovery._analyse_explicit_layout.<locals>.<genexpr>sU

Z
"#rw||Hj'I'IJJ





rdiscovered packages -- T)rcopypoprrrritemsr*rr)rrpkgsrs   @rrz(ConfigDiscovery._analyse_explicit_layoutxs',,..D!!!>	5	J[JJKKK



#.#4#4#6#6




"$ZZ		@DI,>@@AAAtrc|j}tj|j|dd}tj|sdStjd||	dtj
|||j_t||j_t ||j_tjd|jjtjd|jjdS)aTry to find all packages or modules under the ``src`` directory
        (or anything pointed by ``package_dir[""]``).

        The "src-layout" is relatively safe for automatic discovery.
        We assume that everything within is meant to be included in the
        distribution.

        If ``package_dir[""]`` is not given, but the ``src`` directory exists,
        this function will set ``package_dir[""] = "src"``.
        rsrcFz#`src-layout` detected -- analysing rdiscovered py_modules -- T)rrrrMrgetisdirrr
setdefaultrrrrar0rrer)rrsrc_dirs   rrz#ConfigDiscovery._analyse_src_layouts'',,t~{r5/I/IJJw}}W%%	5	AAABBBr27#3#3G#<#<=== +	055g>>	+0099		@DI,>@@AAA	Ddi.BDDEEEtrctjd|j|p|S)aTry to find all packages and modules under the project root.

        Since the ``flat-layout`` is more dangerous in terms of accidentally including
        extra files/directories, this function is more conservative and will raise an
        error if multiple packages or modules are found.

        This assumes that multi-package dists are uncommon and refuse to support that
        use case in order to be able to prevent unintended errors.
        z$`flat-layout` detected -- analysing )rrr_analyse_flat_packages_analyse_flat_modulesrs rrz$ConfigDiscovery._analyse_flat_layoutsB		IIIJJJ**,,L0J0J0L0LLrc,t|j|j_tt
|jj}tjd|jj|	|dt|S)Nrr)rmr0rrrremove_nested_packagesremove_stubsrr_ensure_no_accidental_inclusionr_)r	top_levels  rrz&ConfigDiscovery._analyse_flat_packagessv499$.II	*<	8J+K+KLL		@DI,>@@AAA,,Y
CCCIrct|j|j_tjd|jj||jjdt|jjS)Nrmodules)	rr0rrrrrrr_rs rrz%ConfigDiscovery._analyse_flat_modulessh5::4>JJ		Ddi.BDDEEE,,TY-A9MMMDI()))rdetectedkindct|dkr,ddlm}ddlm}d|d|d|d}|||dS)	Nrr)cleandoc)PackageDiscoveryErrorzMultiple top-level z discovered in a flat-layout: z.

            To avoid accidental inclusion of unwanted files or directories,
            setuptools will not proceed with this build.

            If you are trying to create a single distribution with multiple a
            on purpose, you should not rely on automatic discovery.
            Instead, consider the following options:

            1. set up custom discovery (`find` directive with `include` or `exclude`)
            2. use a `src-layout`
            3. explicitly set `py_modules` or `packages` with a list of names

            To find more information, look for "package discovery" on setuptools docs.
            )leninspectrsetuptools.errorsr)rrrrrmsgs      rrz/ConfigDiscovery._ensure_no_accidental_inclusionsx==1((((((??????$h
NRC('

666)rc|jjjs|jjrdStjd|p|}|r||jj_dSdS)zThe packages/modules are the essential contribution of the author.
        Therefore the name of the distribution can be derived from them.
        Nz7No `name` configuration, performing automatic discovery)rmetadatar9rr#_find_name_single_package_or_module_find_name_from_packages)rr9s  rrzConfigDiscovery.analyse_names9"	din	4	KLLL
4466
/,,..	
	+&*DI###	+	+rcdD]V}t|j|dpg}|r:t|dkr'tjd|d|dcSWdS)zExactly one module or package)rrNrz&Single module/package detected, name: r)getattrrrrr)rfieldrs   rrz3ConfigDiscovery._find_name_single_package_or_moduleso/	 	 EDIud339rE
 Uq	M58MMNNNQxtrc"|jjsdStt|jjt}|jjpi}t
|||j}|rtj	d||Stj
ddS)z<Try to find the root package that is not a PEP 420 namespaceNkeyz&Common parent package detected, name: z7No parent package detected, impossible to derive `name`)rrrsortedrrfind_parent_packagerrrwarn)rrr
parent_pkgs    rrz(ConfigDiscovery._find_name_from_packagessy!	4ty'9s C C CDDi+1r(;OO
	IKzKKLLLJKKKtrN)rr)FTF)r=r>r?r@rrrpropertyrCrr	r,rrr_rrrrrrrrrrrrrr rrrrs''''
&
&
&/5///X/%d38n%%%X%
*












$
4



$$$T2MdMMMM*t****7S	77777.+++"Xc](3-rrrct|t}|dd}t|}tt|D];\}t	fd|Dr|||z
dz
<|S)zRemove nested packages from a list of packages.

    >>> remove_nested_packages(["a", "a.b1", "a.b2", "a.b1.c1"])
    ['a']
    >>> remove_nested_packages(["a", "b", "c.d", "c.d.e.f", "g.h", "a.a1"])
    ['a', 'b', 'c.d', 'g.h']
    rNc3HK|]}|dVdSr#N
startswith)r7otherr9s  rr:z)remove_nested_packages.<locals>.<genexpr>s5CCt%{{{++CCCCCCrr)rr	enumeratereversedr;r)rrrsizeir9s     @rrrs($$$DQQQIt99DXd^^,,((4CCCCCCCCC	(MM$(Q,'''rcd|DS)zRemove type stubs (:pep:`561`) from a list of packages.

    >>> remove_stubs(["a", "a.b", "a-stubs", "a-stubs.b.c", "b", "c-stubs"])
    ['a', 'a.b', 'b']
    cng|]2}|ddd0|3S)r#rr)rr)r7rs  rrz remove_stubs.<locals>.<listcomp>s:PPPC399S>>!+<+E+Eh+O+OPCPPPrr )rs rrrsQP8PPPPrrrct|t}g}t|D]B\}tfd||dzdDsn|C|D]Vt||}tj|d}tj	|rcSWdS)z0Find the parent package that is not a namespace.rc3HK|]}|dVdSrr
)r7rr9s  rr:z&find_parent_package.<locals>.<genexpr>"s5DD1<<4


++DDDDDDrrNr])
rrrrrRfind_package_pathrrrMr^)rrrcommon_ancestorsrpkg_pathinitr9s       @rrrshC(((HX&&&&4DDDDXacdd^DDDDD	

E%%%% $T;AAw||Hm44
7>>$	KKK	4rr9c|d}tt|ddD]M}d|d|}||vr*||}t	jj||g||dRcSN|dpd}t	jj|g|d|RS)aGiven a package name, return the path where it should be found on
    disk, considering the ``package_dir`` option.

    >>> path = find_package_path("my.pkg", {"": "root/is/nested"}, ".")
    >>> path.replace(os.sep, "/")
    './root/is/nested/my/pkg'

    >>> path = find_package_path("my.pkg", {"my": "root/is/nested"}, ".")
    >>> path.replace(os.sep, "/")
    './root/is/nested/pkg'

    >>> path = find_package_path("my.pkg", {"my.pkg": "root/is/nested"}, ".")
    >>> path.replace(os.sep, "/")
    './root/is/nested'

    >>> path = find_package_path("other.pkg", {"my.pkg": "root/is/nested"}, ".")
    >>> path.replace(os.sep, "/")
    './other/pkg'
    r#rNr/)rrangerrMrrr)r9rrpartsrpartial_nameparents       rrr3s,
JJsOOE
3u::q"
%
%>>xxbqb	**;&& .F7<&=59======'__R
 
 
&BF
7<=6<<#4#4=u====rpackage_pathcft|}t|jfd|DS)Nc	ji|]/}|dg|d0S)rr#)rMr)r7rprefixs  r
<dictcomp>z)construct_package_dir.<locals>.<dictcomp>Xs<MMM#C4F4SYYs^^455MMMr)rrr )rr#parent_pkgsr&s   @rconstruct_package_dirr)Us:(22K
,


%FMMMMMMMMr)2r@	itertoolsrfnmatchrrpathlibrtypingrrr	r
rrr
rrr_distutils_hack.override_distutils_hack	distutilsrdistutils.utilrr,PathLikerCr_rDrEchain
from_iterabler
setuptoolsrrrrHrarermrrrrrrrr)r rr<module>r6s%%N				 ''''''
c2;
C5$;

3-
_
*
(''''''1e11111
3L3L3L3L3L3L3L3Ll&A&A&A&A&AG&A&A&AR-333337333./T/T/T/T/T1/T/T/Td*****\***<BCB%BDIBBBB
^^^^^^^^BT#Y49$Q49QcQQQQ3i&-c3h&7CH
c]0>

>#CH->9>>>>>>DNDINUNtCQTH~NNNNNNr