def walk_filesystem(self): candidates = {} rootpath = utils.from_unicode(self.ROOTPATH) for dirpath, dirnames, files in os.walk(rootpath): try: dirpath = utils.to_unicode(dirpath) except UnicodeDecodeError as e: continue rel_dirpath = os.path.relpath(dirpath, start=self.ROOTPATH) logger.debug("'%s' '%s'" % (dirpath, rel_dirpath)) if rel_dirpath != '.': objname = utils.to_standard_sep(rel_dirpath) candidates[objname] = self.none_info() for filename in files: try: filename = utils.to_unicode(filename) except UnicodeDecodeError as e: continue if rel_dirpath == '.': prefix = "" else: prefix = utils.to_standard_sep(rel_dirpath) objname = utils.join_objname(prefix, filename) candidates[objname] = self.none_info() db_cands = dict((name, self.none_info()) for name in self.list_files()) candidates.update(db_cands) logger.debug("Candidates: %s" % candidates) return candidates
def walk_filesystem(self): candidates = {} rootpath = utils.from_unicode(self.ROOTPATH) for dirpath, dirnames, files in os.walk(rootpath): try: dirpath = utils.to_unicode(dirpath) except UnicodeDecodeError as e: continue rel_dirpath = os.path.relpath(dirpath, start=self.ROOTPATH) logger.debug("'%s' '%s'" % (dirpath, rel_dirpath)) if rel_dirpath != ".": objname = utils.to_standard_sep(rel_dirpath) candidates[objname] = self.none_info() for filename in files: try: filename = utils.to_unicode(filename) except UnicodeDecodeError as e: continue if rel_dirpath == ".": prefix = "" else: prefix = utils.to_standard_sep(rel_dirpath) objname = utils.join_objname(prefix, filename) candidates[objname] = self.none_info() db_cands = dict((name, self.none_info()) for name in self.list_files()) candidates.update(db_cands) logger.debug("Candidates: %s" % candidates) return candidates
def handle_path(path, rec=False): try: path = utils.to_unicode(path) except UnicodeDecodeError as e: return if path.startswith(self.CACHEPATH): return rel_path = os.path.relpath(path, start=self.ROOTPATH) if rel_path == '.': return objname = utils.to_standard_sep(rel_path) leaves = self.get_dir_contents(objname) if rec else None with self.probe_candidates.lock() as d: d[objname] = self.none_info() if rec: for leaf in leaves: d[leaf] = self.none_info()
def handle_path(path, rec=False): try: path = utils.to_unicode(path) except UnicodeDecodeError as e: return if path.startswith(self.CACHEPATH): return rel_path = os.path.relpath(path, start=self.ROOTPATH) if rel_path == ".": return objname = utils.to_standard_sep(rel_path) leaves = self.get_dir_contents(objname) if rec else None with self.probe_candidates.lock() as d: d[objname] = self.none_info() if rec: for leaf in leaves: d[leaf] = self.none_info()