Back to index

python3.2  3.2.2
Public Member Functions | Public Attributes
importlib._bootstrap._FileFinder Class Reference

List of all members.

Public Member Functions

def __init__
def find_module

Public Attributes


Detailed Description

File-based finder.

Constructor takes a list of objects detailing what file extensions their
loader supports along with whether it can be used for a package.

Definition at line 642 of file

Constructor & Destructor Documentation

def importlib._bootstrap._FileFinder.__init__ (   self,
Initialize with finder details.

Definition at line 651 of file

00652     def __init__(self, path, *details):
00653         """Initialize with finder details."""
00654         packages = []
00655         modules = []
00656         for detail in details:
00657             modules.extend((suffix, detail.loader) for suffix in detail.suffixes)
00658             if detail.supports_packages:
00659                 packages.extend((suffix, detail.loader)
00660                                 for suffix in detail.suffixes)
00661         self.packages = packages
00662         self.modules = modules
00663         self.path = path

Here is the caller graph for this function:

Member Function Documentation

def importlib._bootstrap._FileFinder.find_module (   self,
Try to find a loader for the specified module.

Definition at line 664 of file

00665     def find_module(self, fullname):
00666         """Try to find a loader for the specified module."""
00667         tail_module = fullname.rpartition('.')[2]
00668         base_path = _path_join(self.path, tail_module)
00669         if _path_isdir(base_path) and _case_ok(self.path, tail_module):
00670             for suffix, loader in self.packages:
00671                 init_filename = '__init__' + suffix
00672                 full_path = _path_join(base_path, init_filename)
00673                 if (_path_isfile(full_path) and
00674                         _case_ok(base_path, init_filename)):
00675                     return loader(fullname, full_path)
00676             else:
00677                 msg = "Not importing directory {}: missing __init__"
00678                 _warnings.warn(msg.format(base_path), ImportWarning)
00679         for suffix, loader in self.modules:
00680             mod_filename = tail_module + suffix
00681             full_path = _path_join(self.path, mod_filename)
00682             if _path_isfile(full_path) and _case_ok(self.path, mod_filename):
00683                 return loader(fullname, full_path)
00684         return None

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation

Definition at line 661 of file

Definition at line 660 of file

Definition at line 662 of file

The documentation for this class was generated from the following file: