
    (g                     4   d Z ddlmZ ddlmZ 	 ddlZ	 ddlZddl	m
Z
 ddlZddlZddlmZ g d	Zd
 Zd Z G d dej$                        Z eeej(                  ej*                  ej,                  ej.                          G d dej$                        Z eeej2                          G d de
      Z G d de
      Z eeej(                  ej*                  ej8                          G d de      Z eeej<                          G d dej>                  ee      Z eeej@                  ejB                          G d dejD                  ee      Z" ee"ej@                         y# e$ rZej                  dk7  r dZY dZ[pdZ[ww xY w# e$ r eZY }w xY w)z(Abstract base classes related to import.   )_bootstrap_external)	machinery    N_frozen_importlib)Loader)abc)r   MetaPathFinderPathEntryFinderResourceLoaderInspectLoaderExecutionLoader
FileLoaderSourceLoaderc                     | t         j                  v r?t        t         |       }t        j                  t
         d|  d       |t               | <   |S t        dt
        d|       )z{
    For backwards compatibility, continue to make names
    from _resources_abc available through this module. #93963
    .)      )removezmodule z has no attribute )_resources_abc__all__getattrwarnings_deprecated__name__globalsAttributeError)nameobjs     $/usr/lib/python3.12/importlib/abc.py__getattr__r       sb    
 ~%%%nd+z4&1'B	$

78,.@I
JJ    c                     |D ]F  }| j                  |       t        	 t        t        |j                        }| j                  |       H y # t        $ r t        t
        |j                        }Y 9w xY w)N)registerr   r   r   r   _frozen_importlib_external)abstract_clsclassescls
frozen_clss       r   	_registerr)   )   sp     .c"(O$%6E
 !!*-.
 " O$%?N
Os   A#A32A3c                       e Zd ZdZd Zy)r	   z8Abstract base class for import finders on sys.meta_path.c                      y)zAn optional method for clearing the finder's cache, if any.
        This method is used by importlib.invalidate_caches().
        N selfs    r   invalidate_cachesz MetaPathFinder.invalidate_caches;       r!   Nr   
__module____qualname____doc__r/   r,   r!   r   r	   r	   4   s
    B
r!   r	   )	metaclassc                       e Zd ZdZd Zy)r
   z>Abstract base class for path entry finders used by PathFinder.c                      y)zAn optional method for clearing the finder's cache, if any.
        This method is used by PathFinder.invalidate_caches().
        Nr,   r-   s    r   r/   z!PathEntryFinder.invalidate_cachesH   r0   r!   Nr1   r,   r!   r   r
   r
   D   s
    Hr!   r
   c                   4    e Zd ZdZej
                  d        Zy)r   zAbstract 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.

    c                     t         )zwAbstract method which when implemented should return the bytes for
        the specified path.  The path must be a str.)OSErrorr.   paths     r   get_datazResourceLoader.get_dataY   s	     r!   N)r   r2   r3   r4   r   abstractmethodr=   r,   r!   r   r   r   P   s!     	 r!   r   c                       e Zd ZdZd Zd Zej                  d        Ze	dd       Z
ej                  j                  Zej                  j                  Zy)r   zAbstract 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.

    c                     t         )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.
        ImportErrorr.   fullnames     r   
is_packagezInspectLoader.is_packagei   s
     r!   c                 L    | j                  |      }|y| j                  |      S )a  Method 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)r.   rD   sources      r   get_codezInspectLoader.get_codeq   s+     *>""6**r!   c                     t         )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.
        rA   rC   s     r   rG   zInspectLoader.get_source~   
     r!   c                      t        | |dd      S )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     r   rH   zInspectLoader.source_to_code   s     tT6==r!   N)z<string>)r   r2   r3   r4   rE   rJ   r   r>   rG   staticmethodrH   r   _LoaderBasicsexec_moduleload_moduler,   r!   r   r   r   `   sc    + 	  > > &33??K%33??Kr!   r   c                   :    e Zd ZdZej
                  d        Zd Zy)r   zAbstract 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.

    c                     t         )zAbstract method which should return the value that __file__ is to be
        set to.

        Raises ImportError if the module cannot be found.
        rA   rC   s     r   get_filenamezExecutionLoader.get_filename   rL   r!   c                     | j                  |      }|y	 | j                  |      }| j                  ||      S # t        $ r | j                  |      cY S w xY w)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)rG   rX   rH   rB   )r.   rD   rI   r<   s       r   rJ   zExecutionLoader.get_code   sf     *>	5$$X.D &&vt44  	/&&v..	/s   9 AAN)r   r2   r3   r4   r   r>   rX   rJ   r,   r!   r   r   r      s&     	 5r!   r   c                       e Zd ZdZy)r   z[Abstract base class partially implementing the ResourceLoader and
    ExecutionLoader ABCs.N)r   r2   r3   r4   r,   r!   r   r   r      s    r!   r   c                   "    e Zd ZdZd Zd Zd Zy)r   a  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

    c                     | j                   j                  t        j                   u rt        t	        | j                  |      d         S )z6Return the (int) modification time for the path (str).mtime)
path_stats__func__r   r:   intr;   s     r   
path_mtimezSourceLoader.path_mtime   s8    ??##|'>'>>M4??4(122r!   c                     | j                   j                  t        j                   u rt        d| j                  |      iS )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.
        r]   )ra   r_   r   r:   r;   s     r   r^   zSourceLoader.path_stats   s5     ??##|'>'>>M.//r!   c                      y)a  Write 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,   )r.   r<   rQ   s      r   set_datazSourceLoader.set_data   r0   r!   N)r   r2   r3   r4   ra   r^   rd   r,   r!   r   r   r      s    3	0r!   r   )#r4    r   r   r   rB   excr   r$   _abcr   r   r   	resourcesr   r   r    r)   ABCMetar	   BuiltinImporterFrozenImporter
PathFinderWindowsRegistryFinderr
   
FileFinderr   r   NamespaceLoaderr   ExtensionFileLoaderr   SourceFileLoaderSourcelessFileLoaderr   r,   r!   r   <module>rs      s   . ! 
5%  
  ,
K.
s{{ 
 
.)33Y5M5M


	 ? ?A  
/9// 0V  0@F 0@d 
-22I4L4LiNgNg h 5m  5D 
/988 9$// 
 
*i00**,*&33^_ *X 
,	22 3S  
xx&&  5!45s(   E' F 'F	,FF	FF