Peragro-AT
 All Classes Namespaces Functions Pages
Functions | Variables
damn_at.damnfs.path Namespace Reference

Functions

def attach
 
def prettify
 
def normdirpath
 
def path_depth
 
def expand_path
 
def file_ids_as_tree
 
def get_files_for_path
 
def find_path_for_file_id
 
def parse_path
 

Variables

string FILE_MARKER = '<children>'
 

Detailed Description

Path utilities for DAMN FS

Function Documentation

def damn_at.damnfs.path.attach (   file_id,
  trunk,
  branch = None 
)
Insert a branch of directories on its trunk.

Here is the caller graph for this function:

def damn_at.damnfs.path.expand_path (   path,
  start_path,
  base_depth 
)
Make a path relative to the given starting path and make the path
atleast base_depth deep by prepending '_' directories.

:param path: :py:class:`string`: the path to expand
:param start_path: :py:class:`damn_at.FileDescription`: the starting path
:param base_depth: :py:class:`int`: how deep the the base file should be
:rtype: :py:class:`string`

Here is the call graph for this function:

Here is the caller graph for this function:

def damn_at.damnfs.path.file_ids_as_tree (   file_ids,
  start_path 
)
Create a tree like structure using the filenames of the given FileIds.

:param file_ids: :py:func:`list` of :py:class:`damn_at.thrift.generated.damn_types.ttypes.FileId`
:param start_path: :py:class:`string`: the base path
:rtype: :py:class:`dict` {'adir':<>, '<files>':[...]}

Here is the call graph for this function:

def damn_at.damnfs.path.find_path_for_file_id (   file_ids_tree,
  file_id 
)
Traverse the FileIds tree to construct a path for the given FileId

:param file_ids_tree: :py:class:`dict` {'adir':<>, '<files>':[...]}
:param file_id: :py:class:`damn_at.thrift.generated.damn_types.ttypes.FileId`: the fileId we're looking for
:rtype: :py:class:`string`: the path
def damn_at.damnfs.path.get_files_for_path (   file_ids_tree,
  path 
)
Traverse the FileIds tree with the given path and return the sub-tree
at that level or the file if a leaf-node.

:param file_ids_tree: :py:class:`dict` {'adir':<>, '<files>':[...]}
:param path: :py:class:`string`: the path
:rtype: :py:class:`dict` {'adir':<>, '<files>':[...]}
def damn_at.damnfs.path.normdirpath (   path)
Make a directory path end with /

Here is the caller graph for this function:

def damn_at.damnfs.path.parse_path (   path)
Parse a path of /hash/action/my/path returning a tuple of
('hash', 'action', '/my/path') or None values if a shorter path is
given.

:param path: :py:class:`string`: the path
:rtype: :py:func:`tuple`
def damn_at.damnfs.path.path_depth (   path)
Give the depth, the number of directories deep, of a path

Here is the caller graph for this function:

def damn_at.damnfs.path.prettify (   tree,
  indent = 0 
)
Print the file tree structure with proper indentation.