evedataviewer.utils module
General utils of the evedataviewer package.
Mostly small functions that are more general and get used in the other modules.
- evedataviewer.utils.lists_are_equal(list1, list2)
Check whether two lists contain only identical items.
The sequence of the items does not matter, as otherwise, one could simply use the equal operator
==
. Furthermore, the two lists are not sorted or otherwise altered.
- class evedataviewer.utils.NotifyingList(callback=None)
Bases:
list
List calling a given function when items are added or removed.
In order to get notified when items are appended to or removed from a list, you can register a callback function in the
callback
that gets called whenever changes occur – and the callback is set.Besides that, simply the methods of the superclass
list
are called.- append(value)
Add element to the list
- Parameters:
value – Element to be added to the list
- remove(value)
Remove element from the list
- Parameters:
value – Element to be removed from the list
- clear()
Remove all items from list.
- copy()
Return a shallow copy of the list.
- count(value, /)
Return number of occurrences of value.
- extend(iterable, /)
Extend list by appending elements from the iterable.
- index(value, start=0, stop=9223372036854775807, /)
Return first index of value.
Raises ValueError if the value is not present.
- insert(index, object, /)
Insert object before index.
- pop(index=-1, /)
Remove and return item at index (default last).
Raises IndexError if list is empty or index is out of range.
- reverse()
Reverse IN PLACE.
- sort(*, key=None, reverse=False)
Sort the list in ascending order and return None.
The sort is in-place (i.e. the list itself is modified) and stable (i.e. the order of two equal elements is maintained).
If a key function is given, apply it once to each list item and sort them, ascending or descending, according to their function values.
The reverse flag can be set to sort in descending order.