bversion/storage/versioned_storage.py
def flatten_dir_tree(self, tree):
        """ Convert a file tree back into a flat dict """

        result = {}

        def helper(tree, leading_path = ''):
            dirs  = tree['dirs']; files = tree['files']
            for name, file_info in files.items():
                file_info['path'] = leading_path + '/'  + name
                result[file_info['path']] = file_info

            for name, contents in dirs.items():
                helper(contents, leading_path +'/'+ name)
        helper(tree); return result
 Convert a file tree back into a flat dict 
Convert a file tree back into a flat dict
Convert a file tree back into a flat dict
def flatten_dir_tree(self, tree):
        result = {}
        def helper(tree, leading_path = ''):
            dirs  = tree['dirs']; files = tree['files']
            for name, file_info in files.items():
                file_info['path'] = leading_path + '/'  + name
                result[file_info['path']] = file_info
            for name, contents in dirs.items():
                helper(contents, leading_path +'/'+ name)
        helper(tree); return result
def flatten_dir_tree ( self , tree ) : result = { } def helper ( tree , leading_path = '' ) : dirs = tree [ 'dirs' ] ; files = tree [ 'files' ] for name , file_info in files . items ( ) : file_info [ 'path' ] = leading_path + '/' + name result [ file_info [ 'path' ] ] = file_info for name , contents in dirs . items ( ) : helper ( contents , leading_path + '/' + name ) helper ( tree ) ; return result
Convert a file tree back into a flat dict
Convert a file tree back into a flat dict
""" Convert a file tree back into a flat dict """
self
tree