Package s3 :: Module s3utils :: Class S3MultiPath :: Class Path
[frames] | no frames]

Class Path

source code

Instance Methods
 
__init__(self, nodes=None)
Constructor
source code
 
append(self, node=None)
Append a node to this path
source code
 
extend(self, head, ancestors=None)
Extend this path with a new vertex ancestors<-head, if this path ends at the head node
source code
 
cut(self, head, ancestor=None)
Cut off the ancestor<-head vertex from this path, retaining the head node
source code
 
__repr__(self)
Represent this path as a string
source code
 
as_list(self)
Return the list of nodes
source code
 
__getitem__(self, i)
Get the node at position i
source code
 
first(self)
Get the first node in this path (the nearest ancestor)
source code
 
last(self)
Get the last node in this path (the most distant ancestor)
source code
 
__contains__(self, sequence)
Check whether this path contains sequence
source code
 
__len__(self)
Get the number of nodes in this path
source code
 
find(self, sequence)
Find a sequence of node IDs in this path
source code
 
startswith(self, sequence)
Check whether this path starts with sequence
source code
Method Details

__init__(self, nodes=None)
(Constructor)

source code 

Constructor

append(self, node=None)

source code 

Append a node to this path

Parameters:
  • node - the node

extend(self, head, ancestors=None)

source code 

Extend this path with a new vertex ancestors<-head, if this path ends at the head node

Parameters:
  • head - the head node
  • ancestors - the ancestor sequence

cut(self, head, ancestor=None)

source code 

Cut off the ancestor<-head vertex from this path, retaining the head node

Parameters:
  • head - the head node
  • ancestor - the ancestor node

__repr__(self)
(Representation operator)

source code 

Represent this path as a string

as_list(self)

source code 

Return the list of nodes

__getitem__(self, i)
(Indexing operator)

source code 

Get the node at position i

first(self)

source code 

Get the first node in this path (the nearest ancestor)

last(self)

source code 

Get the last node in this path (the most distant ancestor)

__contains__(self, sequence)
(In operator)

source code 

Check whether this path contains sequence

Parameters:
  • sequence - sequence of node IDs

__len__(self)
(Length operator)

source code 

Get the number of nodes in this path

find(self, sequence)

source code 

Find a sequence of node IDs in this path

Parameters:
  • sequence - sequence of node IDs (or path)
Returns:
position of the sequence (index+1), 0 if the path is empty, -1 if the sequence wasn't found

startswith(self, sequence)

source code 

Check whether this path starts with sequence

Parameters:
  • sequence - sequence of node IDs (or path)