Files
Aquatech/v-aguatech_programa/build/vaguatechrelatorios/localpycs/pyimod02_importers.pyc
T

263 lines
32 KiB
Plaintext
Raw Normal View History

2026-03-15 18:24:18 +00:00
+
cóRt^RIt^RIt^RIt^RIt^RIt^RIt]PP'd]P'dRt
MRt
Rt Rs ]P!4tRsRt.t]P$P']P(4t]P-]4]P$P/]4t]P$P3]4]P$P3]48wd]P-]4Rt]P6R8Xd­]P9R4'dR t]P$P;]P$P=]4R
4t]P-]4]P$P;]P$P=]4R
4t ] ]8wd]P-] 4R t!!R R
4t"Rt#!RR4t$!RR4t%!RR4t&Rt'Rt(Rt)R#)z8
PEP-302 and PEP-451 importers for frozen applications.
NcóŽ\PPW,4\PPR4R#)Ú
N)ÚsysÚstderrÚwrite)ÚmsgÚas Úpyimod02_importers.pyÚtracer s(Ü
×јÔ
×јÖócóR#))rrs rr r $sÙ r
cóÜ^RIHp\P!V4PpV!V4p\P
!RRR7pVP
VP
V^,44#)a
Decode bytes representing source code and return the string. Universal newline support is used in the decoding.
Based on CPython's implementation of the same functionality:
https://github.com/python/cpython/blob/3.9/Lib/importlib/_bootstrap_external.py#L679-L688
)Údetect_encodingNT)ÚdecoderÚ translate)ÚtokenizerÚioÚBytesIOÚreadlineÚIncrementalNewlineDecoderÚdecode)Ú source_bytesrÚsource_bytes_readlineÚencodingÚnewline_decoders rÚ_decode_sourcer(sYõŸJšJ |ÓÙÐ5€HÜ×2¸4È4ÔP€OØ × ! ,×"5Ñ"5°h¸qµkÓ"BÓ Cr
có–\;_uu_4\f\\4s\uuRRR4# +'giR#;i)N)Ú_pyz_tree_lockÚ _pyz_treeÚ_build_pyz_prefix_treeÚ pyz_archiver r
rÚget_pyz_toc_treer!@s(÷
ŽÜ Ò Ü.¬{Ó;ˆIÜ÷
ús 7· AdarwinzContents/FrameworksTÚ Resourcescón\4pVPP4wr#VPR4pV^,pTpV\P
\P 09dVFpVPV/4pK KcVRRFpVPV/4pK RWdR,& V#)Ú.NÚéÿÿÿÿ)ÚdictÚtocÚitemsÚsplitÚpyimod01_archiveÚ PYZ_ITEM_PKGÚPYZ_ITEM_NSPKGÚ
setdefault)r ÚtreeÚ
entry_nameÚ
entry_dataÚname_componentsÚtypecodeÚcurrentÚname_components rrrkÜ 6€DØ"-§/¡/×"7Ñ"7Ö"9ш
Ø*¨3ÓØ˜a•=ˆØˆØ Ô5Ô7G×7VÑ7VÐ Wã"1Ø!×,¨^¸@ó#2ð#2°#°2Ó"6Ø!×,¨^¸@ñ#7à+-ˆG  #:ð €Kr
có´a]tRt^}toRtRt]R4tRtRt ]
R4t Rt Rt
RR
lt]P R ,R8d
R tR
tRtVtR #RtVtR #)ÚPyiFrozenFindera+
PyInstaller's frozen path entry finder for specific search path.
Per-path instances allow us to properly translate the given module name ("fullname") into full PYZ entry name.
For example, with search path being `sys._MEIPASS`, the module "mypackage.mod" would translate to "mypackage.mod"
in the PYZ archive. However, if search path was `sys._MEIPASS/myotherpackage/_vendored` (for example, if
`myotherpacakge` added this path to `sys.path`), then "mypackage.mod" would need to translate to
"myotherpackage._vendored.mypackage.mod" in the PYZ archive.
cóNVPP RVP R2#)Ú))Ú __class__Ú__name__Ú_path)Úselfs rÚ__repr__ÚPyiFrozenFinder.__repr__‡s$Ø—..×*¨!¨D¯J©J¨<°qÐ9r
có\RV: 24V!V4p\R4V# \dp\RT 24hRp?ii;i)z0PyInstaller: running path finder hook for path: zPyInstaller: hook succeededzPyInstaller: hook failed: N)r Ú Exception)ÚclsÚpathÚfinderÚes rÚ path_hookÚPyiFrozenFinder.path_hookŠsQä
ÐÁÐ Ù˜“YˆFÜ Ð ˆMøÜô Ü Ð.¨q¨cÐ ûð ús&¦ A±AÁAcóèWn\Vn\F<p\P
P
W4pTPR4'dK<M
\R4h\P
PT4'd \R4hTR8Xd
RTn R#RPTP\P
P44Tn R# \di;i)z..zIFailed to determine relative path w.r.t. top-level application directory.zonly directories are supportedr%r&N)r>r Ú _pyz_archiveÚ_TOP_LEVEL_DIRECTORY_PATHSÚosrEÚrelpathÚ
ValueErrorÚ
startswithÚ ImportErrorÚisfileÚ_pyz_entry_prefixÚjoinr+Úsep)r?rEÚtop_level_pathÚ
relative_paths rÚ__init__ÚPyiFrozenFinder.__init__•ØŒ
Ü'ˆÔ÷9ˆ
Ü "§¡§¡°Ó E
ð××á ñÐ
7‰7>‰>˜$× Ò ÜÐ ˜ Ø%'ˆ "à%(§X¡X¨m×.AÑ.AÄ"Ç'Á'Ç+Á+Ó.NÓ%Oˆ "øô'ô
Úð
úsœC"Ã" C1Ã0C1c óŽVPR4^,pVP'dVPR,V,#V#)zj
Convert module fullname into PYZ entry name, subject to the prefix implied by this finder's search path.
r%)Ú
rpartitionrS)r?ÚfullnameÚ tail_modules rÚ_compute_pyz_entry_nameÚ'PyiFrozenFinder._compute_pyz_entry_name¶sAð×)¨#Ó.¨qÕ à × ×)¨CÕ/°+Õ Ð r
c óR\VR4'd
VP#RpRVn\\P4FFwr#W0P
8XdRpKV'gK#V!VP 4VnVP# VP# \dKdi;i)a

Opportunistically create a *fallback finder* using `sys.path_hooks` entries that are located *after* our hook.
The main goal of this exercise is to obtain an instance of python's FileFinder, but in theory any other hook
that comes after ours is eligible to be a fallback.
Having this fallback allows our finder to "cooperate" with python's FileFinder, as if the two were a single
finder, which allows us to work around the python's PathFinder permitting only one finder instance per path
without subclassing FileFinder.
Ú_fallback_finderFNT)ÚhasattrraÚ enumeraterÚ
path_hooksrHr>rQ)r?Úour_hook_foundÚidxÚhooks rÚfallback_finderÚPyiFrozenFinder.fallback_finderÁô  × ˆà $ˆÔÜ"¤3§>¡>Ö2‰Iˆ—~%Ø!%Ùçð
Ù(,¨T¯Z©ZÓ(8Ôð××$øôô
Úð
úsÁ%BÂ B&Â%B&c ó¦\VR4'gVP4VnVPfR#VPPW4#)a
Attempt to find the spec using fallback finder, which is opportunistically created here. Typically, this would
be python's FileFinder, which can discover specs for on-filesystem modules, such as extension modules and
modules that are collected only as source .py files.
Having this fallback allows our finder to "cooperate" with python's FileFinder, as if the two were a single
finder, which allows us to work around the python's PathFinder permitting only one finder instance per path
without subclassing FileFinder.
raN)rbÚ_get_fallback_finderraÚ find_spec)r?r\Útargets rÚ_find_fallback_specÚ#PyiFrozenFinder._find_fallback_specãsIô/×0Ø$(×$=Ñ$=Ó$?ˆ × Ñ Ò à×.¨xÓ@r
c ót\VRR4pVe'\VR4'dVP4R#R#R#)a
A method which, when called, should invalidate any internal cache used by the finder. Used by
importlib.invalidate_caches() when invalidating the caches of all finders on sys.meta_path.
https://docs.python.org/3/library/importlib.html#importlib.abc.MetaPathFinder.invalidate_caches
rainvalidate_caches)Úgetattrrbrq)r?rhs rrqÚ!PyiFrozenFinder.invalidate_caches÷s=ô" $Ð(:¸AˆØ Ò Ð(;×× 'r
Nc  óü\V RV: RV: 24VPV4pVPPP V4pVf|\V RV: R24VP
eL\V RVP
: R24VP
P
W4p\V RV: R24V#\V R 24R#V^,p\V R
V: R V: R V 24V\P8Xdv\P!VR4p\PP\PVP!R\PP"44.VnV#V\P&8Hp\)VVPVVR
7p V Pp
\P!VV VV
R7pRVnV'd&\PP-V
4.VnV#)a“
A method for finding a spec for the specified module. The finder will search for the module only within the
path entry to which it is assigned. If a spec cannot be found, None is returned. When passed in, target is a
module object that the finder may use to make a more educated guess about what spec to return.
https://docs.python.org/3/library/importlib.html#importlib.abc.PathEntryFinder.find_spec
z": find_spec: called with fullname=z , target=Nz
: find_spec: z not found in PYZ...z6: find_spec: attempting resolve using fallback finder r%z,: find_spec: fallback finder returned spec: z.: find_spec: fallback finder is not available.z: find_spec: found z in PYZ as z , typecode=)Únamer Úpyz_entry_nameÚ
is_package)rwÚoriginT)r r^rKr)Úgetrhrlr,r.Ú_frozen_importlibÚ
ModuleSpecrMrErTrÚ_MEIPASSÚreplacerUÚsubmodule_search_locationsr-ÚPyiFrozenLoaderÚ has_locationÚdirname) r?r\rmrvr2Ú
fallback_specr4ÚspecrwÚloaderrxs rrlÚPyiFrozenFinder.find_specô й ÀIÈhÉ\Ð×5°hÓ?ˆð×&×*×.¨~Ó>ˆ
Ø Ò ô
TF˜-¨¡|Ð3GРט˜ÐTÐUY×UiÑUiÑTlÐlmÐoØ $× 4Ñ 4× >Ñ >¸xÓ P
ܘ˜ÐJÈ=ÑJ[Ð[\И˜Ðð˜a•=ˆÜ
Ð)¨(©°[ÀÑ@RÐR]Ð^fÐ]gÐ Ô'× %׸$Ó?ˆDô œSŸ\™\¨>×+AÑ+AÀ#ÄrÇwÁwÇ{Á{Ó+SÓ/ˆ
ˆÔ!1×!>Ñ!>Ñ>ˆ
ôØ×
ˆðˆô Ø Øô 
ˆðÔ÷ Ü/1¯w©w¯©¸vÓ/FÐ.Gˆ ˆ r
:NéNc óxVPV4pVfR.3#VPVP;'g.3#)aw
A legacy method for finding a loader for the specified module. Returns a 2-tuple of (loader, portion) where
portion is a sequence of file system locations contributing to part of a namespace package. The loader may
be None while specifying portion to signify the contribution of the file system locations to a namespace
package. An empty list can be used for portion to signify the loader is not part of a namespace package. If
loader is None and portion is the empty list then no loader or location for a namespace package were found
(i.e. failure to find anything for the module).
Deprecated since python 3.4, removed in 3.12.
N)rlr„r~)r?r\s rÚ find_loaderÚPyiFrozenFinder.find_loaderZs=ð—>> +ˆŠ|ؘRxØ—;‘; × ?Ñ ?× EÐ EÀ2Ð Er
c ó,VPV4wr#V#)z˜
A concrete implementation of Finder.find_module() which is equivalent to self.find_loader(fullname)[0].
Deprecated since python 3.4, removed in 3.12.
)rˆ)r?r\r„Úportionss rÚ find_moduleÚPyiFrozenFinder.find_modulelsð $×Ó ˆF؈Mr
)rar>rKrS)N)éé )r=Ú
__module__Ú __qualname__Ú__firstlineno__Ú__doc__r@Ú classmethodrHrXr^ÚpropertyrhrnrqrlrÚ version_inforˆÚ__static_attributes__Ú__classdictcell__)Ú
__classdict__s@rr8r8}s€ø‡ñòñóðòPòB ðñð%òBAò(
Nðd ×ј՘gÔ F÷$ ð õ)&r
r8cóaV3RlpV#)cóx<VPV8wd\RVP RV 2VR7hS!W.VO5/VB#)z loader for z cannot handle ©ru)rurQ)r?ruÚargsÚkwargsÚmethods €rÚ_check_name_wrapperÚ(_check_name.<locals>._check_name_wrapper|sCø€Ø 9‰9˜Ô Ü  ¨D¯I©I¨;°oÀdÀVÐLÐSWÔ 2 2¨6Ñ2r
r )r s` rÚ _check_namer¢{sø€õ
Ðr
cóža]tRtRtoRtRtRtRt]R4t ]R4t
]R4t ]R 4t ]R
4t
R t]R 4tR
tVtR#)ri„
PyInstaller's frozen loader for modules in the PYZ archive, which are discovered by PyiFrozenFinder.
Since this loader is instantiated only from PyiFrozenFinder and since each loader instance is tied to a specific
module, the fact that the loader was instantiated serves as the proof that the module exists in the PYZ archive.
Hence, we can avoid any additional validation in the implementation of the loader's methods.
có¼W nW0nW@nV'dY\PP \ PVPR\PP4R4pM]\PP \ PVPR\PP4R,4pWn
WPnR#)r%ú __init__.pyú.pyN) rKÚ_pyz_entry_nameÚ _is_packagerMrErTrr|r}rUru)r?rur rvrwÚ module_files rrXÚPyiFrozenLoader.__init__Œs”ðØØ÷ ÜŸ'™'Ÿ,™,¤s§|¡|°^×5KÑ5KÈCÔQS×QXÑQX×Q\ÑQ\Ó5]Ð_lÓm‰KäŸ'™'Ÿ,™,¤s§|¡|°^×5KÑ5KÈCÔQS×QXÑQX×Q\ÑQ\Ó5]Ð`eÕ5eÓfˆ
Œ ØŽ r
c óR#)a
A method that returns the module object to use when importing a module. This method may return None, indicating
that default module creation semantics should take place.
https://docs.python.org/3/library/importlib.html#importlib.abc.Loader.create_module
Nr )r?s rÚ
create_moduleÚPyiFrozenLoader.create_module¬sñr
c ó VPpVPVP4pVf\RVP: R24h\ VR4'gQhVP
eVP
Vn\W1P4R#)a3
A method that executes the module in its own namespace when a module is imported or reloaded. The module
should already be initialized when exec_module() is called. When this method exists, create_module()
must be defined.
https://docs.python.org/3/library/importlib.html#importlib.abc.Loader.exec_module
Nz Failed to retrieve bytecode for Ú__file__) Ú__spec__Úget_coderuÚ RuntimeErrorrbr~Ú__path__ÚexecÚ__dict__)r?ÚmodulerƒÚbytecodes rÚ exec_moduleÚPyiFrozenLoader.exec_moduleµszðˆØ—=‘= §¡ÓØ Ò ÜÐ!AÀ$Ç)Á)ÁÈaÐ v˜z× × =ˆFŒOä ˆX—Ö'r
c ó0^RIHpVPW4#)a
A legacy method for loading a module. If the module cannot be loaded, ImportError is raised, otherwise the
loaded module is returned.
Deprecated since python 3.4, slated for removal in 3.12 (but still present in python's own FileLoader in
both v3.12.4 and v3.13.0rc1).
N)Úimportlib._bootstrapÚ
_bootstrapÚ_load_module_shim)r?r\s rÚ load_moduleÚPyiFrozenLoader.load_moduleÐsõ
×Ó ?r
c óVP#)ap
A method that is to return the value of __file__ for the specified module. If no path is available, ImportError
is raised.
If source code is available, then the method should return the path to the source file, regardless of whether a
bytecode was used to load the module.
https://docs.python.org/3/library/importlib.html#importlib.abc.ExecutionLoader.get_filename
©rE)r?r\s rÚ get_filenameÚPyiFrozenLoader.get_filenameàsðy‰yÐr
c óLVPPVP4#)a,
Return the code object for a module, or None if the module does not have a code object (as would be the case,
for example, for a built-in module). Raise an ImportError if loader cannot find the requested module.
https://docs.python.org/3/library/importlib.html#importlib.abc.InspectLoader.get_code
)rKÚextractr§)r?r\s rÚPyiFrozenLoader.get_codeïs!ð× Ñ ××)=Ñ)=Ó>r
c óÖVPp\VR4;_uu_4pVP4pRRR4\X4# +'giL;i \dR#i;i)
A method to return the source of a module. It is returned as a text string using universal newlines, translating
all recognized line separators into '
' characters. Returns None if no source is available (e.g. a built-in
module). Raises ImportError if the loader cannot find the module specified.
https://docs.python.org/3/library/importlib.html#importlib.abc.InspectLoader.get_source
ÚrbN)rEÚopenÚreadrÚFileNotFoundError)r?r\ÚfilenameÚfprs rÚ
get_sourceÚPyiFrozenLoader.get_sourceùs]ð—9‘9ˆð äר!Ÿw™wy ÷!  &×%ûô Ø ñð  ús'ŽA¢A³AÁ A ÁAÁ A(Á'A(c óVP#)
A method to return a true value if the module is a package, a false value otherwise. ImportError is raised if
the loader cannot find the module.
https://docs.python.org/3/library/importlib.html#importlib.abc.InspectLoader.is_package
))r?r\s rrwÚPyiFrozenLoader.is_packagesð×ÑÐr
c óˆ\VR4;_uu_4pVP4uuRRR4# +'giR#;i)
A method to return the bytes for the data located at path. Loaders that have a file-like storage back-end that
allows storing arbitrary data can implement this abstract method to give direct access to the data stored.
OSError is to be raised if the path cannot be found. The path is expected to be constructed using a module’s
__file__ attribute or an item from a package’s __path__.
https://docs.python.org/3/library/importlib.html#importlib.abc.ResourceLoader.get_data
N))r?rEs rÚget_dataÚPyiFrozenLoader.get_datas+ô$˜×
Ô
 Ø—77“9÷×
×
Ó
ús 0° A c ó\V4#)z?
Return resource reader compatible with `importlib.resources`.
)ÚPyiFrozenResourceReader)r?r\s rÚget_resource_readerÚ#PyiFrozenLoader.get_resource_reader,sô
' ,r
)rKrurEN)r=rrrr“rXr¿rwr—r˜)r™s@rrrø‡ñò ò@ò(ð2 à ñ @ó
ð @ðñ
óð
ðñðñóðð.ñ óð ò ðñö-r
rcóHa]tRtRtoRtRtRtRtRtRt Rt
R t Vt R
#) r×i4aN
Resource reader for importlib.resources / importlib_resources support.
Supports only on-disk resources, which should cover the typical use cases, i.e., the access to data files;
PyInstaller collects data files onto filesystem, and as of v6.0.0, the embedded PYZ archive is guaranteed
to contain only .pyc modules.
When listing resources, source .py files will not be listed as they are not collected by default. Similarly,
sub-directories that contained only .py files are not reconstructed on filesystem, so they will not be listed,
either. If access to .py files is required for whatever reason, they need to be explicitly collected as data files
anyway, which will place them on filesystem and make them appear as resources.
For on-disk resources, we *must* return path compatible with pathlib.Path() in order to avoid copy to a temporary
file, which might break under some circumstances, e.g., metpy with importlib_resources back-port, due to:
https://github.com/Unidata/MetPy/blob/a3424de66a44bf3a92b0dcacf4dff82ad7b86712/src/metpy/plots/wx_symbols.py#L24-L25
(importlib_resources tries to use 'fonts/wx_symbols.ttf' as a temporary filename suffix, which fails as it contains
a separator).
Furthermore, some packages expect files() to return either pathlib.Path or zipfile.Path, e.g.,
https://github.com/tensorflow/datasets/blob/master/tensorflow_datasets/core/utils/resource_utils.py#L81-L97
This makes implementation of mixed support for on-disk and embedded resources using importlib.abc.Traversable
protocol rather difficult.
So in order to maximize compatibility with unfrozen behavior, the below implementation is basically equivalent of
importlib.readers.FileReader from python 3.10:
https://github.com/python/cpython/blob/839d7893943782ee803536a47f1d4de160314f85/Lib/importlib/readers.py#L11
and its underlying classes, importlib.abc.TraversableResources and importlib.abc.ResourceReader:
https://github.com/python/cpython/blob/839d7893943782ee803536a47f1d4de160314f85/Lib/importlib/abc.py#L422
https://github.com/python/cpython/blob/839d7893943782ee803536a47f1d4de160314f85/Lib/importlib/abc.py#L312