API Reference¶
Return a new bitset class with given name and members. |
|
Ordered container of unique elements from a predefined domain. |
|
Mutable bitset sequence. |
|
Immutable bitset sequence. |
bitset¶
- bitsets.bitset(name, members, base=<class 'bitsets.bases.BitSet'>, list=False, tuple=False)¶
Return a new bitset class with given name and members.
- Parameters
Example
>>> Letters = bitset('Letters', 'abcdef', list=True, tuple=True) >>> Letters <class bitsets.meta.bitset('Letters', 'abcdef', 0x..., BitSet, List, Tuple)> >>> Letters('deadbeef') Letters(['a', 'b', 'd', 'e', 'f'])
BitSet¶
- class bitsets.bases.BitSet(members=())¶
Ordered container of unique elements from a predefined domain.
- Parameters
members – Iterable of domain members.
- Raises
KeyError – if a member is not in the domain of the set.
- __iter__()¶
Iterate over the set members.
- __len__()¶
Return the number of items in the set (cardinality).
- all()¶
Return True iff the set contains all domain items.
- any()¶
Return True iff the set contains at least one item.
- atoms(reverse=False)¶
Yield the singleton for every set member.
- bits()¶
Return the binary string of set membership.
- bools()¶
Return the boolean sequence of set membership.
- complement()¶
Complement set.
- copy()¶
Return the set unchanged (as its is immutable).
- count(value=True)¶
Returns the number of present/absent members.
- difference(other)¶
Set difference.
- classmethod frombits(bits='0')¶
Create a set from binary string.
- classmethod frombools(bools=())¶
Create a set from an iterable of boolean evaluable items.
- inatoms(reverse=False)¶
Yield the singleton for every non-member.
- intersection(other)¶
Set intersection.
- isdisjoint(other)¶
Set disjointness.
- issubset(other)¶
Inverse set containment.
- issuperset(other)¶
Set containment.
- longcolex()¶
Return sort key for long colexicographical order.
- longlex()¶
Return sort key for long lexicographical order.
- members(as_set=False)¶
Return the set members tuple/frozenset.
- powerset(start=None, excludestart=False)¶
Yield combinations from start to self in short lexicographic order.
- shortcolex()¶
Return sort key for short colexicographical order.
- shortlex()¶
Return sort key for short lexicographical order.
- symmetric_difference(other)¶
Symmetric set difference.
- union(other)¶
Set union.
BitSet.List¶
- class bitsets.series.List(*bits)¶
Mutable bitset sequence.
- Parameters
*bits (str) – Strings with the binary membership representation.
- bits()¶
Return the series as list of binary set membership strings.
- bools()¶
Return the series as list of boolean set membership sequences.
- classmethod frombits(bits)¶
Series from binary string arguments.
- classmethod frombools(bools)¶
Series from iterable of boolean evaluable iterables.
- classmethod fromints(ints)¶
Series from integer rank arguments.
- classmethod frommembers(members)¶
Series from iterable of member iterables.
- index_sets(as_set=False)¶
Return the series as list of index set tuples.
- ints()¶
Return the series as list of integers ranks.
- members(as_set=False)¶
Return the series as list of set member tuples/frozensets.
- reduce_and()¶
Return the intersection of all series elements.
- reduce_or()¶
Return the union of all series elements.
BitSet.Tuple¶
- class bitsets.series.Tuple(*bits)¶
Immutable bitset sequence.
- Parameters
*bits (str) – Strings with the binary membership representation.
- bits()¶
Return the series as list of binary set membership strings.
- bools()¶
Return the series as list of boolean set membership sequences.
- classmethod frombits(bits)¶
Series from binary string arguments.
- classmethod frombools(bools)¶
Series from iterable of boolean evaluable iterables.
- classmethod fromints(ints)¶
Series from integer rank arguments.
- classmethod frommembers(members)¶
Series from iterable of member iterables.
- index_sets(as_set=False)¶
Return the series as list of index set tuples.
- ints()¶
Return the series as list of integers ranks.
- members(as_set=False)¶
Return the series as list of set member tuples/frozensets.
- reduce_and()¶
Return the intersection of all series elements.
- reduce_or()¶
Return the union of all series elements.