Package ClusterShell :: Module RangeSet :: Class RangeSetND
[hide private]
[frames] | no frames]

Class RangeSetND

source code



Build a N-dimensional RangeSet object.

.. warning:: You don't usually need to use this class directly, use
    :class:`.NodeSet` instead that has ND support.

Empty constructor::

    RangeSetND()

Build from a list of list of :class:`RangeSet` objects::

    RangeSetND([[rs1, rs2, rs3, ...], ...])

Strings are also supported::

    RangeSetND([["0-3", "4-10", ...], ...])

Integers are also supported::

    RangeSetND([(0, 4), (0, 5), (1, 4), (1, 5), ...]

Nested Classes [hide private]
  precond_fold
Decorator to ease internal folding management
Instance Methods [hide private]
 
__init__(self, args=None, pads=None, autostep=None, copy_rangeset=True)
RangeSetND initializer
source code
 
copy(*args, **kwargs)
Return a new, mutable shallow copy of a RangeSetND.
source code
 
__copy__(*args, **kwargs)
Return a new, mutable shallow copy of a RangeSetND.
source code
 
__eq__(self, other)
RangeSetND equality comparison.
source code
 
__nonzero__(self) source code
 
__len__(self)
Count unique elements in N-dimensional rangeset.
source code
 
__str__(*args, **kwargs)
String representation of N-dimensional RangeSet.
source code
 
__iter__(*args, **kwargs) source code
 
_iter(self)
Iterate through individual items as tuples.
source code
 
iter_padding(*args, **kwargs)
Iterate through individual items as tuples with padding info.
source code
 
_get_veclist(*args, **kwargs)
Get folded veclist
source code
 
_set_veclist(self, val)
Set veclist and set dirty flag for deferred folding.
source code
 
vectors(self)
Get underlying :class:`RangeSet` vectors
source code
 
dim(self)
Get the current number of dimensions of this RangeSetND object.
source code
 
pads(self)
Get a tuple of padding length info for each dimension.
source code
 
get_autostep(self)
Get autostep value (property)
source code
 
set_autostep(self, val)
Set autostep value (property)
source code
 
__getitem__(*args, **kwargs)
Return the element at index or a subrange when a slice is specified.
source code
 
contiguous(*args, **kwargs)
Object-based iterator over contiguous range sets.
source code
 
__contains__(*args, **kwargs)
Report whether an element is a member of a RangeSetND.
source code
 
issubset(self, other)
Report whether another set contains this RangeSetND.
source code
 
issuperset(*args, **kwargs)
Report whether this RangeSetND contains another RangeSetND.
source code
 
__le__(self, other)
Report whether another set contains this RangeSetND.
source code
 
__ge__(*args, **kwargs)
Report whether this RangeSetND contains another RangeSetND.
source code
 
__lt__(self, other) source code
 
__gt__(self, other) source code
 
_binary_sanity_check(self, other)
Check that the other argument to a binary operation is also a RangeSetND, raising a TypeError otherwise.
source code
 
_sort(self)
N-dimensional sorting.
source code
 
fold(*args, **kwargs)
Explicit folding call.
source code
 
_fold(self)
In-place N-dimensional folding.
source code
 
_fold_univariate(self)
Univariate nD folding.
source code
 
_fold_multivariate(self)
Multivariate nD folding
source code
 
_fold_multivariate_expand(self)
Multivariate nD folding: expand [phase 1]
source code
 
_fold_multivariate_merge(self)
Multivariate nD folding: merge [phase 2]
source code
 
__or__(self, other)
Return the union of two RangeSetNDs as a new RangeSetND.
source code
 
union(self, other)
Return the union of two RangeSetNDs as a new RangeSetND.
source code
 
update(self, other)
Add all RangeSetND elements to this RangeSetND.
source code
 
union_update(self, other)
Add all RangeSetND elements to this RangeSetND.
source code
 
__ior__(self, other)
Update a RangeSetND with the union of itself and another.
source code
 
__isub__(self, other)
Remove all elements of another set from this RangeSetND.
source code
 
difference_update(self, other, strict=False)
Remove all elements of another set from this RangeSetND.
source code
 
__sub__(self, other)
Return the difference of two RangeSetNDs as a new RangeSetND.
source code
 
difference(self, other)
``s.difference(t)`` returns a new object with elements in s but not in t.
source code
 
intersection(self, other)
``s.intersection(t)`` returns a new object with elements common to s and t.
source code
 
__and__(self, other)
Implements the & operator.
source code
 
intersection_update(self, other)
``s.intersection_update(t)`` returns nodeset s keeping only elements also found in t.
source code
 
__iand__(self, other)
Implements the &= operator.
source code
 
symmetric_difference(self, other)
``s.symmetric_difference(t)`` returns the symmetric difference of two objects as a new RangeSetND.
source code
 
__xor__(self, other)
Implement the ^ operator.
source code
 
symmetric_difference_update(self, other)
``s.symmetric_difference_update(t)`` returns RangeSetND s keeping all nodes that are in exactly one of the objects.
source code
 
__ixor__(self, other)
Implement the ^= operator.
source code

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

Properties [hide private]
  veclist
Get folded veclist
  autostep
autostep threshold public instance attribute

Inherited from object: __class__

Method Details [hide private]

__init__(self, args=None, pads=None, autostep=None, copy_rangeset=True)
(Constructor)

source code 
RangeSetND initializer

All parameters are optional.

:param args: generic "list of list" input argument (default is None)
:param pads: list of 0-padding length (default is to not pad any
             dimensions)
:param autostep: autostep threshold (use range/step notation if more
                 than #autostep items meet the condition) - default is
                 off (None)
:param copy_rangeset: (advanced) if set to False, do not copy RangeSet
                      objects from args (transfer ownership), which is
                      faster. In that case, you should not modify these
                      objects afterwards (default is True).

Overrides: object.__init__

copy(*args, **kwargs)

source code 

Return a new, mutable shallow copy of a RangeSetND.

Decorators:
  • @precond_fold()

__copy__(*args, **kwargs)

source code 

Return a new, mutable shallow copy of a RangeSetND.

Decorators:
  • @precond_fold()

__str__(*args, **kwargs)
(Informal representation operator)

source code 

String representation of N-dimensional RangeSet.

Decorators:
  • @precond_fold()
Overrides: object.__str__

__iter__(*args, **kwargs)

source code 
Decorators:
  • @precond_fold()

iter_padding(*args, **kwargs)

source code 

Iterate through individual items as tuples with padding info.

Decorators:
  • @precond_fold()

_get_veclist(*args, **kwargs)

source code 

Get folded veclist

Decorators:
  • @precond_fold()

dim(self)

source code 

Get the current number of dimensions of this RangeSetND object. Return 0 when object is empty.

__getitem__(*args, **kwargs)
(Indexing operator)

source code 

Return the element at index or a subrange when a slice is specified.

Decorators:
  • @precond_fold()

contiguous(*args, **kwargs)

source code 

Object-based iterator over contiguous range sets.

Decorators:
  • @precond_fold()

__contains__(*args, **kwargs)
(In operator)

source code 

Report whether an element is a member of a RangeSetND. Element can be either another RangeSetND object, a string or an integer.

Called in response to the expression ``element in self``.

Decorators:
  • @precond_fold()

issuperset(*args, **kwargs)

source code 

Report whether this RangeSetND contains another RangeSetND.

Decorators:
  • @precond_fold()

__ge__(*args, **kwargs)
(Greater-than-or-equals operator)

source code 

Report whether this RangeSetND contains another RangeSetND.

Decorators:
  • @precond_fold()

fold(*args, **kwargs)

source code 

Explicit folding call. Please note that folding of RangeSetND nD vectors are automatically managed, so you should not have to call this method. It may be still useful in some extreme cases where the RangeSetND is heavily modified.

Decorators:
  • @precond_fold()

_fold_univariate(self)

source code 

Univariate nD folding. Return True on success and False when a multivariate folding is required.

__or__(self, other)
(Or operator)

source code 

Return the union of two RangeSetNDs as a new RangeSetND.

(I.e. all elements that are in either set.)

union(self, other)

source code 

Return the union of two RangeSetNDs as a new RangeSetND.

(I.e. all elements that are in either set.)

difference_update(self, other, strict=False)

source code 

Remove all elements of another set from this RangeSetND.

If strict is True, raise KeyError if an element cannot be removed (strict is a RangeSet addition)

__sub__(self, other)
(Subtraction operator)

source code 

Return the difference of two RangeSetNDs as a new RangeSetND.

(I.e. all elements that are in this set and not in the other.)

__and__(self, other)
(And operator)

source code 

Implements the & operator. So ``s & t`` returns a new object with elements common to s and t.

__iand__(self, other)

source code 

Implements the &= operator. So ``s &= t`` returns object s keeping only elements also found in t (Python 2.5+ required).

symmetric_difference(self, other)

source code 

``s.symmetric_difference(t)`` returns the symmetric difference of two objects as a new RangeSetND.

(ie. all items that are in exactly one of the RangeSetND.)

__xor__(self, other)
(Exclusive-Or operator)

source code 

Implement the ^ operator. So ``s ^ t`` returns a new RangeSetND with nodes that are in exactly one of the RangeSetND.

__ixor__(self, other)

source code 

Implement the ^= operator. So ``s ^= t`` returns object s after keeping all items that are in exactly one of the RangeSetND (Python 2.5+ required).


Property Details [hide private]

veclist

Get folded veclist

Get Method:
_get_veclist(*args, **kwargs) - Get folded veclist
Set Method:
_set_veclist(self, val) - Set veclist and set dirty flag for deferred folding.

autostep

autostep threshold public instance attribute

Get Method:
get_autostep(self) - Get autostep value (property)
Set Method:
set_autostep(self, val) - Set autostep value (property)