Mutable set of cluster node indexes featuring a fast range-based
API.
This class aims to ease the management of potentially large cluster
range sets and is used by the :class:`.NodeSet` class.
Padding of ranges (eg. "003-009") can be managed through a
public RangeSet instance variable named padding. It may be changed at any
time. Padding is a simple display feature per RangeSet object, thus
current padding value is not taken into account when computing set
operations. RangeSet is itself an iterator over its items as integers
(instead of strings). To iterate over string items with optional padding,
you can use the :meth:`RangeSet.striter`: method.
RangeSet provides methods like :meth:`RangeSet.union`,
:meth:`RangeSet.intersection`, :meth:`RangeSet.difference`,
:meth:`RangeSet.symmetric_difference` and their in-place versions
:meth:`RangeSet.update`, :meth:`RangeSet.intersection_update`,
:meth:`RangeSet.difference_update`,
:meth:`RangeSet.symmetric_difference_update` which conform to the Python
Set API.
new empty set object
|
|
|
_parse(self,
pattern)
Parse string of comma-separated x-y/step -like ranges |
source code
|
|
|
get_autostep(self)
Get autostep value (property) |
source code
|
|
|
set_autostep(self,
val)
Set autostep value (property) |
source code
|
|
|
dim(self)
Get the number of dimensions of this RangeSet object. |
source code
|
|
|
_sorted(self)
Get sorted list from inner set. |
source code
|
|
|
|
|
striter(self)
Iterate over each (optionally padded) string element in RangeSet. |
source code
|
|
|
contiguous(self)
Object-based iterator over contiguous range sets. |
source code
|
|
|
|
|
__setstate__(self,
dic)
called upon unpickling |
source code
|
|
|
_strslices(self)
Stringify slices list (x-y/step format) |
source code
|
|
|
|
|
|
|
_contiguous_slices(self)
Internal iterator over contiguous slices in RangeSet. |
source code
|
|
|
_folded_slices(self)
Internal generator that is able to retrieve ranges organized by step. |
source code
|
|
|
slices(self)
Iterate over RangeSet ranges as Python slice objects. |
source code
|
|
|
__getitem__(self,
index)
Return the element at index or a subrange when a slice is specified. |
source code
|
|
|
split(self,
nbr)
Split the rangeset into nbr sub-rangesets (at most). |
source code
|
|
|
add_range(self,
start,
stop,
step=1,
pad=0)
Add a range (start, stop, step and padding length) to RangeSet. |
source code
|
|
|
|
|
__copy__(self)
Return a shallow copy of a RangeSet. |
source code
|
|
|
|
|
_wrap_set_op(self,
fun,
arg)
Wrap built-in set operations for RangeSet to workaround built-in set
base class issues (RangeSet.__new/init__ not called) |
source code
|
|
|
|
|
union(self,
other)
Return the union of two RangeSets as a new RangeSet. |
source code
|
|
|
__and__(self,
other)
Return the intersection of two RangeSets as a new RangeSet. |
source code
|
|
|
|
|
__xor__(self,
other)
Return the symmetric difference of two RangeSets as a new RangeSet. |
source code
|
|
|
|
|
__sub__(self,
other)
Return the difference of two RangeSets as a new RangeSet. |
source code
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_binary_sanity_check(self,
other)
Check that the other argument to a binary operation is also a set,
raising a TypeError otherwise. |
source code
|
|
|
|
|
union_update(self,
other)
Update a RangeSet with the union of itself and another. |
source code
|
|
|
__iand__(self,
other)
Update a RangeSet with the intersection of itself and another. |
source code
|
|
|
|
|
__ixor__(self,
other)
Update a RangeSet with the symmetric difference of itself and
another. |
source code
|
|
|
|
|
|
|
|
|
update(self,
iterable)
Add all integers from an iterable (such as a list). |
source code
|
|
|
updaten(self,
rangesets)
Update a rangeset with the union of itself and several others. |
source code
|
|
|
|
|
|
|
remove(self,
element)
Remove an element from a RangeSet; it must be a member. |
source code
|
|
|
|
Inherited from set :
__cmp__ ,
__getattribute__ ,
__len__ ,
__ne__ ,
__rand__ ,
__ror__ ,
__rsub__ ,
__rxor__ ,
__sizeof__ ,
isdisjoint ,
pop
Inherited from object :
__delattr__ ,
__format__ ,
__reduce_ex__ ,
__setattr__ ,
__subclasshook__
|