Uranium
Application Framework
|
Public Member Functions | |
def | __init__ (self, iterable=None, load=1000) |
def | __new__ (cls, iterable=None, key=None, load=1000) |
def | clear (self) |
def | add (self, val) |
def | update (self, iterable) |
def | __contains__ (self, val) |
def | discard (self, val) |
def | remove (self, val) |
def | __delitem__ (self, idx) |
def | __getitem__ (self, idx) |
def | __setitem__ (self, index, value) |
def | __iter__ (self) |
def | __reversed__ (self) |
def | islice (self, start=None, stop=None, reverse=False) |
def | irange (self, minimum=None, maximum=None, inclusive=(True, True), reverse=False) |
def | __len__ (self) |
def | bisect_left (self, val) |
def | bisect_right (self, val) |
def | count (self, val) |
def | copy (self) |
def | append (self, val) |
def | extend (self, values) |
def | insert (self, idx, val) |
def | pop (self, idx=-1) |
def | index (self, val, start=None, stop=None) |
def | __add__ (self, that) |
def | __iadd__ (self, that) |
def | __mul__ (self, that) |
def | __imul__ (self, that) |
def | __repr__ (self) |
Static Public Attributes | |
def | bisect = bisect_right |
SortedList provides most of the same methods as a list but keeps the items in sorted order.
def UM.SortedList.SortedList.__init__ | ( | self, | |
iterable = None , |
|||
load = 1000 |
|||
) |
SortedList provides most of the same methods as a list but keeps the items in sorted order. An optional *iterable* provides an initial series of items to populate the SortedList. An optional *load* specifies the load-factor of the list. The default load factor of '1000' works well for lists from tens to tens of millions of elements. Good practice is to use a value that is the cube root of the list size. With billions of elements, the best load factor depends on your usage. It's best to leave the load factor at the default until you start benchmarking.
def UM.SortedList.SortedList.__add__ | ( | self, | |
that | |||
) |
Return a new sorted list containing all the elements in *self* and *that*. Elements in *that* do not need to be properly ordered with respect to *self*.
Reimplemented in UM.SortedList.SortedListWithKey.
def UM.SortedList.SortedList.__contains__ | ( | self, | |
val | |||
) |
Return True if and only if *val* is an element in the list.
Reimplemented in UM.SortedList.SortedListWithKey.
def UM.SortedList.SortedList.__delitem__ | ( | self, | |
idx | |||
) |
Remove the element at *idx*. Supports slicing.
def UM.SortedList.SortedList.__getitem__ | ( | self, | |
idx | |||
) |
Return the element at *idx*. Supports slicing.
def UM.SortedList.SortedList.__iadd__ | ( | self, | |
that | |||
) |
Update *self* to include all values in *that*. Elements in *that* do not need to be properly ordered with respect to *self*.
def UM.SortedList.SortedList.__imul__ | ( | self, | |
that | |||
) |
Increase the length of the list by appending *that* shallow copies of each item.
Reimplemented in UM.SortedList.SortedListWithKey.
def UM.SortedList.SortedList.__iter__ | ( | self | ) |
Return an iterator over the Sequence. Iterating the Sequence while adding or deleting values may raise a `RuntimeError` or fail to iterate over all entries.
def UM.SortedList.SortedList.__len__ | ( | self | ) |
Return the number of elements in the list.
def UM.SortedList.SortedList.__mul__ | ( | self, | |
that | |||
) |
Return a new sorted list containing *that* shallow copies of each item in SortedList.
Reimplemented in UM.SortedList.SortedListWithKey.
def UM.SortedList.SortedList.__new__ | ( | cls, | |
iterable = None , |
|||
key = None , |
|||
load = 1000 |
|||
) |
SortedList provides most of the same methods as a list but keeps the items in sorted order. An optional *iterable* provides an initial series of items to populate the SortedList. An optional *key* argument will return an instance of subtype SortedListWithKey. An optional *load* specifies the load-factor of the list. The default load factor of '1000' works well for lists from tens to tens of millions of elements. Good practice is to use a value that is the cube root of the list size. With billions of elements, the best load factor depends on your usage. It's best to leave the load factor at the default until you start benchmarking.
Reimplemented in UM.SortedList.SortedListWithKey.
def UM.SortedList.SortedList.__repr__ | ( | self | ) |
Return string representation of sequence.
Reimplemented in UM.SortedList.SortedListWithKey.
def UM.SortedList.SortedList.__reversed__ | ( | self | ) |
Return an iterator to traverse the Sequence in reverse. Iterating the Sequence while adding or deleting values may raise a `RuntimeError` or fail to iterate over all entries.
def UM.SortedList.SortedList.__setitem__ | ( | self, | |
index, | |||
value | |||
) |
Replace the item at position *index* with *value*. Supports slice notation. Raises a :exc:`ValueError` if the sort order would be violated. When used with a slice and iterable, the :exc:`ValueError` is raised before the list is mutated if the sort order would be violated by the operation.
Reimplemented in UM.SortedList.SortedListWithKey.
def UM.SortedList.SortedList.add | ( | self, | |
val | |||
) |
Add the element *val* to the list.
Reimplemented in UM.SortedList.SortedListWithKey.
def UM.SortedList.SortedList.append | ( | self, | |
val | |||
) |
Append the element *val* to the list. Raises a ValueError if the *val* would violate the sort order.
Reimplemented in UM.SortedList.SortedListWithKey.
def UM.SortedList.SortedList.bisect_left | ( | self, | |
val | |||
) |
Similar to the *bisect* module in the standard library, this returns an appropriate index to insert *val*. If *val* is already present, the insertion point will be before (to the left of) any existing entries.
Reimplemented in UM.SortedList.SortedListWithKey.
def UM.SortedList.SortedList.bisect_right | ( | self, | |
val | |||
) |
Same as *bisect_left*, but if *val* is already present, the insertion point will be after (to the right of) any existing entries.
Reimplemented in UM.SortedList.SortedListWithKey.
def UM.SortedList.SortedList.clear | ( | self | ) |
Remove all the elements from the list.
Reimplemented in UM.SortedList.SortedListWithKey.
def UM.SortedList.SortedList.copy | ( | self | ) |
Return a shallow copy of the sorted list.
Reimplemented in UM.SortedList.SortedListWithKey.
def UM.SortedList.SortedList.count | ( | self, | |
val | |||
) |
Return the number of occurrences of *val* in the list.
Reimplemented in UM.SortedList.SortedListWithKey.
def UM.SortedList.SortedList.discard | ( | self, | |
val | |||
) |
Remove the first occurrence of *val*. If *val* is not a member, does nothing.
Reimplemented in UM.SortedList.SortedListWithKey.
def UM.SortedList.SortedList.extend | ( | self, | |
values | |||
) |
Extend the list by appending all elements from the *values*. Raises a ValueError if the sort order would be violated.
Reimplemented in UM.SortedList.SortedListWithKey.
def UM.SortedList.SortedList.index | ( | self, | |
val, | |||
start = None , |
|||
stop = None |
|||
) |
Return the smallest *k* such that L[k] == val and i <= k < j`. Raises ValueError if *val* is not present. *stop* defaults to the end of the list. *start* defaults to the beginning. Negative indices are supported, as for slice indices.
Reimplemented in UM.SortedList.SortedListWithKey.
def UM.SortedList.SortedList.insert | ( | self, | |
idx, | |||
val | |||
) |
Insert the element *val* into the list at *idx*. Raises a ValueError if the *val* at *idx* would violate the sort order.
Reimplemented in UM.SortedList.SortedListWithKey.
def UM.SortedList.SortedList.irange | ( | self, | |
minimum = None , |
|||
maximum = None , |
|||
inclusive = (True, True) , |
|||
reverse = False |
|||
) |
Create an iterator of values between `minimum` and `maximum`. `inclusive` is a pair of booleans that indicates whether the minimum and maximum ought to be included in the range, respectively. The default is (True, True) such that the range is inclusive of both minimum and maximum. Both `minimum` and `maximum` default to `None` which is automatically inclusive of the start and end of the list, respectively. When `reverse` is `True` the values are yielded from the iterator in reverse order; `reverse` defaults to `False`.
Reimplemented in UM.SortedList.SortedListWithKey.
def UM.SortedList.SortedList.islice | ( | self, | |
start = None , |
|||
stop = None , |
|||
reverse = False |
|||
) |
Returns an iterator that slices `self` from `start` to `stop` index, inclusive and exclusive respectively. When `reverse` is `True`, values are yielded from the iterator in reverse order. Both `start` and `stop` default to `None` which is automatically inclusive of the beginning and end.
def UM.SortedList.SortedList.pop | ( | self, | |
idx = -1 |
|||
) |
Remove and return item at *idx* (default last). Raises IndexError if list is empty or index is out of range. Negative indices are supported, as for slice indices.
def UM.SortedList.SortedList.remove | ( | self, | |
val | |||
) |
Remove first occurrence of *val*. Raises ValueError if *val* is not present.
Reimplemented in UM.SortedList.SortedListWithKey.
def UM.SortedList.SortedList.update | ( | self, | |
iterable | |||
) |
Update the list by adding all elements from *iterable*.
Reimplemented in UM.SortedList.SortedListWithKey.