sys.path_hooks.append

Here are the examples of the python api sys.path_hooks.append taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

21 Examples 7

Example 1

Project: codegenloader
Source File: base.py
View license
    @classmethod
    def _install_hook(cls):
        """Installs this loader as a ``path_hook``."""
        if hasattr(cls, "_hook_installed"):
            return
        sys.path_hooks.append(cls)
        cls._hook_installed = True

Example 2

Project: Ivoire
Source File: transform.py
View license
    @classmethod
    def register(cls):
        """
        Register the path hook.

        """

        cls._finder = FileFinder.path_hook((cls, [cls.suffix]))
        sys.path_hooks.append(cls._finder)

Example 3

Project: Ivoire
Source File: transform.py
View license
    @classmethod
    def register(cls):
        """
        Register the path hook.

        """

        cls._finder = FileFinder.path_hook((cls, [cls.suffix]))
        sys.path_hooks.append(cls._finder)

Example 4

Project: pymo
Source File: test_importhooks.py
View license
    def testPathHook(self):
        sys.path_hooks.append(PathImporter)
        sys.path.append(test_path)
        self.doTestImports()

Example 5

Project: imagrium
Source File: test_importhooks.py
View license
    def testPathHook(self):
        sys.path_hooks.append(PathImporter)
        sys.path.append(test_path)
        self.doTestImports()

Example 6

Project: babble
Source File: test_importhooks.py
View license
    def testPathHook(self):
        sys.path_hooks.append(PathImporter)
        sys.path.append(test_path)
        self.doTestImports()

Example 7

Project: TrustRouter
Source File: test_importhooks.py
View license
    def testPathHook(self):
        sys.path_hooks.append(PathImporter)
        sys.path.append(test_path)
        self.doTestImports()

Example 8

Project: TrustRouter
Source File: test_threaded_import.py
View license
    def test_parallel_path_hooks(self):
        # Here the Finder instance is only used to check concurrent calls
        # to path_hook().
        finder = Finder()
        # In order for our path hook to be called at each import, we need
        # to flush the path_importer_cache, which we do by registering a
        # dedicated meta_path entry.
        flushing_finder = FlushingFinder()
        def path_hook(path):
            finder.find_module('')
            raise ImportError
        sys.path_hooks.append(path_hook)
        sys.meta_path.append(flushing_finder)
        try:
            # Flush the cache a first time
            flushing_finder.find_module('')
            numtests = self.check_parallel_module_init()
            self.assertGreater(finder.numcalls, 0)
            self.assertEqual(finder.x, finder.numcalls)
        finally:
            sys.meta_path.remove(flushing_finder)
            sys.path_hooks.remove(path_hook)

Example 9

Project: chipsec
Source File: test_importhooks.py
View license
    def testPathHook(self):
        sys.path_hooks.append(PathImporter)
        sys.path.append(test_path)
        self.doTestImports()

Example 10

Project: datafari
Source File: test_importhooks.py
View license
    def testPathHook(self):
        sys.path_hooks.append(PathImporter)
        sys.path.append(test_path)
        self.doTestImports()

Example 11

Project: openwrt-mt7620
Source File: test_importhooks.py
View license
    def testPathHook(self):
        sys.path_hooks.append(PathImporter)
        sys.path.append(test_path)
        self.doTestImports()

Example 12

Project: openwrt-mt7620
Source File: test_importhooks.py
View license
    def testPathHook(self):
        sys.path_hooks.append(PathImporter)
        sys.path.append(test_path)
        self.doTestImports()

Example 13

Project: badideas
Source File: githubimporter.py
View license
def install_hook():
    sys.path_hooks.append(GithubImporter)

Example 14

Project: python-git-orm
Source File: test_importer.py
View license
def setup_module():
    sys.path_hooks.append(GitImporter)
    sys.path.append('{}/config'.format(PATH_PREFIX))

Example 15

Project: python-git-orm
Source File: test_importer.py
View license
def setup_module():
    sys.path_hooks.append(GitImporter)
    sys.path.append('{}/config'.format(PATH_PREFIX))

Example 16

Project: neuroConstruct
Source File: test_importhooks.py
View license
    def testPathHook(self):
        sys.path_hooks.append(PathImporter)
        sys.path.append(test_path)
        self.doTestImports()

Example 17

Project: neuroConstruct
Source File: test_importhooks.py
View license
    def testPathHook(self):
        sys.path_hooks.append(PathImporter)
        sys.path.append(test_path)
        self.doTestImports()

Example 18

Project: phpsploit
Source File: stateMachine2.py
View license
    @classmethod
    def register(cls):
        sys.path_hooks.append(cls)
        sys.path.append(cls.trigger_url())

Example 19

Project: phpsploit
Source File: stateMachine2.py
View license
    @classmethod
    def register(cls):
        sys.path_hooks.append(cls)
        sys.path.append(cls.trigger_url())

Example 20

Project: medicare-demo
Source File: test_importhooks.py
View license
    def testPathHook(self):
        sys.path_hooks.append(PathImporter)
        sys.path.append(test_path)
        self.doTestImports()

Example 21

Project: PyAutoC
Source File: test_importhooks.py
View license
    def testPathHook(self):
        sys.path_hooks.append(PathImporter)
        sys.path.append(test_path)
        self.doTestImports()