Files
952-11/env/python/dll/Python312/Lib/__pycache__/pkgutil.cpython-312.pyc
T

211 lines
20 KiB
Plaintext
Raw Normal View History

2024-08-19 17:05:14 +08:00
Ë
*åfzIãó�—dZddlmZddlmZddlZddlZddlZddl Z ddl
Z ddl Z ddl m
Z
ddlZgd¢Zedd«Zd e_d
„Zdd „Zdd „Zedd
„«Zdd„Zej-ej.j0e« ddlZddlmZdd„Zej-ee«d„Zdd„Zd„Zd„Z d„Z!d„Z"da#d„Z$y#e$rYŒ wxYw)zUtilities to support packages.é)Ú
namedtuple)ÚsingledispatchN)Ú
ModuleType)
Ú get_importerÚiter_importersÚ
get_loaderÚ find_loaderÚ
walk_packagesÚ iter_modulesÚget_dataÚ read_codeÚ extend_pathÚ
ModuleInforzmodule_finder name ispkgz.A namedtuple with minimal info about a module.có¬—ddl}|jd«}|tjjk7ry|jd«|j |«S)Nréé )ÚmarshalÚreadÚ importlibÚutilÚ MAGIC_NUMBERÚload)ÚstreamrÚmagics úCC:\Users\RCi\AppData\Local\Programs\Python\Python312\Lib\pkgutil.pyr
r
sC€óà �K‰K˜‹N€EØ ” —‘×+Ñ+Ò+Øà
‡K�K�„OØ �<‰<˜Ó Ðóc#óæK—ifd„}t||«D]�}|–—|jsŒ t|j«t t
j |jdd«xsg}|D�cgc]
}||«rŒ |‘Œ}}t||jdz|«Ed{–—†Œ‘ycc}w7Œ #t$r|�||j«YŒ¹t$r|�||j«n‚YŒÙwxYw­w)a«Yields ModuleInfo for all modules recursively
on path, or, if path is None, all accessible modules.
'path' should be either None or a list of paths to look for
modules in.
'prefix' is a string to output on the front of every module name
on output.
Note that this function must import all *packages* (NOT all
modules!) on the given path, in order to access the __path__
attribute to find submodules.
'onerror' is a function which gets called with one argument (the
name of the package which was being imported) if any exception
occurs while trying to import a package. If no onerror function is
supplied, ImportErrors are caught and ignored, while all other
exceptions are propagated, terminating the search.
Examples:
# list all modules python can access
walk_packages()
# list all submodules of ctypes
walk_packages(ctypes.__path__, ctypes.__name__+'.')
có—||vryd||<y)NT©)ÚpÚms rÚseenzwalk_packages.<locals>.seenDs€Ø �‰6ØØˆˆ!ŠrÚ__path__Nú.)
r ÚispkgÚ
__import__ÚnameÚgetattrÚsysÚmodulesr
Ú ImportErrorÚ Exception)ÚpathÚprefixÚonerrorr"Úinfor s rr
r
'sìèø€ð:óô
˜T 6Ó*òGˆØŠ
à �:‹:ð
Gܘ4Ÿ9™9Ô%ôœsŸ{™{¨4¯9©9Ñ5°zÀ4ÓHÒNÈB�ð$(Ö7˜a©t°A­wšÐ7�Ð7ä(¨¨t¯y©y¸©}¸gÓF×FÑFñ)Gùò$8àFùôò
'ØÐ&Ù˜DŸI™IÔ&ùÜò
ØÐ&Ù˜DŸI™IÕ&àñ'ð
üsQ‚%C1©B.¾0C1Á.
B'Á<B'ÂC1ÂB,Â
C1Â.C.Ã C1Ã
C.Ã+C1Ã-C.Ã.C1c#óèK—|€ t«}n+t|t«r td«‚t t
|«}i}|D]/}t
||«D]\}}||vsŒ d||<t|||«–—Œ Œ1y­w)aYields ModuleInfo for all submodules on path,
or, if path is None, all top-level modules on sys.path.
'path' should be either None or a list of paths to look for
modules in.
'prefix' is a string to output on the front of every module name
on output.
Nz9path must be None or list of paths to look for modules iné)rÚ
isinstanceÚstrÚ
ValueErrorÚmaprÚiter_importer_modulesr)r-r.Ú importersÚyieldedÚir'r%s rr r `s�èø€ð €|Ü"Ó$‰ Ü �Dœ#Ô Üð%ó&ð &ôœ  dÓ+ˆ à€GØ
ò1ˆÜ0°°FÓ;ò 1‰KˆD�%ؘ7Ò"Ø !�˜‘
Ü   D¨%Ó0Ó0ñ 1ñ1ùs ‚AA2ÁA2có@—t|d«sgS|j|«S)Nr )Úhasattrr )Úimporterr.s rr7r7zs"€ä �8˜^Ô ,؈ Ø × Ñ  Ó (Ð(rc#ó®K—|j�)tjj|j«syi}ddl} tj|j«}|j
«|D]¾}|j|«}|dk(s||vrŒtjj|j|«}d}|s]tjj|«r>d|vr:|} tj|«} | D]}|j|«}
|
dk(sŒd}nŒ©|sŒ¬d|vsŒ±d||<||z|f–—ŒÀy#t
$rg}Y·wxYw#t
$rg} YŒYwxYw­w)NrÚ__init__Fr$Tr2) r-ÚosÚisdirÚinspectÚlistdirÚOSErrorÚsortÚ
getmodulenameÚjoin) r=r.r9rBÚ filenamesÚfnÚmodnamer-r%Ú dircontentsÚsubnames rÚ_iter_file_finder_modulesrM‚sSèø€Ø‡}�}ФB§G¡G§M¡M°(·-±-Ô$@Øà€GÛðÜ—J‘J˜xŸ}™}Ó-ˆ ð‡N�NÔàò*ˆØ×'Ñ'¨Ó+ˆØ �JÒ  '¨WÑ"4Ø ä�w‰w�|‰|˜HŸM™M¨2Ó.ˆØˆáœ2Ÿ7™7Ÿ=™=¨Ô.°3¸b±=؈Gð
!Ü Ÿj™j¨Ó.� ð"ò
�Ø!×/Ñ/°Ó3�ؘJÓ&Ø �EÙð 
ð â �s 'Ò)Ø ˆG�GÑ Ø˜7Ñ" EÐ)Ó )ñ3*øô òàŠ ðûô"ò
!à ’ ð
!üs`‚=EÁD3ÁBEÃ#EÃ8EÄEÄEÄ"EÄ3 EÄ>EÅEÅEÅ EÅEÅEÅE)Ú zipimporterc#ó
K—ttj|j«}|j}t |«}i}ddl}|D]·}|j|«sŒ||djtj«}t |«dk(r/|djd«r|d|vrd||d<||dzdf–—t |«dk7rŒƒ|j|d«}|dk(rŒ�|sŒ d|vsŒ¥||vsŒªd||<||zdf–—Œ¹y­w) Nrér2z __init__.pyTr?r$F) ÚsortedÚ zipimportÚ_zip_directory_cacheÚarchiver.ÚlenrBÚ
startswithÚsplitr@ÚseprF) r=r.ÚdirlistÚ_prefixÚplenr9rBrIrJs rÚiter_zipimport_modulesr\²sèø€Üœ×7Ñ7¸×8HÑ8HÑIÓJˆØ—/‘/ˆÜ�7‹|ˆØˆÛØò .ˆBØ—=‘= Ô)Øà�D�E�—‘¤§¡Ó(ˆBä�2‹w˜Šz˜b ™e×.Ñ.¨}Ô=Ø�a‘5 Ñ'Ø%&�G˜B˜q™E‘NØ  2 a¡5™.¨$Ð.Ò.ä�2‹w˜ŠzØà×+Ñ+¨B¨q©EÓ2ˆGؘ
Ò"Øâ˜3 gÒ-°'ÀÒ2HØ#$�˜Ñ ؘwÑ&¨Ð-Ó-ñ) .ùs‚C%DÃ(DÃ-DÃ2Dcó—tj|«} tj|}|S#t$rVtj
D]=} ||«}tjj
||«Y|S#t$rYŒ;wxYwd}Y|SwxYw)zÿRetrieve a finder for the given path item
The returned finder is cached in sys.path_importer_cache
if it was newly created by a path hook.
The cache (or part of it) can be cleared manually if a
rescan of sys.path_hooks is necessary.
N)r@Úfsdecoder)Úpath_importer_cacheÚKeyErrorÚ
path_hooksÚ
setdefaultr+)Ú path_itemr=Ú path_hooks rrrÔs¡€ô— ‘ ˜IÓ&€Ið Ü×*Ñ*¨9Ñ5ˆð €Oøô ò ÜŸ™ò ˆIð
Ù$ YÓ/�Ü×'Ñ'×2Ñ2°9¸hÔGÙð
€Oøô ò
Ùð
úð  ð‰HØ €Oð ús3—,¬B Á (A5Á1B Á5 BÁ>B ÂBÂB Â
B c#ó\K—|jd«rdj|«}t|«‚d|vr9|jd«d}t j
|«}t
|dd«}|€)ytjEd{–—†tj}|D]}t|«–—Œy7Œ)­w)a¹Yield finders for the given module name
If fullname contains a '.', the finders will be for the package
containing fullname, otherwise they will be all registered top level
finders (i.e. those on both sys.meta_path and sys.path_hooks).
If the named module is in a package, that package is imported as a side
effect of invoking this function.
If no module name is specified, all top level finders are produced.
r$ú'Relative module name {!r} not supportedrr#N) rVÚformatr+Ú
rpartitionrÚ
import_moduler(r)Ú meta_pathr-r)ÚfullnameÚmsgÚpkg_nameÚpkgr-Úitems rrrís¨èø€ð×ј3ÔØ7×>Ñ>¸xÓHˆÜ˜#ÓÐØ
ˆh�à×&Ñ& sÓ+¨AÑ.ˆÜ×%Ñ% hÓ/ˆÜ�s˜J¨Ó-ˆØ ˆ<Ø ä—=‘=× Ð Ü�x‰xˆØò!ˆÜ˜4Ó Ó ñ!ð !ús‚A>B,ÂB*Â*B,cóN—tjdtj›d�d¬«|tjvrtj|}|€yt |t «r8|}t|dd«}|�|St|dd«€y|j}t|«S|}t|«S)zøGet a "loader" object for module_or_name
Returns None if the module cannot be found or imported.
If the named module is not already imported, its containing package
(if any) is imported, in order to establish the package __path__.
zpkgutil.get_loaderú(; use importlib.util.find_spec() instead©éé©ÚremoveNÚ
__loader__Ú__spec__)
ÚwarningsÚ _deprecatedÚ_DEPRECATED_MSGr)r*r3rr(Ú__name__r )Úmodule_or_nameÚmoduleÚloaderrks rrr
s·€ô
×ÑÐ-Ü$×4Ñ4Ð5ð6BðBà 'õ)𜟙Ñ$ÜŸ™ ^Ñ4ˆØ Ð !ØÜ�.¤*Ô-؈ܘ ¨tÓ4ˆØ Р؈MÜ �6˜: tÓ ,Ð 4ØØ—?‘?ˆô �xÓ Ð ð"ˆÜ �xÓ Ð rc ó —tjdtj›d�d¬«|jd«rdj |«}t |«‚ t jj|«}|� |jSdS#t
tttf$r-}d}t |j |t|«|««|‚d}~wwxYw) zàFind a "loader" object for fullname
This is a backwards compatibility wrapper around
importlib.util.find_spec that converts most failures to ImportError
and only returns the loader rather than the full spec
zpkgutil.find_loaderrqrrrur$rfz,Error while finding loader for {!r} ({}: {})N)ryrzr{rVrgr+rrÚ find_specÚAttributeErrorÚ TypeErrorr5Útyper)rkrlÚspecÚexs rr r &sÍ€ô
×ÑÐ.Ü$×4Ñ4Ð5ð6BðBà 'õ)ð×ј3ÔØ7×>Ñ>¸xÓHˆÜ˜#ÓÐðFÜ�~‰~×'Ñ'¨Ó1ˆðÐ*ˆ4�;‰;Ð4°Ð4øô
œ¬´JÐ ?òFð=ˆÜ˜#Ÿ*™* X¬t°B«x¸Ó<Ó=À2ÐEûð FúsÁBÂC
 (CÃC
c óâ—t|t«s|S|dz}|dd}|jd«\}}}|r tj|j
}ntj}|D�]%}t|t«sŒt|«}|�og} t|d«r$|j|«}
|
�1|
jxsg} n t|d«r|j|«\}} | D]} | |vsŒ|j| «Œt jj#||«} t jj%| «sŒÑ t'| «}
|
5|
D]8}|j)d«}|r|j+d«rŒ(|j|«Œ: ddd«�Œ(|S#t tf$r|cYSwxYw#1swY�ŒLxYw#t,$r1}tj.j1d| ›d |›d�«Yd}~�Œ„d}~wwxYw)
a¢Extend a package's path.
Intended use is to place the following code in a package's __init__.py:
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
For each directory on sys.path that has a subdirectory that
matches the package name, add the subdirectory to the package's
__path__. This is useful if one wants to distribute different
parts of a single logical package as multiple directories.
It also looks for *.pkg files beginning where * matches the name
argument. This feature is similar to *.pth files (see site.py),
except that it doesn't special-case lines starting with 'import'.
A *.pkg file is trusted at face value: apart from checking for
duplicates, all entries found in a *.pkg file are added to the
path, regardless of whether they are exist the filesystem. (This
is a feature.)
If the input path is not a list (as is the case for frozen
packages) it is returned unchanged. The input path is not
modified; an extended copy is returned. Items are only appended
to the copy at the end.
It is assumed that sys.path is a sequence. Items of sys.path that
are not (unicode or 8-bit) strings referring to existing
directories are ignored. Unicode items of sys.path that cause
errors when used as filenames may cause this function to raise an
exception (in line with os.path.isdir() behavior).
z.pkgNr$r�r ú
ú#z Can't open z: )r3Úlistrhr)r*r#r`r‚r-r4rr<r�Úsubmodule_search_locationsr Úappendr@rGÚisfileÚopenÚrstriprVrDÚstderrÚwrite)r-r'Ú sname_pkgÚparent_packageÚ_Ú
final_nameÚ search_pathÚdirÚfinderÚportionsr…ÚportionÚpkgfileÚfÚlinerls rrr?sî€ôB �dœDÔ !ðˆ à�v‘
€Ià ‘ˆ7€Dà$(§O¡O°CÓ$8Ñ!€N�A�zÙð ÜŸ+™+ nÑ5×>Ñ>‰Kô —h‘hˆ àó$*ˆÜ˜#œsÔ#Ø ä˜cÓ"ˆØ Р؈HÜ�v˜{Ô+Ø×'Ñ'¨
Ó3�ØÐ#Ø#×>Ñ>ÒDÀ"‘H䘠Ô/Ø$×0Ñ0°Ó<‘ ��8à#ò
)�ð $Ò&Ø—K‘K Õ(ð 
)ô—'‘'—,‘,˜s IÓ.ˆÜ
�7‰7�>‰>˜'Õ "ð
*ܘ“M�ð
ñ*Ø !ò*˜Ø#Ÿ{™{¨4Ó0˜Ù# t§¡°sÔ';Ø$ØŸ ™  DÕ)ñ *÷*ñ*ð?$*ðL €Køô[œ.Ð)ò ðŠKð ú÷L*ñ*ûô ò
1Ü—
‘
× Ò Ú")ª3ð"0÷1ò1ûð
1ús5µFÄ7 F4Å>F'ÆF$Æ#F$Æ'F1 Æ4 G.Æ=&G)Ç)G.có—tjj|«}|€y|j}|� t |d«syt
j j|«xstjj|«}|� t |d«sy|jd«}|jdtjj|j««tjj |Ž}|j#|«S)afGet a resource from a package.
This is a wrapper round the PEP 302 loader get_data API. The package
argument should be the name of a package, in standard module format
(foo.bar). The resource argument should be in the form of a relative
filename, using '/' as the path separator. The parent directory name '..'
is not allowed, and nor is a rooted name (starting with a '/').
The function returns a binary string, which is the contents of the
specified resource.
For packages located in the filesystem, which have already been imported,
this is the rough equivalent of
d = os.path.dirname(sys.modules[package].__file__)
data = open(os.path.join(d, resource), 'rb').read()
If the package cannot be located or loaded, or it uses a PEP 302 loader
which does not support get_data(), then None is returned.
Nr Ú__file__ú/r)rrr�rr<r)r*ÚgetÚ
_bootstrapÚ_loadrWÚinsertr@r-ÚdirnamerŸrGr )ÚpackageÚresourcer…rÚmodÚpartsÚ
resource_names rr r �sÉ€ô, �>‰>× #Ñ # GÓ ,€DØ €|ØØ
�[‰[€FØ