Package mrv :: Module interface :: Class iDagItem
[hide private]
[frames] | no frames]

Class iDagItem

source code

object --+    
         |    
 Interface --+
             |
            iDagItem
Known Subclasses:

Describes interface for a DAG item. Its used to unify interfaces allowing to access objects in a dag like graph Of the underlying object has a string representation, the defatult implementation will work natively. Otherwise the getParent and getChildren methods should be overwritten
Notes:
Instance Methods [hide private]

Inherited from Interface: supports

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __init__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

    Query Methods
 
isRoot(self)
Returns: True if this path is the root of the DAG
source code
 
root(self)
Returns: the root of the DAG - it has no further parents
source code
 
basename(self)
Returns: basename of this path, '/hello/world' -> 'world'
source code
 
parent(self)
Returns: parent of this path, '/hello/world' -> '/hello' or None if this path is the dag's root
source code
 
parentDeep(self)
Returns: all parents of this path, '/hello/my/world' -> [ '/hello/my','/hello' ]
source code
 
children(self, predicate=<function <lambda> at 0x7f8b493d65f0>)
Returns: list of intermediate children of path, [ child1 , child2 ]
source code
 
childrenDeep(self, order=1, predicate=<function <lambda> at 0x7f8b493d66e0>)
Returns: list of all children of path, [ child1 , child2 ]
source code
 
isPartOf(self, other)
Returns: True if self is a part of other, and thus can be found in other
source code
 
isRootOf(self, other)
Returns: True other starts with self
source code
    Iterators
 
iterParents(self, predicate=<function <lambda> at 0x7f8b493d68c0>)
Returns: generator retrieving all parents up to the root
source code
    Name Generation
 
fullChildName(self, childname)
Add the given name to the string version of our instance :return: string with childname added like name _sep childname
source code
Class Methods [hide private]
    Name Generation
 
addSep(cls, item, sep)
Returns: item with separator added to it ( just once )
source code
Class Variables [hide private]
  kOrder_BreadthFirst = 1
  kOrder_DepthFirst = 0
    Configuration
  _sep = None
hash(x)
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

isRoot(self)

source code 
Returns:
True if this path is the root of the DAG

root(self)

source code 
Returns:
the root of the DAG - it has no further parents

basename(self)

source code 
Returns:
basename of this path, '/hello/world' -> 'world'

parent(self)

source code 
Returns:
parent of this path, '/hello/world' -> '/hello' or None if this path is the dag's root

parentDeep(self)

source code 
Returns:
all parents of this path, '/hello/my/world' -> [ '/hello/my','/hello' ]

children(self, predicate=<function <lambda> at 0x7f8b493d65f0>)

source code 
Parameters:
  • predicate - return True to include x in result
Returns:
list of intermediate children of path, [ child1 , child2 ]

Note: the child objects returned are supposed to be valid paths, not just relative paths

childrenDeep(self, order=1, predicate=<function <lambda> at 0x7f8b493d66e0>)

source code 
Parameters:
  • order - order enumeration
  • predicate - returns true if x may be returned
Returns:
list of all children of path, [ child1 , child2 ]

Note: the child objects returned are supposed to be valid paths, not just relative paths

isPartOf(self, other)

source code 
Returns:
True if self is a part of other, and thus can be found in other

Note: operates on strings only

isRootOf(self, other)

source code 
Returns:
True other starts with self
Notes:
  • operates on strings
  • we assume other has the same type as self, thus the same separator

iterParents(self, predicate=<function <lambda> at 0x7f8b493d68c0>)

source code 
Parameters:
  • predicate - returns True for all x that you want to be returned
Returns:
generator retrieving all parents up to the root

addSep(cls, item, sep)
Class Method

source code 
Parameters:
  • item - item to add separator to
  • sep - the separator
Returns:
item with separator added to it ( just once )

Note: operates best on strings