How to use the importlab.fs.OSFileSystem function in importlab

To help you get started, we’ve selected a few importlab examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github google / importlab / tests / test_fs.py View on Github external
def setUp(self):
        self.tempdir = utils.Tempdir()
        self.tempdir.setup()
        for f in FILES:
            self.tempdir.create_file(f, FILES[f])
        self.fs = fs.OSFileSystem(self.tempdir.path)
github google / importlab / tests / test_resolve.py View on Github external
def testResolveSystemRelative(self):
        with utils.Tempdir() as d:
            os_fs = fs.OSFileSystem(d.path)
            fspath = [os_fs]
            d.create_file("foo/x.py")
            d.create_file("foo/y.py")
            imp = parsepy.ImportStatement(".y")
            module = resolve.System(d["foo/x.py"], "foo.x")
            r = resolve.Resolver(fspath, module)
            f = r.resolve_import(imp)
            self.assertEqual(f.path, d["foo/y.py"])
            self.assertTrue(isinstance(f, resolve.System))
            self.assertEqual(f.module_name, "foo.y")
github google / importlab / tests / test_fs.py View on Github external
def setUp(self):
        self.tempdir = utils.Tempdir()
        self.tempdir.setup()
        for f in FILES:
            self.tempdir.create_file(f, FILES[f])
        self.fs = LowercasingFileSystem(
                fs.OSFileSystem(self.tempdir.path))
github google / importlab / importlab / fs.py View on Github external
def add_path(self, path, kind='os'):
        if kind == 'os':
            path = OSFileSystem(path)
        elif kind == 'pyi':
            path = PYIFileSystem(OSFileSystem(path))
        else:
            raise FileSystemError('Unrecognized filesystem type: ', kind)
        self.paths.append(path)