Python pkgutil.ImpLoader() Examples

The following are 4 code examples of pkgutil.ImpLoader(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module pkgutil , or try the search function .
Example #1
Source File: auto2to3.py    From kgsgo-dataset-preprocessor with Mozilla Public License 2.0 6 votes vote down vote up
def find_module(self, fullname, path=None):
        # this duplicates most of ImpImporter.find_module
        subname = fullname.split(".")[-1]
        if subname != fullname and self.path is None:
            return None
        if self.path is None:
            path = None
        else:
            path = [os.path.realpath(self.path)]
        try:
            file, filename, etc = imp.find_module(subname, path)
        except ImportError:
            return None
        if file and etc[2] == imp.PY_SOURCE:
            outfilename = maybe_2to3(filename, modname=fullname)
            if outfilename != filename:
                file.close()
                filename = outfilename
                file = open(filename, 'rb')
        return ImpLoader(fullname, file, filename, etc)


# setup the hook 
Example #2
Source File: test_pkgutil.py    From Fluid-Designer with GNU General Public License v3.0 5 votes vote down vote up
def test_loader_deprecated(self):
        with self.check_deprecated():
            x = pkgutil.ImpLoader("", "", "", "") 
Example #3
Source File: test_pkgutil.py    From ironpython3 with Apache License 2.0 5 votes vote down vote up
def test_loader_deprecated(self):
        with self.check_deprecated():
            x = pkgutil.ImpLoader("", "", "", "") 
Example #4
Source File: test_pkgutil.py    From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 5 votes vote down vote up
def test_loader_deprecated(self):
        with self.check_deprecated():
            pkgutil.ImpLoader("", "", "", "")