Module Spiff_Guard :: Class ResourcePath

Class ResourcePath



object --+
         |
        ResourcePath

Instance Methods
 
__init__(self, path='')
Create a new instance.
string
__str__(self)
Returns the current path as a string in the following format:
ResourcePath
__add__(self, other)
Concatenate two path objects.
int
__len__(self)
Returns the number of elements in the path.
 
set(self, path='')
Point the object to the given path.
string
get(self)
Returns the current path as a string in the following format:
string
hex(self)
Returns the current path as a string in the following format:
string
bin(self)
Returns the current path as binary data.
int
get_parent_id(self)
Returns the second-last element of the path.
int
get_current_id(self)
Returns the last element of the path.
ResourcePath
crop(self, n=1)
Crops the path by n components and returns a ResourcePath that points to the new path.
ResourcePath
append(self, id)
Appends the given id to the path and returns a ResourcePath that points to the new path.

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__

Properties

Inherited from object: __class__

Method Details

__init__(self, path='')
(Constructor)

 
Create a new instance.
Parameters:
  • path (string|list[int]) - Contains the path in the following format: 0/1/2/..., or as a list of integers.
Overrides: object.__init__

__str__(self)
(Informal representation operator)

 
Returns the current path as a string in the following format:
 0/1/2/3/...
Returns: string
A string representation of the current path.
Overrides: object.__str__

__add__(self, other)
(Addition operator)

 
Concatenate two path objects.
Returns: ResourcePath
The combined resource path.

__len__(self)
(Length operator)

 
Returns the number of elements in the path.
Returns: int
The length of the path.

set(self, path='')

 
Point the object to the given path.
Parameters:
  • path (string|list[int]) - Contains the path in the following format: 0/1/2/..., or as a list of integers.

get(self)

 
Returns the current path as a string in the following format:
 0/1/2/3/...
Returns: string
A string representation of the current path.

hex(self)

 
Returns the current path as a string in the following format:
 0123456789ABCDEF...
where each component is represented by 8 hexadecimal characters.
Returns: string
A hexadecimal string representing the current path.

bin(self)

 
Returns the current path as binary data.
Returns: string
A binary representation of the current path.

get_parent_id(self)

 
Returns the second-last element of the path.
Returns: int
The id of the second-last element.

get_current_id(self)

 
Returns the last element of the path.
Returns: int
The id of the last element.

crop(self, n=1)

 
Crops the path by n components and returns a ResourcePath that points to the new path.
Returns: ResourcePath
The shortened ResourcePath.

append(self, id)

 
Appends the given id to the path and returns a ResourcePath that points to the new path.
Returns: ResourcePath
The new ResourcePath.