pkgcraft.types package

Submodules

pkgcraft.types.ordered module

class pkgcraft.types.ordered.OrderedFrozenSet(iterable=None)

Bases: object

An OrderedFrozenSet object is an immutable, ordered collection of distinct hashable objects.

It works like the set type, but remembers insertion order.

It also supports __getitem__() and index(), like the list type.

__init__(*args, **kwargs)
copy(self)
Return type:

OrderedSet

Returns:

a new OrderedSet with a shallow copy of self.

difference(self, other)

OrderedSet - other

Return type:

OrderedSet

Returns:

a new OrderedSet with elements in the set that are not in the others.

index(self, elem)

Return the index of elem. Raises ValueError if not in the set.

intersection(self, other)

OrderedSet & other

Return type:

OrderedSet

Returns:

a new OrderedSet with elements common to the set and all others.

isdisjoint(self, other)

Return True if the set has no elements in common with other. Sets are disjoint if and only if their intersection is the empty set.

Return type:

bool

isorderedsubset(self, OrderedFrozenSet other) bool
isorderedsuperset(self, OrderedFrozenSet other) bool
issubset(self, other)

OrderedSet <= other

Return type:

bool

Test whether the OrderedSet is a proper subset of other, that is, OrderedSet <= other and OrderedSet != other.

issuperset(self, other)

OrderedSet >= other

Return type:

bool

Test whether every element in other is in the set.

symmetric_difference(self, other)

OrderedSet ^ other

Return type:

OrderedSet

Returns:

a new OrderedSet with elements in either the set or other but not both.

union(self, other)

OrderedSet | other

Return type:

OrderedSet

Returns:

a new OrderedSet with elements from the set and all others.

class pkgcraft.types.ordered.OrderedSet

Bases: OrderedFrozenSet

An OrderedSet object is a mutable, ordered collection of distinct hashable objects.

It works like the set type, but remembers insertion order.

It also supports __getitem__() and index(), like the list type.

add(self, elem) void

Add element elem to the set.

clear(self)

Remove all elements from the set.

difference_update(self, other)

OrderedSet -= other

Update the OrderedSet, removing elements found in others.

discard(self, elem) void

Remove element elem from the OrderedSet if it is present.

intersection_update(self, other)

OrderedSet &= other

Update the OrderedSet, keeping only elements found in it and all others.

pop(self, bool last=True)

Remove last element. Raises KeyError if the OrderedSet is empty.

remove(self, elem)

Remove element elem from the set. Raises KeyError if elem is not contained in the set.

symmetric_difference_update(self, other)

OrderedSet ^= other

Update the OrderedSet, keeping only elements found in either set, but not in both.

update(self, other)

OrderedSet |= other

Update the OrderedSet, adding elements from all others.

class pkgcraft.types.ordered.entry

Bases: object

Module contents