def testPrsort(self): in_lst = ["B", "A", "a", "1", "b", "/", "", "2"]; out_lst = ["b", "a", "B", "A", "2", "1", "/", ""]; utils.prsort(in_lst); self.assertEqual(in_lst, out_lst);
def mapPath(self, path): if self.__cygwinPlatform: return path; # sort to map to /e/bar/foo in pefrence /e/bar l = cautils.prsort(list(self.__map.keys())); for cygpath in l: if path.find(cygpath) == 0: path = path.replace(cygpath, self.__map[cygpath]); return path; return self.__root + path;
def mapPath(self, path): if self.__cygwinPlatform: return path # does map a path that has been already mapped if ':' in path: return path # sort to map to /e/bar/foo in pefrence /e/bar l = cautils.prsort(list(self.__map.keys())) for cygpath in l: index = path.find(cygpath) if index == 0: return self.__map[cygpath] + path[len(cygpath):] if cygpath.rstrip('/') == path: return self.__map[cygpath].rstrip('/') return self.__root + path
def mapPath(self, path): if self.__cygwinPlatform: return path; # does map a path that has been already mapped if ':' in path : return path; # sort to map to /e/bar/foo in pefrence /e/bar l = cautils.prsort(list(self.__map.keys())); for cygpath in l: index = path.find(cygpath); if index == 0: return self.__map[cygpath]+path[len(cygpath):]; if cygpath.rstrip('/') == path : return self.__map[cygpath].rstrip('/'); return self.__root + path;