Uranium
Application Framework
 All Classes Namespaces Files Functions Variables Pages
UM.SortedList.SortedList Class Reference
Inheritance diagram for UM.SortedList.SortedList:
UM.SortedList.SortedListWithKey

Public Member Functions

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
 

Detailed Description

SortedList provides most of the same methods as a list but keeps the items
in sorted order.

Constructor & Destructor Documentation

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.

Member Function Documentation

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*.
def UM.SortedList.SortedList.__contains__ (   self,
  val 
)
Return True if and only if *val* is an element in the list.
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.
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.
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.
def UM.SortedList.SortedList.__repr__ (   self)
Return string representation of sequence.
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.
def UM.SortedList.SortedList.add (   self,
  val 
)
Add the element *val* to the list.
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.
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.
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.
def UM.SortedList.SortedList.clear (   self)
Remove all the elements from the list.
def UM.SortedList.SortedList.copy (   self)
Return a shallow copy of the sorted list.
def UM.SortedList.SortedList.count (   self,
  val 
)
Return the number of occurrences of *val* in the list.
def UM.SortedList.SortedList.discard (   self,
  val 
)
Remove the first occurrence of *val*.

If *val* is not a member, does nothing.
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.
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.
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.
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`.
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.
def UM.SortedList.SortedList.update (   self,
  iterable 
)
Update the list by adding all elements from *iterable*.

The documentation for this class was generated from the following file: