=Og*dZddlmZddlmZ ddlZn #e$rZejdkrdZYdZ[ndZ[wwxYw ddlZn #e$reZYnwxYwddl m Z ddl Z ddl Z ddl mZmZmZgd Zd ZGd d e j ZGdde j ZeeejejejejGdde j ZeeejGdde ZGdde ZeeejejejGddeZeeej Gddej!eeZ!ee!ej"ej#Gddej$eeZ$ee$ej"dS)z(Abstract base classes related to import.)_bootstrap_external) machineryN_frozen_importlib)Loader)ResourceReader TraversableTraversableResources) rFinderMetaPathFinderPathEntryFinderResourceLoader InspectLoaderExecutionLoader FileLoader SourceLoaderrr r c|D]y}||t[ tt|j}n*#t$rtt |j}YnwxYw||zdSN)registerrgetattr__name__AttributeError_frozen_importlib_external) abstract_clsclassescls frozen_clss 4/opt/alt/python311/lib64/python3.11/importlib/abc.py _registerr s..c"""  ( O$%6 EE ! O O O$%?NN  O  ! !* - - -..s=$A$#A$c:eZdZdZdZejddZdS)r a<Legacy abstract base class for import finders. It may be subclassed for compatibility with legacy third party reimplementations of the import system. Otherwise, finder implementations should derive from the more specific MetaPathFinder or PathEntryFinder ABCs. Deprecated since Python 3.3 c:tjdtdS)Nzqthe Finder ABC is deprecated and slated for removal in Python 3.12; use MetaPathFinder or PathEntryFinder insteadwarningswarnDeprecationWarningselfs r__init__zFinder.__init__7s* 4* + + + + +Nc:tjdtdS)zAn abstract method that should find a module. The fullname is a str and the optional path is a str or None. Returns a Loader object or None. zimportlib.abc.Finder along with its find_module() method are deprecated and slated for removal in Python 3.12; use MetaPathFinder.find_spec() or PathEntryFinder.find_spec() insteadNr")r'fullnamepaths r find_modulezFinder.find_module=s,  = *  + + + + +r)r)r __module__ __qualname____doc__r(abcabstractmethodr-r)rr r +sQ+++   + + + + + +r)r ) metaclassceZdZdZdZdZdS)r z8Abstract base class for import finders on sys.meta_path.ctjdtdt|dsdS|||}||jndS)a_Return a loader for the module. If no module is found, return None. The fullname is a str and the path is a list of strings or None. This method is deprecated since Python 3.4 in favor of finder.find_spec(). If find_spec() exists then backwards-compatible functionality is provided for this method. zMetaPathFinder.find_module() is deprecated since Python 3.4 in favor of MetaPathFinder.find_spec() and is slated for removal in Python 3.12 stacklevel find_specN)r#r$r%hasattrr:loader)r'r+r,founds rr-zMetaPathFinder.find_moduleRsg  :)!"  $ $ $ $ t[)) 4x..$0u||d:r)cdS)zAn optional method for clearing the finder's cache, if any. This method is used by importlib.invalidate_caches(). Nr3r&s rinvalidate_cachesz MetaPathFinder.invalidate_cachesgr)N)rr.r/r0r-r?r3r)rr r Ks8BB ;;;*     r)r c,eZdZdZdZejZdZdS)r z>Abstract base class for path entry finders used by PathFinder.ctjdtdt|dsdgfS||}||jsg}n|j}|j|fSdgfS)a[Return (loader, namespace portion) for the path entry. The fullname is a str. The namespace portion is a sequence of path entries contributing to part of a namespace package. The sequence may be empty. If loader is not None, the portion will be ignored. The portion will be discarded if another path entry finder locates the module as a normal module or package. This method is deprecated since Python 3.4 in favor of finder.find_spec(). If find_spec() is provided than backwards-compatible functionality is provided. zzPathEntryFinder.find_loader() is deprecated since Python 3.4 in favor of PathEntryFinder.find_spec() (available since 3.4)r7r8r:N)r#r$r%r;r:submodule_search_locationsr<)r'r+r=portionss r find_loaderzPathEntryFinder.find_loaderws  .)!"  $ $ $ $ t[)) 8Ox((  3 < ;<) )8Or)cdS)zAn optional method for clearing the finder's cache, if any. This method is used by PathFinder.invalidate_caches(). Nr3r&s rr?z!PathEntryFinder.invalidate_cachesr@r)N) rr.r/r0rEr_find_module_shimr-r?r3r)rr r psCHH @&7K     r)r c2eZdZdZejdZdS)rzAbstract base class for loaders which can return data from their back-end storage. This ABC represents one of the optional protocols specified by PEP 302. ct)zwAbstract method which when implemented should return the bytes for the specified path. The path must be a str.)OSErrorr'r,s rget_datazResourceLoader.get_datas  r)N)rr.r/r0r1r2rLr3r)rrrs= r)rceZdZdZdZdZejdZe ddZ e j j Z e j jZdS) rzAbstract base class for loaders which support inspection about the modules they can load. This ABC represents one of the optional protocols specified by PEP 302. ct)zOptional method which when implemented should return whether the module is a package. The fullname is a str. Returns a bool. Raises ImportError if the module cannot be found.  ImportErrorr'r+s r is_packagezInspectLoader.is_packages r)c^||}|dS||S)aMethod which returns the code object for the module. The fullname is a str. Returns a types.CodeType if possible, else returns None if a code object does not make sense (e.g. built-in module). Raises ImportError if the module cannot be found. N) get_sourcesource_to_code)r'r+sources rget_codezInspectLoader.get_codes3** >4""6***r)ct)zAbstract method which should return the source code for the module. The fullname is a str. Returns a str. Raises ImportError if the module cannot be found. rOrQs rrTzInspectLoader.get_source r)c(t||ddS)zCompile 'data' into a code object. The 'data' argument can be anything that compile() can handle. The'path' argument should be where the data was retrieved (when applicable).execT) dont_inherit)compile)datar,s rrUzInspectLoader.source_to_codes tT6====r)N)rZ)rr.r/r0rRrWr1r2rT staticmethodrUr _LoaderBasics exec_module load_moduler3r)rrrs + + + >>>\>&3?K%3?KKKr)rc8eZdZdZejdZdZdS)rzAbstract base class for loaders that wish to support the execution of modules as scripts. This ABC represents one of the optional protocols specified in PEP 302. ct)zAbstract method which should return the value that __file__ is to be set to. Raises ImportError if the module cannot be found. rOrQs r get_filenamezExecutionLoader.get_filenamerYr)c||}|dS ||}|||S#t$r||cYSwxYw)zMethod to return the code object for fullname. Should return None if not applicable (e.g. built-in module). Raise ImportError if the module cannot be found. N)rTrfrUrP)r'r+rVr,s rrWzExecutionLoader.get_codes ** >4 5$$X..D&&vt44 4 / / /&&v.. . . . /sAA('A(N)rr.r/r0r1r2rfrWr3r)rrrsL 55555r)rceZdZdZdS)rz[Abstract base class partially implementing the ResourceLoader and ExecutionLoader ABCs.N)rr.r/r0r3r)rrr sr)rc$eZdZdZdZdZdZdS)raAbstract base class for loading source code (and optionally any corresponding bytecode). To support loading from source code, the abstractmethods inherited from ResourceLoader and ExecutionLoader need to be implemented. To also support loading from bytecode, the optional methods specified directly by this ABC is required. Inherited abstractmethods not implemented in this ABC: * ResourceLoader.get_data * ExecutionLoader.get_filename c|jjtjurtt ||dS)z6Return the (int) modification time for the path (str).mtime) path_stats__func__rrJintrKs r path_mtimezSourceLoader.path_mtime%s9 ? #|'> > >M4??4((1222r)cn|jjtjurtd||iS)a Return a metadata dict for the source pointed to by the path (str). Possible keys: - 'mtime' (mandatory) is the numeric timestamp of last source code modification; - 'size' (optional) is the size in bytes of the source code. rk)rormrrJrKs rrlzSourceLoader.path_stats+s3 ? #|'> > >M..//r)cdS)aWrite the bytes to the path (if possible). Accepts a str path and data as bytes. Any needed intermediary directories are to be created. If for some reason the file cannot be written because of permissions, fail silently. Nr3)r'r,r_s rset_datazSourceLoader.set_data6r@r)N)rr.r/r0rorlrrr3r)rrrsK  333 0 0 0     r)r)%r0rrrrPexcnamer_abcrr1r# resources.abcrr r __all__rABCMetar r BuiltinImporterFrozenImporter PathFinderWindowsRegistryFinderr FileFinderrrNamespaceLoaderrExtensionFileLoaderrSourceFileLoaderSourcelessFileLoaderrr3r)rrsj..!!!!!! x&&& 5%%%%%555!45 MLLLLLLLLL   ...+++++s{++++@     s{    B .)3Y5M   ?AAA, , , , ,  , , , , \ /9/000     V    0@0@0@0@0@F0@0@0@d -2I4LiNghhh 5 5 5 5 5m 5 5 5D /98999$/  *i0  *,,,* * * * * &3^_* * * X , 233333s2-2;AA