Files
INTUIA/Programa final/myenv/Lib/site-packages/setuptools/__pycache__/discovery.cpython-311.pyc
T

258 lines
30 KiB
Plaintext
Raw Normal View History

2026-03-15 13:27:50 +00:00
§
,M!g?Qã óÒdZddlZddlZddlmZddlmZddlmZddlm Z m
Z
m Z m Z m
Z
mZmZmZmZmZddlZddlmZddlmZeeejfZe
egefZe
eZejj Z!e rdd l"m#Z#d
ed efd Z$Gd
d¦«Z%Gdde%¦«Z&Gdde&¦«Z'Gdde%¦«Z(Gdde'¦«Z)Gdde(¦«Z*deded eefdZ+Gdd¦«Z,deed eefdZ-deed eefd „Z.deed!eeefd"ed eefd#„Z/d$ed!eeefd"ed efd%„Z0deed&ed e eeffd'„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
éÚ fnmatchcase)Úglob)ÚPath)
Ú
TYPE_CHECKINGÚCallableÚDictÚIterableÚIteratorÚListÚMappingÚOptionalÚTupleÚUnion)Úlog)Ú convert_path)Ú DistributionÚpathÚreturncódtj |¦« ¦«S©N)ÚosrÚbasenameÚ isidentifier)rs õuC:\Users\garci\OneDrive\Ãrea de Trabalho\Programa PJM\Programa final\myenv\Lib\site-packages\setuptools/discovery.pyÚ _valid_namerIs$å
Œ7× Ò ˜DÑ c óìeZdZUdZdZeedfed<dZeedfed<e dde
d e ed
e ed e efd ¦«Z
e de
d ed
ed efd
¦«Zeded efd¦«ZdS)Ú_Finderz@Base class that exposes functionality for module/package finders©ALWAYS_EXCLUDEÚDEFAULT_EXCLUDEúÚwhereÚexcludeÚincluderc óÄ|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_iterrÚstrÚ
_build_filterr!©Úclsr&r'r(s rÚfindz _Finder.findTspð4Ð0˜SÔÝØ NŠNÝ™ZœZÑ!Ô@ 3Ô#5Ð@¸Ð!Ô! 
ô
ñ
ô
ð
rcótr)ÚNotImplementedErrorr.s rr+z_Finder._find_iterwså!rÚpatternscóˆfdS)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ó<tˆfdD¦«¦«S)Nc3ó8K|]}t|¦«VŒdSrr)Ú.0ÚpatÚnames €rú <genexpr>z:_Finder._build_filter.<locals>.<lambda>.<locals>.<genexpr>s-øèèÐK¸3¥ ¨D°#Ñ 6Ô 6ÐKr)Úany)r9r3s`€rú<lambda>z'_Finder._build_filter.<locals>.<lambda>s%øø€KÀ(ÐK€rr )r3s`rr-z_Finder._build_filter{sø€ð LÐKrN)r#r r$)Ú__name__Ú
__module__Ú __qualname__Ú__doc__r!rr,Ú__annotations__r"Ú classmethodÚ_Pathr
r r0Ú_FilterÚStrIterr+Ú staticmethodr-r rrrrNsØJà&(€NE˜#˜s˜(”OÐ(Ø')€OU˜3 ˜8”_ÐðØ!#Ø!'ð 
ð 
àð 
ð˜#”ð 
ð˜#”ð 
ð
ˆð 
ð 
ð 
ñ„[ð 
ðDð"˜"¨wðð"ÈWð„[ððL ðL¨ðLðLðLñ„\ðLðLðLrrc óbeZdZdZdZededededefd¦«Z e
ded e de fd
¦«Z
d S) Ú
PackageFinderzI
Generate a list of all Python packages found within a directory
)Úez_setupz *__pycache__r&r'r(rc#óèKtjt|¦«d¬¦«D]Ë\}}}|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#)
rÚwalkr,rÚjoinÚrelpathÚreplaceÚsepÚ_looks_like_packageÚappend) r/r&r'r(ÚrootÚdirsÚfilesÚall_dirsÚdirÚ full_pathÚrel_pathÚpackages rr+zPackageFinder._find_itersèèõ "$¤­¨U©¬ÀÐ!FÑ!FÔ!Fð ˆDà˜A˜A˜A”wˆH؈D‰Gàð

!ÝœGŸLšL¨¨sÑ3 Ýœ7Ÿ?š?¨9°eÑ<Ø"×*­2¬7¬;¸Ñ<ð˜#:: S×%<Ò%<¸Ñ%PÔ%Pð7˜"¨G¨G°GÑ,<Ô,<ð!MM ˜CÑ Ô Ð Ð ð
 !rrÚ
_package_namecó|tj tj |d¦«¦«S)z%Does a directory look like a package?ú __init__.py)rrÚisfilerM)rr[s rrQz!PackageFinder._looks_like_package§s(õŒw~Š~bœgŸlšl¨4°Ñ@rN)r=r>r?r@r!rBrCrDrEr+rFr,ÚboolrQr rrrHrHsððð2€Nàð!˜uð!¨wðð!ÈWð„[ð!ð6ðA %ðA¸ðAÀðAðAðAñ„\ðAðAðArrHcó2eZdZedededefd¦«ZdS)ÚPEP420PackageFinderÚ_pathr[rcódS)NTr )rbr[s rrQz'PEP420PackageFinder._looks_like_package®sàˆtrN)r=r>r?rFrCr,r_rQr rrrara­sGØð 5ð¸ðÀðððñ„\ðððrrac óPeZdZdZededededefd¦«Ze e
¦«Z dS)Ú ModuleFinderzYFind isolated Python modules.
This function will **not** recurse subdirectories.
r&r'r(rc#óHKttj |d¦«¦«D]q}tj tj |¦«¦«\}}| |¦«sŒW||¦«r||¦«s|VŒrdS)Nz*.py)rrrrMÚsplitextrÚ_looks_like_module)r/r&r'r(ÚfileÚmoduleÚ_exts rr+zModuleFinder._find_iter¸èè土š e¨VÑ ð ˆœ7×+­B¬G×,<Ò,<¸TÑ,BÔ,BÑC‰LˆF×)¨&Ñ
Øàˆwv‰Œð
 w w¨v¡¤ð
Ø øð ð rN) r=r>r?r@rBrCrDrEr+rFrrhr rrrere³shðððð˜uð¨wðÀðÈWðððñ„[ðð&˜ ÐÐrrecóteZdZdZeedeD¦«¦«¦«Z edede de
fd¦«Z dS)ÚFlatLayoutPackageFinder) ÚciÚbinÚdocÚdocsÚ
documentationÚmanpagesÚnewsÚ changelogÚtestÚtestsÚ unit_testÚ
unit_testsÚexampleÚexamplesÚscriptsÚtoolsÚutilÚutilsÚpythonÚbuildÚdistÚvenvÚenvÚ requirementsÚtasksÚfabfileÚ
site_sconsÚ benchmarkÚ
benchmarksÚexerciseÚ exercisesú[._]*c#ó$K|] }||dfVŒ dS)z.*Nr )r7Úps rr:z!FlatLayoutPackageFinder.<genexpr>ñs,èèÐ&GÐ&G¸¨¨a¨8¨8¨8 }Ð&GÐ&GÐ&GÐ&GÐ&GÐ&GrrbÚ package_namercóÜ| d¦«}|d ¦«p|d d¦«}|o td|ddD¦«¦«S)Nr#rú-stubsc3ó>K|]}| ¦«VŒdSr)r)r7r9s rr:z>FlatLayoutPackageFinder._looks_like_package.<locals>.<genexpr>ùs.èèÐ(SÐ(SÀ¨×):Ò):Ñ)<Ô)<Ð(SÐ(SÐ(SÐ(SÐ(SÐ(Sré)ÚsplitrÚendswithÚall)rbrÚnamesÚroot_pkg_is_valids rrQz+FlatLayoutPackageFinder._looks_like_packageôslà×" 'ˆà! !œH×R°u¸Q´x×7HÒ7HÈÑ7RÔ7RÐØ ÐS¥SÐ(SÐ(SÈÈqÈrÈrÌÐ(SÑ(SÔ(SÑ%SÔ%SÐSrN) r=r>r?Ú_EXCLUDEÚtupleÚ
chain_iterr"rFrCr,r_rQr rrrmrmÊs…ð$€HðLe˜J˜JÐ&GÐ&G¸hÐ&GÑ&GÔ&GÑH€OØ àðT 5ðT¸ðTÀðTðTðTñ„\ðTðTðTrrmcóeZdZdZdS)ÚFlatLayoutModuleFinder)ÚsetupÚconftestrvrwrzr{rÚtoxfileÚnoxfileÚpavementÚdodor†r‡z[Ss][Cc]onstructÚ conanfileÚmanager‰rrN)r=r>r?r"r rrüsð€Oð4)rÚroot_pkgÚpkg_dircó\t |¦«}gˆfd|D¦«zS)Ncó>g|]}d |f¦«ŒS)r#)rM)r7Únr§s €rú
<listcomp>z)_find_packages_within.<locals>.<listcomp>s)ø€ÐA°Q˜Ÿš 8¨Q Ar)rar0)Únesteds` rÚ_find_packages_withinr®s8ø€Ý
×
% 
.€FØ ˆA¸ Arcó$eZdZdZddZdZdZedefd¦«Z ede
e e ffd „¦«Z dd Z
d
edefdZd
edefdZdefdZdefdZdefdZdefdZdefdZdee de fdZdZdee fdZdee fdZdS)ÚConfigDiscoveryz…Fill-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)Úselfr±s rÚ__init__zConfigDiscovery.__init__$s%Ø ˆŒ ؈Œ ؈ŒØ!&ˆÔÐÐrcód|_dS)z+Internal API to disable automatic discoveryTN)r´©s rÚ_disablezConfigDiscovery._disable*s
àˆŒˆˆrcód|_dS)Internal 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)s rÚ_ignore_ext_modulesz#ConfigDiscovery._ignore_ext_modules.sð"&ˆÔÐÐrrcó2|jjp tjSr)rÚsrc_rootrÚcurdirr¹s rÚ _root_dirzConfigDiscovery._root_dir:sðŒyÔ.¥R¤YÐ.rcó6|jjiS|jjSr)rÚ package_dirr¹s rÚ _package_dirzConfigDiscovery._package_dir?sà Œ9Ô Ð ˆIØŒyÔ$rFTcó’|dur|js|jrdS| |¦«|r| ¦«d|_dS)Automatically 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)r´Ú_analyse_package_layoutÚ analyse_name)Úforcer9Úignore_ext_moduless rÚ__call__zConfigDiscovery.__call__EsXð Eˆ>ˆ>˜tœ|ˆ>¨t¬~ˆ ˆ ×$Ð%7Ñ ð Ø × Ò Ñ Ô Ð àˆŒ ˆ ˆ rcó´|p|j}|jjdup| }|jjdup0|jjdup"|p t |jd¦«o |jjS)zF``True`` if the user has specified some form of package/module listingNÚ
configuration)rÚ ext_modulesÚpackagesÚ
py_modulesÚhasattrrË)s rÚ_explicitly_specifiedz%ConfigDiscovery._explicitly_specifiedZswàI°4Ô3IÐØœ9Ô0°DÐNÐ<NÐOˆ à ŒIÔ   
OØŒyÔ#¨4Ð
Oàð
Oõt”y N°t´yÔ7Nð 
rcóÐ| |¦«rdStjd¦«| ¦«p'| ¦«p| ¦«S)NTzLNo `packages` or `py_modules` configuration, performing automatic discovery.)rÚdebugÚ_analyse_explicit_layoutÚ_analyse_src_layoutÚ_analyse_flat_layout)s rz'ConfigDiscovery._analyse_package_layoutfsyØ × %Ð&8Ñ  ð Œ ð

ô
ð
ð
× 
×
×
rcóx|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 c3ózK|]5\}}t|tj |¦«¦«VŒ6dSr)rrrM)r7ÚpkgÚ
parent_dirÚroot_dirs €rr:z;ConfigDiscovery._analyse_explicit_layout.<locals>.<genexpr>sUøèèð
ð
á
" #¥r¤w§|¢|°H¸jÑ'IÔ'IÑ 
ð
ð
ð
ð
ð
rúdiscovered packages -- T) ÚcopyÚpoprÀrÚitemsr*r)ÚpkgsrÛs @rz(ConfigDiscovery._analyse_explicit_layoutxø€àÔ ØŠ˜˜DÑ”>ˆàð Ø Œ ÐJ¸[Ðð
ð
ð
ð
à#.×#4Ò#4Ñ#6Ô#6ð
ñ
ô
ñ
ô
ˆõ" $™ZœZˆŒ ÔÝ Œ Ð@¨D¬IÔ,>Јtrcóˆ|j}tj |j| dd¦«¦«}tj |¦«sdStjd|¦«|  dtj 
|¦«¦«||j _ t |¦«|j _t  |¦«|j _tjd|j j¦«tjd|j j¦«dS)Try 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"``.
r×ÚsrcFz#`src-layout` detected -- analysing rÜúdiscovered py_modules -- T)rrrMÚgetÚisdirrÚ
setdefaultrrrar0re)Úsrc_dirs rz#ConfigDiscovery._analyse_src_layoutŠsðÔ'ˆ Ý”'—,,˜tœ~¨{¯ª¸rÀ5Ñ/IÔ/IÑÝŒw}Š}˜WÑ Ø Œ ÐÐ×Ò˜r¥2¤7×#3Ò#3°GÑ#<Ô#<Ñ=Ø +ˆŒ ÔÝ0×5°gÑ>ˆŒ ÔÝ+×ÑŒ ÔÝ Œ Ð@¨D¬IÔ,>Ð Œ ÐD¨d¬iÔ.BЈtrcóŠtjd|j¦«| ¦«p| ¦«S)Try 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 )rÚ_analyse_flat_packagesÚ_analyse_flat_modulesr¹s rz$ConfigDiscovery._analyse_flat_layout£sBõ Œ мÐ××0JÒ0JÑ0LÔ0LÐLrcó,t |j¦«|j_t t
|jj¦«¦«}tjd|jj¦«|  |d¦«t|¦«S)NrÜ) rmr0rÚremove_nested_packagesÚ remove_stubsrÚ_ensure_no_accidental_inclusionr_)Ú top_levels rz&ConfigDiscovery._analyse_flat_packages°svÝ4×9¸$¼.ÑŒ ÔÝ*­<¸¼ Ô8JÑ+KÔ+KÑLˆ Ý Œ Ð@¨D¬IÔ,>Ð ×,¨Y¸
ÑI‰ŒÐrcót |j¦«|j_t jd|jj¦«| |jjd¦«t|jj¦«S)NrãÚmodules) ržr0rrr_s rz%ConfigDiscovery._analyse_flat_modules·shÝ5×:¸4¼>ÑŒ ÔÝ Œ ÐD¨d¬iÔ.BÐ ×,¨T¬YÔ-AÀ9ÑD”IÔ)rÚdetectedÚkindcó„t|¦«dkr,ddlm}ddlm}d|d|d|d}|||¦«¦«dS) Nr”r)Ú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.
)ÚlenÚinspectrõÚsetuptools.errorsrö)Úmsgs rz/ConfigDiscovery._ensure_no_accidental_inclusion½sÝ ˆx‰=Œ=˜1Ò Ð Ø ¨$ððÈhððð
NRð ððˆC𨰩
¬
Ñ 6ð) Ð rcóæ|jjjs |jjrdStjd¦«| ¦«p| ¦«}|r||jj_dSdS)z”The 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)rÚmetadatar9rÚ#_find_name_single_package_or_moduleÚ_find_name_from_packages)r9s rzConfigDiscovery.analyse_nameÔs†ð Œ9Ô Ô   d¤i¤nð à Œ Ð
× 
×
ð ð +Ø&*ˆDŒIÔ Ô  +rcó¸dD]V}t|j|d¦«pg}|r:t|¦«dkr'tjd|d¦«|dcSŒWdS)zExactly one module or package)Nr”z&Single module/package detected, name: r)Úgetattrrr)Úfieldrßs rz3ConfigDiscovery._find_name_single_package_or_moduleåsoà ð ˆEݘDœI u¨dÑ9°rˆEØð
˜U™œ qš˜Ý” ÐMÀ5ÈÄ8ИQ”xøàˆtrcó"|jjsdStt|jjt¬¦«¦«}|jjpi}t
|||j¦«}|rtj d|¦«|Stj
d¦«dS)z<Try to find the root package that is not a PEP 420 namespaceN©Úkeyz&Common parent package detected, name: z7No parent package detected, impossible to derive `name`) rÚsortedr÷Úfind_parent_packagerÀrÚwarn)Ú
parent_pkgs rz(ConfigDiscovery._find_name_from_packagesïsàŒyÔ Ø¥ t¤yÔ'9½sÐ CÑ CÔ CÑØ”iÔ1¨rˆ å°;ÀÄÑ
Ø ð Ý ŒIÐK¸zÐ Ð å ŒÐˆtrN)r)FTF)r=r>r?r@ÚpropertyrCr r,r_r rr rrððð ððð


ð/˜„Xðð%˜d 3¨ 8œnð„Xð
ðððð*

¸ð

Àð

ð

ð

ð

ð
¸
À4ð
ð
ð