f9 c @ sU d Z d d l m Z d d l m Z y d d l Z Wn@ e k
rx Z z e j d k r` n d Z WYd d Z [ Xn Xd d l Z d d l
Z
d d l Z d d l Z d d l
Z
d d l Z d d Z Gd d
d
d e j Z Gd d
d
e Z e e e j e j e j e j Gd d d e Z e e e j Gd d d d e j Z Gd d d e Z Gd d d e Z e e e j e j e j Gd d d e Z Gd d d e j e e Z e e e j e j Gd d d e j! e e Z! e e! e j Gd d d e! Z" Gd d d e" Z# d S( u( Abstract base classes related to import.i ( u
_bootstrap( u machineryi Nu _frozen_importlibc G sP xI | D]A } | j | t d k r t t | j } | j | q q Wd S( N( u registeru _frozen_importlibu Noneu getattru __name__( u abstract_clsu classesu clsu
frozen_cls( ( u2 /opt/alt/python33/lib64/python3.3/importlib/abc.pyu _register s
u _registerc B s2 | Ee Z d Z d Z e j d d d Z d S( u Finderu 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.
c C s
t d S( u 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.
N( u NotImplementedError( u selfu fullnameu path( ( u2 /opt/alt/python33/lib64/python3.3/importlib/abc.pyu find_module$ s u Finder.find_moduleN( u __name__u
__module__u __qualname__u __doc__u abcu abstractmethodu Noneu find_module( u
__locals__( ( u2 /opt/alt/python33/lib64/python3.3/importlib/abc.pyu Finder s u Finderu metaclassc B s; | Ee Z d Z d Z e j d d Z d d Z d S( u MetaPathFinderu8 Abstract base class for import finders on sys.meta_path.c C s
t d S( u Abstract method which, when implemented, should find a module.
The fullname is a str and the path is a str or None.
Returns a Loader object.
N( u NotImplementedError( u selfu fullnameu path( ( u2 /opt/alt/python33/lib64/python3.3/importlib/abc.pyu find_module1 s u MetaPathFinder.find_modulec C s t S( u An optional method for clearing the finder's cache, if any.
This method is used by importlib.invalidate_caches().
( u NotImplemented( u self( ( u2 /opt/alt/python33/lib64/python3.3/importlib/abc.pyu invalidate_caches9 s u MetaPathFinder.invalidate_cachesN( u __name__u
__module__u __qualname__u __doc__u abcu abstractmethodu find_moduleu invalidate_caches( u
__locals__( ( u2 /opt/alt/python33/lib64/python3.3/importlib/abc.pyu MetaPathFinder- s u MetaPathFinderc B sD | Ee Z d Z d Z e j d d Z e j Z d d Z
d S( u PathEntryFinderu> Abstract base class for path entry finders used by PathFinder.c C s
t d S( uB Abstract method which, when implemented, returns a module loader.
The fullname is a str. Returns a 2-tuple of (Loader, portion) where
portion is a sequence of file system locations contributing to part of
a namespace package. The sequence may be empty and the loader may be
None.
N( u NotImplementedError( u selfu fullname( ( u2 /opt/alt/python33/lib64/python3.3/importlib/abc.pyu find_loaderG s u PathEntryFinder.find_loaderc C s t S( u An optional method for clearing the finder's cache, if any.
This method is used by PathFinder.invalidate_caches().
( u NotImplemented( u self( ( u2 /opt/alt/python33/lib64/python3.3/importlib/abc.pyu invalidate_cachesS s u! PathEntryFinder.invalidate_cachesN( u __name__u
__module__u __qualname__u __doc__u abcu abstractmethodu find_loaderu
_bootstrapu _find_module_shimu find_moduleu invalidate_caches( u
__locals__( ( u2 /opt/alt/python33/lib64/python3.3/importlib/abc.pyu PathEntryFinderC s
u PathEntryFinderc B sD | Ee Z d Z d Z e j d d Z e j d d Z d S( u Loaderu' Abstract base class for import loaders.c C s
t d S( u[ Abstract method which when implemented should load a module.
The fullname is a str.N( u NotImplementedError( u selfu fullname( ( u2 /opt/alt/python33/lib64/python3.3/importlib/abc.pyu load_module` s u Loader.load_modulec C s
t d S( u^ Abstract method which when implemented calculates and returns the
given module's repr.N( u NotImplementedError( u selfu module( ( u2 /opt/alt/python33/lib64/python3.3/importlib/abc.pyu module_reprf s u Loader.module_reprN( u __name__u
__module__u __qualname__u __doc__u abcu abstractmethodu load_moduleu module_repr( u
__locals__( ( u2 /opt/alt/python33/lib64/python3.3/importlib/abc.pyu Loader\ s u Loaderc B s/ | Ee Z d Z d Z e j d d Z d S( u ResourceLoaderu 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.
c C s
t d S( uw Abstract method which when implemented should return the bytes for
the specified path. The path must be a str.N( u NotImplementedError( u selfu path( ( u2 /opt/alt/python33/lib64/python3.3/importlib/abc.pyu get_datav s u ResourceLoader.get_dataN( u __name__u
__module__u __qualname__u __doc__u abcu abstractmethodu get_data( u
__locals__( ( u2 /opt/alt/python33/lib64/python3.3/importlib/abc.pyu ResourceLoaderm s u ResourceLoaderc B sY | Ee Z d Z d Z e j d d Z e j d d Z e j d d Z d S( u
InspectLoaderu 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.
c C s
t d S( u Abstract method which when implemented should return whether the
module is a package. The fullname is a str. Returns a bool.N( u NotImplementedError( u selfu fullname( ( u2 /opt/alt/python33/lib64/python3.3/importlib/abc.pyu
is_package s u InspectLoader.is_packagec C s
t d S( u Abstract method which when implemented should return the code object
for the module. The fullname is a str. Returns a types.CodeType.N( u NotImplementedError( u selfu fullname( ( u2 /opt/alt/python33/lib64/python3.3/importlib/abc.pyu get_code s u InspectLoader.get_codec C s
t d S( us Abstract method which should return the source code for the
module. The fullname is a str. Returns a str.N( u NotImplementedError( u selfu fullname( ( u2 /opt/alt/python33/lib64/python3.3/importlib/abc.pyu
get_source s u InspectLoader.get_sourceN( u __name__u
__module__u __qualname__u __doc__u abcu abstractmethodu
is_packageu get_codeu
get_source( u
__locals__( ( u2 /opt/alt/python33/lib64/python3.3/importlib/abc.pyu
InspectLoader} s u
InspectLoaderc B s/ | Ee Z d Z d Z e j d d Z d S( u ExecutionLoaderu 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.
c C s
t d S( uT Abstract method which should return the value that __file__ is to be
set to.N( u NotImplementedError( u selfu fullname( ( u2 /opt/alt/python33/lib64/python3.3/importlib/abc.pyu get_filename s u ExecutionLoader.get_filenameN( u __name__u
__module__u __qualname__u __doc__u abcu abstractmethodu get_filename( u
__locals__( ( u2 /opt/alt/python33/lib64/python3.3/importlib/abc.pyu ExecutionLoader s u ExecutionLoaderc B s | Ee Z d Z d Z d S( u
FileLoaderu[ Abstract base class partially implementing the ResourceLoader and
ExecutionLoader ABCs.N( u __name__u
__module__u __qualname__u __doc__( u
__locals__( ( u2 /opt/alt/python33/lib64/python3.3/importlib/abc.pyu
FileLoader s u
FileLoaderc B s> | Ee Z d Z d Z d d Z d d Z d d Z d S( u SourceLoaderu 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 C s5 | j j t j k r t n t | j | d S( u6 Return the (int) modification time for the path (str).u mtime( u
path_statsu __func__u SourceLoaderu NotImplementedErroru int( u selfu path( ( u2 /opt/alt/python33/lib64/python3.3/importlib/abc.pyu
path_mtime s u SourceLoader.path_mtimec C s2 | j j t j k r t n i | j | d 6S( u 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.
u mtime( u
path_mtimeu __func__u SourceLoaderu NotImplementedError( u selfu path( ( u2 /opt/alt/python33/lib64/python3.3/importlib/abc.pyu
path_stats s u SourceLoader.path_statsc C s
t d S( u 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.
N( u NotImplementedError( u selfu pathu data( ( u2 /opt/alt/python33/lib64/python3.3/importlib/abc.pyu set_data s
u SourceLoader.set_dataN( u __name__u
__module__u __qualname__u __doc__u
path_mtimeu
path_statsu set_data( u
__locals__( ( u2 /opt/alt/python33/lib64/python3.3/importlib/abc.pyu SourceLoader s u SourceLoaderc B sP | Ee Z d Z d Z e j d d Z e j d d Z d d Z d S( u PyLoaderug Implement the deprecated PyLoader ABC in terms of SourceLoader.
This class has been deprecated! It is slated for removal in Python 3.4.
If compatibility with Python 3.1 is not needed then implement the
SourceLoader ABC instead of this class. If Python 3.1 compatibility is
needed, then use the following idiom to have a single class that is
compatible with Python 3.1 onwards::
try:
from importlib.abc import SourceLoader
except ImportError:
from importlib.abc import PyLoader as SourceLoader
class CustomLoader(SourceLoader):
def get_filename(self, fullname):
# Implement ...
def source_path(self, fullname):
'''Implement source_path in terms of get_filename.'''
try:
return self.get_filename(fullname)
except ImportError:
return None
def is_package(self, fullname):
filename = os.path.basename(self.get_filename(fullname))
return os.path.splitext(filename)[0] == '__init__'
c C s
t d S( N( u NotImplementedError( u selfu fullname( ( u2 /opt/alt/python33/lib64/python3.3/importlib/abc.pyu
is_package s u PyLoader.is_packagec C s
t d S( uk Abstract method. Accepts a str module name and returns the path to
the source code for the module.N( u NotImplementedError( u selfu fullname( ( u2 /opt/alt/python33/lib64/python3.3/importlib/abc.pyu source_path
s u PyLoader.source_pathc C sE t j d t | j | } | d k r= t d | n | Sd S( u+ Implement get_filename in terms of source_path.
As get_filename should only return a source file path there is no
chance of the path not existing but loading still being possible, so
ImportError should propagate instead of being turned into returning
None.
u importlib.abc.PyLoader is deprecated and is slated for removal in Python 3.4; use SourceLoader instead. See the importlib documentation on how to be compatible with Python 3.1 onwards.u nameN( u warningsu warnu DeprecationWarningu source_pathu Noneu ImportError( u selfu fullnameu path( ( u2 /opt/alt/python33/lib64/python3.3/importlib/abc.pyu get_filename s u PyLoader.get_filenameN( u __name__u
__module__u __qualname__u __doc__u abcu abstractmethodu
is_packageu source_pathu get_filename( u
__locals__( ( u2 /opt/alt/python33/lib64/python3.3/importlib/abc.pyu PyLoader s u PyLoaderc B sq | Ee Z d Z d Z d d Z d d Z e j d d Z e j d d Z e j d
d Z
d S(
u PyPycLoaderu Abstract base class to assist in loading source and bytecode by
requiring only back-end storage methods to be implemented.
This class has been deprecated! Removal is slated for Python 3.4. Implement
the SourceLoader ABC instead. If Python 3.1 compatibility is needed, see
PyLoader.
The methods get_code, get_source, and load_module are implemented for the
user.
c C s] | j | } | d k r | S| j | } | d k r> | St d j | d | d S( u( Return the source or bytecode file path.u. no source or bytecode path available for {0!r}u nameN( u source_pathu Noneu
bytecode_pathu ImportErroru format( u selfu fullnameu path( ( u2 /opt/alt/python33/lib64/python3.3/importlib/abc.pyu get_filename4 s u PyPycLoader.get_filenamec C s t j d t | j | } | j | } | r| j | } yC| d d } t | d k r t d j | d | d | n | d d } t | d k r t d j | n t
j | } | d d } t | d k rt d
j | n | d d } t j
| k rUt d j | d | d | n | r| | k rt d d | d | qn Wn* t t f k
r| d k rn YqXt j | Sn* | d k rt d j | d | n | j | }
|
d k r,d
j | } t | d | n | j |
} t | |
d d d }
t j st t j
} | j t
j | | j t
j t | d @ | j t j |
| j | | n |
S( u* Get a code object from source or bytecode.u importlib.abc.PyPycLoader is deprecated and slated for removal in Python 3.4; use SourceLoader instead. If Python 3.1 compatibility is required, see the latest documentation for PyLoader.Ni u bad magic number in {}u nameu pathi u bad timestamp in {}i u bad file size in {}u bytecode is staleu? no source or bytecode available to create code object for {0!r}u$ a source path must exist to load {0}u execu dont_inheritl T( u warningsu warnu DeprecationWarningu source_mtimeu
bytecode_pathu get_datau lenu ImportErroru formatu EOFErroru
_bootstrapu _r_longu impu get_magicu Noneu marshalu loadsu source_pathu compileu Trueu sysu dont_write_bytecodeu bytearrayu extendu _w_longu dumpsu write_bytecode( u selfu fullnameu source_timestampu
bytecode_pathu datau magicu
raw_timestampu
pyc_timestampu raw_source_sizeu bytecodeu source_pathu messageu sourceu code_object( ( u2 /opt/alt/python33/lib64/python3.3/importlib/abc.pyu get_code? sd u PyPycLoader.get_codec C s
t d S( ur Abstract method. Accepts a str filename and returns an int
modification time for the source of the module.N( u NotImplementedError( u selfu fullname( ( u2 /opt/alt/python33/lib64/python3.3/importlib/abc.pyu source_mtime s u PyPycLoader.source_mtimec C s
t d S( ul Abstract method. Accepts a str filename and returns the str pathname
to the bytecode for the module.N( u NotImplementedError( u selfu fullname( ( u2 /opt/alt/python33/lib64/python3.3/importlib/abc.pyu
bytecode_path s u PyPycLoader.bytecode_pathc C s
t d S( u Abstract method. Accepts a str filename and bytes object
representing the bytecode for the module. Returns a boolean
representing whether the bytecode was written or not.N( u NotImplementedError( u selfu fullnameu bytecode( ( u2 /opt/alt/python33/lib64/python3.3/importlib/abc.pyu write_bytecode s u PyPycLoader.write_bytecodeN( u __name__u
__module__u __qualname__u __doc__u get_filenameu get_codeu abcu abstractmethodu source_mtimeu
bytecode_pathu write_bytecode( u
__locals__( ( u2 /opt/alt/python33/lib64/python3.3/importlib/abc.pyu PyPycLoader& s Du PyPycLoader($ u __doc__u u
_bootstrapu machineryu _frozen_importlibu ImportErroru excu nameu Noneu abcu impu marshalu sysu tokenizeu warningsu _registeru ABCMetau Finderu MetaPathFinderu BuiltinImporteru FrozenImporteru
PathFinderu WindowsRegistryFinderu PathEntryFinderu
FileFinderu Loaderu ResourceLoaderu
InspectLoaderu ExtensionFileLoaderu ExecutionLoaderu
FileLoaderu SourceFileLoaderu SourcelessFileLoaderu SourceLoaderu PyLoaderu PyPycLoader( ( ( u2 /opt/alt/python33/lib64/python3.3/importlib/abc.pyu