Uranium
Application Framework
|
Public Member Functions | |
def | __init__ (self, iterable=None, key=identity, load=1000) |
def | __new__ (cls, iterable=None, key=identity, 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 | __setitem__ (self, index, value) |
def | irange (self, minimum=None, maximum=None, inclusive=(True, True), reverse=False) |
def | irange_key (self, min_key=None, max_key=None, inclusive=(True, True), reverse=False) |
def | bisect_left (self, val) |
def | bisect_right (self, val) |
def | bisect_key_left (self, key) |
def | bisect_key_right (self, key) |
def | count (self, val) |
def | copy (self) |
def | append (self, val) |
def | extend (self, values) |
def | insert (self, idx, val) |
def | index (self, val, start=None, stop=None) |
def | __add__ (self, that) |
def | __mul__ (self, that) |
def | __imul__ (self, that) |
def | __repr__ (self) |
![]() | |
def | __init__ (self, iterable=None, load=1000) |
def | __delitem__ (self, idx) |
def | __getitem__ (self, idx) |
def | __iter__ (self) |
def | __reversed__ (self) |
def | islice (self, start=None, stop=None, reverse=False) |
def | __len__ (self) |
def | pop (self, idx=-1) |
def | __iadd__ (self, that) |
Static Public Attributes | |
def | bisect = bisect_right |
def | bisect_key = bisect_key_right |
![]() | |
def | bisect = bisect_right |
SortedListWithKey provides most of the same methods as a list but keeps the items in sorted order.
def UM.SortedList.SortedListWithKey.__init__ | ( | self, | |
iterable = None , |
|||
key = identity , |
|||
load = 1000 |
|||
) |
SortedListWithKey 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 SortedListWithKey. An optional *key* argument defines a callable that, like the `key` argument to Python's `sorted` function, extracts a comparison key from each element. The default is the identity function. 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.SortedListWithKey.__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 from UM.SortedList.SortedList.
def UM.SortedList.SortedListWithKey.__contains__ | ( | self, | |
val | |||
) |
Return True if and only if *val* is an element in the list.
Reimplemented from UM.SortedList.SortedList.
def UM.SortedList.SortedListWithKey.__imul__ | ( | self, | |
that | |||
) |
Increase the length of the list by appending *that* shallow copies of each item.
Reimplemented from UM.SortedList.SortedList.
def UM.SortedList.SortedListWithKey.__mul__ | ( | self, | |
that | |||
) |
Return a new sorted list containing *that* shallow copies of each item in SortedListWithKey.
Reimplemented from UM.SortedList.SortedList.
def UM.SortedList.SortedListWithKey.__new__ | ( | cls, | |
iterable = None , |
|||
key = identity , |
|||
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 from UM.SortedList.SortedList.
def UM.SortedList.SortedListWithKey.__repr__ | ( | self | ) |
Return string representation of sequence.
Reimplemented from UM.SortedList.SortedList.
def UM.SortedList.SortedListWithKey.__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 from UM.SortedList.SortedList.
def UM.SortedList.SortedListWithKey.add | ( | self, | |
val | |||
) |
Add the element *val* to the list.
Reimplemented from UM.SortedList.SortedList.
def UM.SortedList.SortedListWithKey.append | ( | self, | |
val | |||
) |
Append the element *val* to the list. Raises a ValueError if the *val* would violate the sort order.
Reimplemented from UM.SortedList.SortedList.
def UM.SortedList.SortedListWithKey.bisect_key_left | ( | self, | |
key | |||
) |
Similar to the *bisect* module in the standard library, this returns an appropriate index to insert a value with a given *key*. If values with *key* are already present, the insertion point will be before (to the left of) any existing entries.
def UM.SortedList.SortedListWithKey.bisect_key_right | ( | self, | |
key | |||
) |
Same as *bisect_key_left*, but if *key* is already present, the insertion point will be after (to the right of) any existing entries.
def UM.SortedList.SortedListWithKey.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 from UM.SortedList.SortedList.
def UM.SortedList.SortedListWithKey.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 from UM.SortedList.SortedList.
def UM.SortedList.SortedListWithKey.clear | ( | self | ) |
Remove all the elements from the list.
Reimplemented from UM.SortedList.SortedList.
def UM.SortedList.SortedListWithKey.copy | ( | self | ) |
Return a shallow copy of the sorted list.
Reimplemented from UM.SortedList.SortedList.
def UM.SortedList.SortedListWithKey.count | ( | self, | |
val | |||
) |
Return the number of occurrences of *val* in the list.
Reimplemented from UM.SortedList.SortedList.
def UM.SortedList.SortedListWithKey.discard | ( | self, | |
val | |||
) |
Remove the first occurrence of *val*. If *val* is not a member, does nothing.
Reimplemented from UM.SortedList.SortedList.
def UM.SortedList.SortedListWithKey.extend | ( | self, | |
values | |||
) |
Extend the list by appending all elements from the *values*. Raises a ValueError if the sort order would be violated.
Reimplemented from UM.SortedList.SortedList.
def UM.SortedList.SortedListWithKey.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 from UM.SortedList.SortedList.
def UM.SortedList.SortedListWithKey.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 from UM.SortedList.SortedList.
def UM.SortedList.SortedListWithKey.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 from UM.SortedList.SortedList.
def UM.SortedList.SortedListWithKey.irange_key | ( | self, | |
min_key = None , |
|||
max_key = None , |
|||
inclusive = (True, True) , |
|||
reverse = False |
|||
) |
Create an iterator of values between `min_key` and `max_key`. `inclusive` is a pair of booleans that indicates whether the min_key and max_key ought to be included in the range, respectively. The default is (True, True) such that the range is inclusive of both `min_key` and `max_key`. Both `min_key` and `max_key` 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`.
def UM.SortedList.SortedListWithKey.remove | ( | self, | |
val | |||
) |
Remove first occurrence of *val*. Raises ValueError if *val* is not present.
Reimplemented from UM.SortedList.SortedList.
def UM.SortedList.SortedListWithKey.update | ( | self, | |
iterable | |||
) |
Update the list by adding all elements from *iterable*.
Reimplemented from UM.SortedList.SortedList.