f9c@sUdZddlmZddlmZyddlZWn@ek rxZz ejdkr`ndZWYddZ[XnXddl Z ddl Z ddl Z ddl Z ddl Z ddlZddZGd d d d e jZGd d d eZeeejejejejGdddeZeeejGdddd e jZGdddeZGdddeZeeejejejGdddeZGdddejeeZeeejej Gdddej!eeZ!ee!ejGddde!Z"Gddde"Z#dS( u(Abstract base classes related to import.i(u _bootstrap(u machineryiNu_frozen_importlibcGsPxI|D]A}|j|tdk rtt|j}|j|qqWdS(N(uregisteru_frozen_importlibuNoneugetattru__name__(u abstract_clsuclassesuclsu frozen_cls((u2/opt/alt/python33/lib64/python3.3/importlib/abc.pyu _registers    u _registercBs2|EeZdZdZejdddZdS(uFinderuLegacy 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. cCs tdS(uAn 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(uNotImplementedError(uselfufullnameupath((u2/opt/alt/python33/lib64/python3.3/importlib/abc.pyu find_module$suFinder.find_moduleN(u__name__u __module__u __qualname__u__doc__uabcuabstractmethoduNoneu find_module(u __locals__((u2/opt/alt/python33/lib64/python3.3/importlib/abc.pyuFindersuFinderu metaclasscBs;|EeZdZdZejddZddZdS(uMetaPathFinderu8Abstract base class for import finders on sys.meta_path.cCs tdS(uAbstract 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(uNotImplementedError(uselfufullnameupath((u2/opt/alt/python33/lib64/python3.3/importlib/abc.pyu find_module1suMetaPathFinder.find_modulecCstS(uAn optional method for clearing the finder's cache, if any. This method is used by importlib.invalidate_caches(). (uNotImplemented(uself((u2/opt/alt/python33/lib64/python3.3/importlib/abc.pyuinvalidate_caches9su MetaPathFinder.invalidate_cachesN(u__name__u __module__u __qualname__u__doc__uabcuabstractmethodu find_moduleuinvalidate_caches(u __locals__((u2/opt/alt/python33/lib64/python3.3/importlib/abc.pyuMetaPathFinder-suMetaPathFindercBsD|EeZdZdZejddZejZ ddZ dS(uPathEntryFinderu>Abstract base class for path entry finders used by PathFinder.cCs tdS(uBAbstract 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(uNotImplementedError(uselfufullname((u2/opt/alt/python33/lib64/python3.3/importlib/abc.pyu find_loaderGsuPathEntryFinder.find_loadercCstS(uAn optional method for clearing the finder's cache, if any. This method is used by PathFinder.invalidate_caches(). (uNotImplemented(uself((u2/opt/alt/python33/lib64/python3.3/importlib/abc.pyuinvalidate_cachesSsu!PathEntryFinder.invalidate_cachesN( u__name__u __module__u __qualname__u__doc__uabcuabstractmethodu find_loaderu _bootstrapu_find_module_shimu find_moduleuinvalidate_caches(u __locals__((u2/opt/alt/python33/lib64/python3.3/importlib/abc.pyuPathEntryFinderCs uPathEntryFindercBsD|EeZdZdZejddZejddZdS(uLoaderu'Abstract base class for import loaders.cCs tdS(u[Abstract method which when implemented should load a module. The fullname is a str.N(uNotImplementedError(uselfufullname((u2/opt/alt/python33/lib64/python3.3/importlib/abc.pyu load_module`suLoader.load_modulecCs tdS(u^Abstract method which when implemented calculates and returns the given module's repr.N(uNotImplementedError(uselfumodule((u2/opt/alt/python33/lib64/python3.3/importlib/abc.pyu module_reprfsuLoader.module_reprN(u__name__u __module__u __qualname__u__doc__uabcuabstractmethodu load_moduleu module_repr(u __locals__((u2/opt/alt/python33/lib64/python3.3/importlib/abc.pyuLoader\suLoadercBs/|EeZdZdZejddZdS(uResourceLoaderuAbstract 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. cCs tdS(uwAbstract method which when implemented should return the bytes for the specified path. The path must be a str.N(uNotImplementedError(uselfupath((u2/opt/alt/python33/lib64/python3.3/importlib/abc.pyuget_datavsuResourceLoader.get_dataN(u__name__u __module__u __qualname__u__doc__uabcuabstractmethoduget_data(u __locals__((u2/opt/alt/python33/lib64/python3.3/importlib/abc.pyuResourceLoadermsuResourceLoadercBsY|EeZdZdZejddZejddZejddZdS( u InspectLoaderuAbstract 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. cCs tdS(uAbstract method which when implemented should return whether the module is a package. The fullname is a str. Returns a bool.N(uNotImplementedError(uselfufullname((u2/opt/alt/python33/lib64/python3.3/importlib/abc.pyu is_packagesuInspectLoader.is_packagecCs tdS(uAbstract method which when implemented should return the code object for the module. The fullname is a str. Returns a types.CodeType.N(uNotImplementedError(uselfufullname((u2/opt/alt/python33/lib64/python3.3/importlib/abc.pyuget_codesuInspectLoader.get_codecCs tdS(usAbstract method which should return the source code for the module. The fullname is a str. Returns a str.N(uNotImplementedError(uselfufullname((u2/opt/alt/python33/lib64/python3.3/importlib/abc.pyu get_sourcesuInspectLoader.get_sourceN( u__name__u __module__u __qualname__u__doc__uabcuabstractmethodu is_packageuget_codeu get_source(u __locals__((u2/opt/alt/python33/lib64/python3.3/importlib/abc.pyu InspectLoader}su InspectLoadercBs/|EeZdZdZejddZdS(uExecutionLoaderuAbstract 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. cCs tdS(uTAbstract method which should return the value that __file__ is to be set to.N(uNotImplementedError(uselfufullname((u2/opt/alt/python33/lib64/python3.3/importlib/abc.pyu get_filenamesuExecutionLoader.get_filenameN(u__name__u __module__u __qualname__u__doc__uabcuabstractmethodu get_filename(u __locals__((u2/opt/alt/python33/lib64/python3.3/importlib/abc.pyuExecutionLoadersuExecutionLoadercBs|EeZdZdZdS(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 FileLoadersu FileLoadercBs>|EeZdZdZddZddZddZdS( u SourceLoaderuAbstract 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 cCs5|jjtjkrtnt|j|dS(u6Return the (int) modification time for the path (str).umtime(u path_statsu__func__u SourceLoaderuNotImplementedErroruint(uselfupath((u2/opt/alt/python33/lib64/python3.3/importlib/abc.pyu path_mtimes uSourceLoader.path_mtimecCs2|jjtjkrtni|j|d6S(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. umtime(u path_mtimeu__func__u SourceLoaderuNotImplementedError(uselfupath((u2/opt/alt/python33/lib64/python3.3/importlib/abc.pyu path_statss uSourceLoader.path_statscCs tdS(uWrite 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(uNotImplementedError(uselfupathudata((u2/opt/alt/python33/lib64/python3.3/importlib/abc.pyuset_datas uSourceLoader.set_dataN(u__name__u __module__u __qualname__u__doc__u path_mtimeu path_statsuset_data(u __locals__((u2/opt/alt/python33/lib64/python3.3/importlib/abc.pyu SourceLoaders  u SourceLoadercBsP|EeZdZdZejddZejddZddZdS( uPyLoaderugImplement 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__' cCs tdS(N(uNotImplementedError(uselfufullname((u2/opt/alt/python33/lib64/python3.3/importlib/abc.pyu is_packagesuPyLoader.is_packagecCs tdS(ukAbstract method. Accepts a str module name and returns the path to the source code for the module.N(uNotImplementedError(uselfufullname((u2/opt/alt/python33/lib64/python3.3/importlib/abc.pyu source_path suPyLoader.source_pathcCsEtjdt|j|}|dkr=td|n|SdS(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. uimportlib.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.unameN(uwarningsuwarnuDeprecationWarningu source_pathuNoneu ImportError(uselfufullnameupath((u2/opt/alt/python33/lib64/python3.3/importlib/abc.pyu get_filenames  uPyLoader.get_filenameN( u__name__u __module__u __qualname__u__doc__uabcuabstractmethodu is_packageu source_pathu get_filename(u __locals__((u2/opt/alt/python33/lib64/python3.3/importlib/abc.pyuPyLoadersuPyLoadercBsq|EeZdZdZddZddZejddZejdd Z ejd d Z d S( u PyPycLoaderuAbstract 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. cCs]|j|}|dk r|S|j|}|dk r>|Stdj|d|dS(u(Return the source or bytecode file path.u.no source or bytecode path available for {0!r}unameN(u source_pathuNoneu bytecode_pathu ImportErroruformat(uselfufullnameupath((u2/opt/alt/python33/lib64/python3.3/importlib/abc.pyu get_filename4s   uPyPycLoader.get_filenamecCstjdt|j|}|j|}|r|j|}yC|dd}t|dkrtdj|d|d|n|dd}t|dkrt dj|nt j |}|dd }t|dkrt d j|n|d d} t j |krUtdj|d|d|n|r||krtd d|d|qnWn*tt fk r|dk rnYqXtj| Sn*|dkrtd j|d|n|j|} | dkr,d j|} t| d|n|j| } t| | ddd} tjstt j }|jt j||jt jt| d@|jtj| |j||n| S(u*Get a code object from source or bytecode.uimportlib.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.Niubad magic number in {}unameupathiubad timestamp in {}i ubad file size in {}ubytecode is staleu?no source or bytecode available to create code object for {0!r}u$a source path must exist to load {0}uexecu dont_inheritlT(uwarningsuwarnuDeprecationWarningu source_mtimeu bytecode_pathuget_dataulenu ImportErroruformatuEOFErroru _bootstrapu_r_longuimpu get_magicuNoneumarshaluloadsu source_pathucompileuTrueusysudont_write_bytecodeu bytearrayuextendu_w_longudumpsuwrite_bytecode(uselfufullnameusource_timestampu bytecode_pathudataumagicu raw_timestampu pyc_timestampuraw_source_sizeubytecodeu source_pathumessageusourceu code_object((u2/opt/alt/python33/lib64/python3.3/importlib/abc.pyuget_code?sd          uPyPycLoader.get_codecCs tdS(urAbstract method. Accepts a str filename and returns an int modification time for the source of the module.N(uNotImplementedError(uselfufullname((u2/opt/alt/python33/lib64/python3.3/importlib/abc.pyu source_mtimesuPyPycLoader.source_mtimecCs tdS(ulAbstract method. Accepts a str filename and returns the str pathname to the bytecode for the module.N(uNotImplementedError(uselfufullname((u2/opt/alt/python33/lib64/python3.3/importlib/abc.pyu bytecode_pathsuPyPycLoader.bytecode_pathcCs tdS(uAbstract 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(uNotImplementedError(uselfufullnameubytecode((u2/opt/alt/python33/lib64/python3.3/importlib/abc.pyuwrite_bytecodesuPyPycLoader.write_bytecodeN( u__name__u __module__u __qualname__u__doc__u get_filenameuget_codeuabcuabstractmethodu source_mtimeu bytecode_pathuwrite_bytecode(u __locals__((u2/opt/alt/python33/lib64/python3.3/importlib/abc.pyu PyPycLoader&s   Du PyPycLoader($u__doc__uu _bootstrapu machineryu_frozen_importlibu ImportErroruexcunameuNoneuabcuimpumarshalusysutokenizeuwarningsu _registeruABCMetauFinderuMetaPathFinderuBuiltinImporteruFrozenImporteru PathFinderuWindowsRegistryFinderuPathEntryFinderu FileFinderuLoaderuResourceLoaderu InspectLoaderuExtensionFileLoaderuExecutionLoaderu FileLoaderuSourceFileLoaderuSourcelessFileLoaderu SourceLoaderuPyLoaderu PyPycLoader(((u2/opt/alt/python33/lib64/python3.3/importlib/abc.pyusD          .A