Uranium
Application Framework
|
Public Member Functions | |
def | __init__ |
def | __new__ |
def | clear |
def | add |
def | update |
def | __contains__ |
def | discard |
def | remove |
def | __setitem__ |
def | irange |
def | irange_key |
def | bisect_left |
def | bisect_right |
def | bisect_key_left |
def | bisect_key_right |
def | count |
def | copy |
def | append |
def | extend |
def | insert |
def | index |
def | __add__ |
def | __mul__ |
def | __imul__ |
def | __repr__ |
![]() | |
def | __init__ |
def | __new__ |
def | clear |
def | add |
def | update |
def | __contains__ |
def | discard |
def | remove |
def | __delitem__ |
def | __getitem__ |
def | __setitem__ |
def | __iter__ |
def | __reversed__ |
def | islice |
def | irange |
def | __len__ |
def | bisect_left |
def | bisect_right |
def | count |
def | copy |
def | append |
def | extend |
def | insert |
def | pop |
def | index |
def | __add__ |
def | __iadd__ |
def | __mul__ |
def | __imul__ |
def | __repr__ |
Static Public Attributes | |
bisect = bisect_right | |
bisect_key = bisect_key_right | |
![]() | |
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*.
def UM.SortedList.SortedListWithKey.__contains__ | ( | self, | |
val | |||
) |
Return True if and only if *val* is an element in the list.
def UM.SortedList.SortedListWithKey.__imul__ | ( | self, | |
that | |||
) |
Increase the length of the list by appending *that* shallow copies of each item.
def UM.SortedList.SortedListWithKey.__mul__ | ( | self, | |
that | |||
) |
Return a new sorted list containing *that* shallow copies of each item in SortedListWithKey.
def UM.SortedList.SortedListWithKey.__repr__ | ( | self | ) |
Return string representation of sequence.
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.
def UM.SortedList.SortedListWithKey.add | ( | self, | |
val | |||
) |
Add the element *val* to the list.
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.
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.
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.
def UM.SortedList.SortedListWithKey.clear | ( | self | ) |
Remove all the elements from the list.
def UM.SortedList.SortedListWithKey.copy | ( | self | ) |
Return a shallow copy of the sorted list.
def UM.SortedList.SortedListWithKey.count | ( | self, | |
val | |||
) |
Return the number of occurrences of *val* in the list.
def UM.SortedList.SortedListWithKey.discard | ( | self, | |
val | |||
) |
Remove the first occurrence of *val*. If *val* is not a member, does nothing.
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.
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.
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.
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`.
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.
def UM.SortedList.SortedListWithKey.update | ( | self, | |
iterable | |||
) |
Update the list by adding all elements from *iterable*.