o 0¦iU8ã @súdZddlmZddlmZzddlZWney.Zzejdkr"‚dZWYdZ[ndZ[wwzddlZWn ey@eZYnwddl m Z ddl Z ddl Z ddl mZmZmZdd l mZmZd d „ZGd d „d e jd�ZGdd„de jd�ZeeejejejejƒGdd„de jd�ZeeejƒGdd„de ƒZGdd„de ƒZeeejejƒGdd„deƒZeeej ƒGdd„dej!eeƒZ!ee!ej"ej#ƒGdd„dej$eeƒZ$ee$ej"ƒGdd„de jd�Z%eGdd „d eƒƒZ&Gd!d"„d"e%ƒZ'dS)#z(Abstract base classes related to import.é)Ú_bootstrap_external)Ú machineryéNÚ_frozen_importlib)ÚLoader)ÚBinaryIOÚIterableÚText)ÚProtocolÚruntime_checkablec GsZ|D](}| |¡tdur*ztt|jƒ}Wnty$tt|jƒ}Ynw| |¡qdS©N)ÚregisterrÚgetattrÚ__name__ÚAttributeErrorÚ_frozen_importlib_external)Z abstract_clsZclassesÚclsZ frozen_cls©rú4/opt/alt/python310/lib64/python3.10/importlib/abc.pyÚ _registers  ÿ €ùrc@s(eZdZdZdd„Zejddd„ƒZdS)ÚFindera<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 cCst dt¡dS)Nzqthe Finder ABC is deprecated and slated for removal in Python 3.12; use MetaPathFinder or PathEntryFinder instead©ÚwarningsÚwarnÚDeprecationWarning©ÚselfrrrÚ__init__,sýzFinder.__init__NcCst dt¡dS)z¥An 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. z´importlib.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ÚfullnameÚpathrrrÚ find_module2sûzFinder.find_moduler )rÚ __module__Ú __qualname__Ú__doc__rÚabcÚabstractmethodr rrrrr s  r)Ú metaclassc@s eZdZdZdd„Zdd„ZdS)ÚMetaPathFinderz8Abstract base class for import finders on sys.meta_path.cCs<tjdtdd�t|dƒsdS| ||¡}|dur|jSdS)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. z‹MetaPathFinder.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)rrrÚhasattrr+Úloader)rrrÚfoundrrrr Gs ü  zMetaPathFinder.find_modulecCódS)z‚An optional method for clearing the finder's cache, if any. This method is used by importlib.invalidate_caches(). NrrrrrÚinvalidate_caches\óz MetaPathFinder.invalidate_cachesN)rr!r"r#r r0rrrrr'@s r'c@s&eZdZdZdd„ZejZdd„ZdS)ÚPathEntryFinderz>Abstract base class for path entry finders used by PathFinder.cCsXtjdtdd�t|dƒsdgfS| |¡}|dur(|js g}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)r(r)r+N)rrrr,r+Úsubmodule_search_locationsr-)rrr.ÚportionsrrrÚ find_loaderlsü   zPathEntryFinder.find_loadercCr/)zƒAn optional method for clearing the finder's cache, if any. This method is used by PathFinder.invalidate_caches(). Nrrrrrr0Žr1z!PathEntryFinder.invalidate_cachesN) rr!r"r#r5rÚ_find_module_shimr r0rrrrr2es  r2c@seZdZdZejdd„ƒZdS)ÚResourceLoaderz©Abstract 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. cCót‚)zwAbstract method which when implemented should return the bytes for the specified path. The path must be a str.)ÚOSError©rrrrrÚget_dataŸszResourceLoader.get_dataN)rr!r"r#r$r%r;rrrrr7–sr7c@sLeZdZdZdd„Zdd„Zejdd„ƒZe d d d „ƒZ e j j Z e j jZd S) Ú InspectLoaderz°Abstract 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. cCr8)zÊOptional 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. ©Ú ImportError©rrrrrÚ is_package¯ózInspectLoader.is_packagecCs | |¡}|dur 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_sourceÚsource_to_code)rrÚsourcerrrÚget_code·s  zInspectLoader.get_codecCr8)z·Abstract 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. r=r?rrrrBÄózInspectLoader.get_sourceúcCst||ddd�S)z¿Compile '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)ÚdatarrrrrCÍszInspectLoader.source_to_codeN)rG)rr!r"r#r@rEr$r%rBÚ staticmethodrCrÚ _LoaderBasicsÚ exec_moduleÚ load_modulerrrrr<¦s   r<c@s&eZdZdZejdd„ƒZdd„ZdS)ÚExecutionLoaderz°Abstract 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. cCr8)z˜Abstract method which should return the value that __file__ is to be set to. Raises ImportError if the module cannot be found. r=r?rrrÚ get_filenameärFzExecutionLoader.get_filenamecCsN| |¡}|dur dSz| |¡}Wnty | |¡YSw| ||¡S)z¶Method 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)rBrQr>rC)rrrDrrrrrEís  ÿ zExecutionLoader.get_codeN)rr!r"r#r$r%rQrErrrrrPÛs   rPc@seZdZdZdS)Ú FileLoaderz[Abstract base class partially implementing the ResourceLoader and ExecutionLoader ABCs.N)rr!r"r#rrrrrRsrRc@s(eZdZdZdd„Zdd„Zdd„ZdS) Ú SourceLoaderaäAbstract 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 cCs$|jjtjur t‚t| |¡dƒS)z6Return the (int) modification time for the path (str).Úmtime)Ú path_statsÚ__func__rSr9Úintr:rrrÚ path_mtimeszSourceLoader.path_mtimecCs |jjtjur t‚d| |¡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. rT)rXrVrSr9r:rrrrU szSourceLoader.path_statscCr/)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. Nr)rrrKrrrÚset_data+r1zSourceLoader.set_dataN)rr!r"r#rXrUrYrrrrrS s  rSc@speZdZdZejdedefdd„ƒZejdedefdd„ƒZ ejdede fd d „ƒZ ejde e fd d „ƒZd S)ÚResourceReaderzDAbstract base class for loaders to provide resource reading support.ÚresourceÚreturncCr8)zÑReturn an opened, file-like object for binary reading. The 'resource' argument is expected to represent only a file name. If the resource cannot be found, FileNotFoundError is raised. ©ÚFileNotFoundError©rr[rrrÚ open_resource;s zResourceReader.open_resourcecCr8)zçReturn the file system path to the specified resource. The 'resource' argument is expected to represent only a file name. If the resource does not exist on the file system, raise FileNotFoundError. r]r_rrrÚ resource_pathGs zResourceReader.resource_pathrcCr8)zjReturn True if the named 'path' is a resource. Files are resources, directories are not. r]r:rrrÚ is_resourceTrAzResourceReader.is_resourcecCr8)z+Return an iterable of entries in `package`.r]rrrrÚcontents\szResourceReader.contentsN)rr!r"r#r$r%r rr`raÚboolrbrÚstrrcrrrrrZ8s  rZc@s’eZdZdZejdd„ƒZdd„Zddd„Zejd e fd d „ƒZ ejd e fd d „ƒZ ejdd„ƒZ dd„Z ejddd„ƒZejd efdd„ƒZdS)Ú Traversablezt An object with a subset of pathlib.Path methods suitable for traversing directories and opening files. cCr/)z3 Yield Traversable objects in self NrrrrrÚiterdirir1zTraversable.iterdircCs6| d¡� }| ¡WdƒS1swYdS)z0 Read contents of self as bytes ÚrbN©ÚopenÚread)rÚstrmrrrÚ read_bytesos $ÿzTraversable.read_bytesNcCs8|j|d�� }| ¡WdƒS1swYdS)z/ Read contents of self as text )ÚencodingNri)rrnrlrrrÚ read_textvs$ÿzTraversable.read_textr\cCr/)z. Return True if self is a dir NrrrrrÚis_dir}r1zTraversable.is_dircCr/)z/ Return True if self is a file NrrrrrÚis_fileƒr1zTraversable.is_filecCr/)ú2 Return Traversable child in self Nr©rÚchildrrrÚjoinpath‰r1zTraversable.joinpathcCs | |¡S)rr)rursrrrÚ __truediv__�s zTraversable.__truediv__ÚrcOr/)zý mode may be 'r' or 'rb' to open as text or binary. Return a handle suitable for reading (same as pathlib.Path.open). When opening as text, accepts encoding parameters such as those accepted by io.TextIOWrapper. Nr)rÚmodeÚargsÚkwargsrrrrj•r1zTraversable.opencCr/)zM The base name of this object without any parent references. NrrrrrÚnameŸr1zTraversable.namer )rw)rr!r"r#r$r%rgrmrordrprqrurvrjÚabstractpropertyrer{rrrrrfbs"     rfc@s>eZdZdZejdd„ƒZdd„Zdd„Zdd „Z d d „Z d S) ÚTraversableResourceszI The required interface for providing traversable resources. cCr/)z3Return a Traversable object for the loaded package.NrrrrrÚfiles¬r1zTraversableResources.filescCs| ¡ |¡ d¡S)Nrh)r~rurjr_rrrr`°sz"TraversableResources.open_resourcecCst|ƒ‚r r]r_rrrra³sz"TraversableResources.resource_pathcCs| ¡ |¡ ¡Sr )r~rurqr:rrrrb¶sz TraversableResources.is_resourcecCsdd„| ¡ ¡DƒS)Ncss�|]}|jVqdSr )r{)Ú.0ÚitemrrrÚ ºs€z0TraversableResources.contents..)r~rgrrrrrc¹szTraversableResources.contentsN) rr!r"r#r$r%r~r`rarbrcrrrrr}¦s  r})(r#Úrrrr>Úexcr{rÚ_abcrr$rÚtypingrrr r r rÚABCMetarr'ÚBuiltinImporterÚFrozenImporterÚ PathFinderÚWindowsRegistryFinderr2Ú FileFinderr7r<rPÚExtensionFileLoaderrRÚSourceFileLoaderÚSourcelessFileLoaderrSrZrfr}rrrrÚsX    €ý  ÿ   !ÿ .2 "ÿ ,*C