示例#1
0
    def clear_dircache(self, *paths):
        """
        Clear cached directory information.

        :param path: Path of directory to clear cache for, or all directories if
        None (the default)

        """

        if not paths:
            self.dircache.clear()
        else:
            dircache = self.dircache
            paths = [normpath(abspath(path)) for path in paths]
            for cached_path in dircache.keys():
                for path in paths:
                    if isbase(cached_path, path):
                        dircache.pop(cached_path, None)
                        break
示例#2
0
    def clear_dircache(self, *paths):
        """
        Clear cached directory information.

        :param path: Path of directory to clear cache for, or all directories if
        None (the default)

        """

        if not paths:
            self.dircache.clear()
        else:
            dircache = self.dircache
            paths = [normpath(abspath(path)) for path in paths]
            for cached_path in dircache.keys():
                for path in paths:
                    if isbase(cached_path, path):
                        dircache.pop(cached_path, None)
                        break
示例#3
0
 def test_isbase(self):
     self.assertTrue(isbase("foo", "foo/bar"))
     self.assertFalse(isbase("baz", "foo/bar"))