Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def update_files_dictionary(self, root, prefix):
# Build a mapping from paths to the results of `os.stat` calls
# so we only have to touch the filesystem once
stat_cache = dict(scantree(root))
for path in stat_cache.keys():
relative_path = path[len(root) :]
relative_url = relative_path.replace("\\", "/")
url = prefix + relative_url
self.add_file_to_dictionary(url, path, stat_cache=stat_cache)