|
Debug Tools
|


Public Member Functions | |
| def | __init__ (self, initial=None, is_set=False, emquote=False, index=False) |
| def | __repr__ (self) |
| def | __str__ (self) |
| def | __contains__ (self, key) |
| def | __len__ (self) |
| def | __call__ (self, how_many_times=-1) |
| def | __iter__ (self) |
| def | __setitem__ (self, key, value) |
| def | __getitem__ (self, key) |
| def | __delitem__ (self, key) |
| def | trim_indexes_sorted (self) |
| def | trim_indexes_unsorted (self) |
| def | keys (self, how_many_times=-1) |
| def | values (self, how_many_times=-1) |
| def | items (self, how_many_times=-1) |
| def | get_key (self, index) |
| def | get_value (self, index) |
| def | get_key_value (self, index) |
| def | get_iterator (self, target_generation, how_many_times=-1) |
| def | not_iterate_over_new_items (self, how_many_times=1) |
| def | fromkeys (self, iterable) |
| def | append (self, element) |
| def | remove (self, element) |
| def | add (self, element) |
| def | discard (self, element) |
| def | copy (self) |
| def | clear (self) |
Public Attributes | |
| keys_list | |
| The list with the keys of this collection elements. | |
| values_list | |
| The list with the elements of this collection. | |
| empty_slots | |
| List the empty free spots for old items, used globally before the iteration starts. | |
| filled_slots | |
List the empty free spots for old items, used globally after the iteration starts with new_items_skip_count | |
| items_dictionary | |
| A dictionary with the indexes of the elements in this collection. | |
| new_items_skip_count | |
| Whether the iteration process is allowed to use new items added on the current iteration. | |
| new_items_skip_stack | |
A stack of new_items_skip_count which is required when the current iterator is called recursively. | |
| maximum_iterable_index | |
Holds the global maximum iterable index used when new_items_skip_count is set. | |
A `dict()` like object which allows to dynamically add and remove items while iterating over
its elements as in `for element in dynamic_set`
https://wiki.python.org/moin/TimeComplexity
https://stackoverflow.com/questions/4014621/a-python-class-that-acts-like-dict
Definition at line 139 of file dynamic_iteration.py.
| def __init__ | ( | self, | |
initial = None, |
|||
is_set = False, |
|||
emquote = False, |
|||
index = False |
|||
| ) |
Fully initializes and create a new dictionary.
@param `initial` is a dictionary used to initialize it with new values.
Definition at line 148 of file dynamic_iteration.py.
References DynamicIterationDict._is_set.
| def __call__ | ( | self, | |
how_many_times = -1 |
|||
| ) |
Return a iterable for the keys elements of this collection when calling its object as a
function call.
`how_many_times` is for how many iterations it should keep ignoring the new items.
Definition at line 251 of file dynamic_iteration.py.
References DynamicIterationDict.get_iterator(), and DynamicIterationDict.get_key().

| def __contains__ | ( | self, | |
| key | |||
| ) |
Determines whether this dictionary contains or not a given `key`.
Definition at line 239 of file dynamic_iteration.py.
References DynamicIterationDict.items_dictionary.
| def __delitem__ | ( | self, | |
| key | |||
| ) |
Given a `key` deletes if from this dict.
Definition at line 307 of file dynamic_iteration.py.
References DynamicIterationDict.add(), DynamicIterable.empty_slots, DynamicIterationDict.empty_slots, and DynamicIterationDict.items_dictionary.

| def __getitem__ | ( | self, | |
| key | |||
| ) |
Given a `key` returns its existent value.
Definition at line 300 of file dynamic_iteration.py.
References DynamicIterationDict.items_dictionary, and DynamicIterationDict.values_list.
| def __iter__ | ( | self | ) |
Called by Python automatically when iterating over this set and python wants to start
the iteration process.
Why have an __iter__ method in Python?
https://stackoverflow.com/questions/36681312/why-have-an-iter-method-in-python
Definition at line 260 of file dynamic_iteration.py.
References DynamicIterationDict.get_iterator(), and DynamicIterationDict.get_key().

| def __len__ | ( | self | ) |
Return the total length of this set.
Definition at line 245 of file dynamic_iteration.py.
References DynamicIterationDict.items_dictionary.
| def __repr__ | ( | self | ) |
Return a full representation of all public attributes of this object set state for
debugging purposes.
Definition at line 198 of file dynamic_iteration.py.
Referenced by LockableType.__setattr__().

| def __setitem__ | ( | self, | |
| key, | |||
| value | |||
| ) |
Given a `key` and `item` add it to this dictionary as a non yet iterated item, replacing
the existent value. It a iteration is running, and the item was already iterated, then
it will be updated on the `niterated_items` dict.
Definition at line 270 of file dynamic_iteration.py.
References DynamicIterationDict.add(), DynamicIterationDict.append(), DynamicIterable.empty_slots, DynamicIterationDict.empty_slots, DynamicIterable.filled_slots, DynamicIterationDict.filled_slots, DynamicIterationDict.items_dictionary, DynamicIterationDict.keys_list, DynamicIterationDict.new_items_skip_count, and DynamicIterationDict.values_list.

| def __str__ | ( | self | ) |
Return a nice string representation of this collection.
Definition at line 205 of file dynamic_iteration.py.
References DynamicIterationDict._add_index, DynamicIterationDict._emquote_keys, DynamicIterationDict._is_set, DynamicIterable.empty_slots, DynamicIterationDict.empty_slots, DynamicIterationDict.get_key(), DynamicIterationDict.keys(), DynamicIterationDict.keys_list, and DynamicIterationDict.values_list.
Referenced by LockableType.__repr__().


| def add | ( | self, | |
| element | |||
| ) |
Add a new element to the end of the list.
Definition at line 468 of file dynamic_iteration.py.
Referenced by DynamicIterationDict.__delitem__(), and DynamicIterationDict.__setitem__().

| def append | ( | self, | |
| element | |||
| ) |
Add a new element to the end of the list.
Definition at line 456 of file dynamic_iteration.py.
Referenced by DynamicIterationDict.__setitem__(), and DynamicIterationDict.not_iterate_over_new_items().

| def clear | ( | self | ) |
Remove all items from this dict.
Definition at line 489 of file dynamic_iteration.py.
References DynamicIterable.empty_slots, DynamicIterationDict.empty_slots, DynamicIterable.filled_slots, DynamicIterationDict.filled_slots, DynamicIterationDict.items_dictionary, DynamicIterationDict.keys_list, and DynamicIterationDict.values_list.
Referenced by SleepEvent.sleep(), and DynamicIterationDict.trim_indexes_sorted().
| def copy | ( | self | ) |
Return a deep copy of this collection.
Definition at line 483 of file dynamic_iteration.py.
| def discard | ( | self, | |
| element | |||
| ) |
Remove new `element` anywhere in the container.
Definition at line 474 of file dynamic_iteration.py.
| def fromkeys | ( | self, | |
| iterable | |||
| ) |
Initialize a dictionary with None default value, acting like a indexed set.
Definition at line 448 of file dynamic_iteration.py.
| def get_iterator | ( | self, | |
| target_generation, | |||
how_many_times = -1 |
|||
| ) |
Get fully configured iterable given the getter `target_generation(index)` function.
`how_many_times` is for how many iterations it should keep ignoring the new items.
Definition at line 408 of file dynamic_iteration.py.
References DynamicIterable.empty_slots, DynamicIterationDict.empty_slots, DynamicIterable.filled_slots, DynamicIterationDict.filled_slots, DynamicIterationDict.items_dictionary, DynamicIterationDict.maximum_iterable_index, DynamicIterationDict.new_items_skip_count, DynamicIterationDict.new_items_skip_stack, and DynamicIterationDict.not_iterate_over_new_items().
Referenced by DynamicIterationDict.__call__(), DynamicIterationDict.__iter__(), DynamicIterationDict.items(), DynamicIterationDict.keys(), and DynamicIterationDict.values().


| def get_key | ( | self, | |
| index | |||
| ) |
Given a `index` returns its corresponding key.
Definition at line 390 of file dynamic_iteration.py.
References DynamicIterationDict.keys_list.
Referenced by DynamicIterationDict.__call__(), DynamicIterationDict.__iter__(), DynamicIterationDict.__str__(), and DynamicIterationDict.keys().

| def get_key_value | ( | self, | |
| index | |||
| ) |
Given a `index` returns its corresponding (key, value) pair.
Definition at line 402 of file dynamic_iteration.py.
References DynamicIterationDict.keys_list, and DynamicIterationDict.values_list.
Referenced by DynamicIterationDict.items().

| def get_value | ( | self, | |
| index | |||
| ) |
Given a `index` returns its corresponding value.
Definition at line 396 of file dynamic_iteration.py.
References DynamicIterationDict.values_list.
Referenced by DynamicIterationDict.values().

| def items | ( | self, | |
how_many_times = -1 |
|||
| ) |
Return a DynamicIterable over the (key, value) stored in this collection.
`how_many_times` is for how many iterations it should keep ignoring the new items.
Definition at line 382 of file dynamic_iteration.py.
References DynamicIterationDict.get_iterator(), and DynamicIterationDict.get_key_value().

| def keys | ( | self, | |
how_many_times = -1 |
|||
| ) |
Return a DynamicIterable over the keys stored in this collection.
`how_many_times` is for how many iterations it should keep ignoring the new items.
Definition at line 366 of file dynamic_iteration.py.
References DynamicIterationDict.get_iterator(), and DynamicIterationDict.get_key().
Referenced by DynamicIterationDict.__str__().


| def not_iterate_over_new_items | ( | self, | |
how_many_times = 1 |
|||
| ) |
If called before start iterating over this dictionary, it will not iterate over the
new keys added until the current iteration is over.
`how_many_times` is for how many iterations it should keep ignoring the new items.
Definition at line 430 of file dynamic_iteration.py.
References DynamicIterationDict.append(), DynamicIterable.filled_slots, DynamicIterationDict.filled_slots, DynamicIterationDict.keys_list, DynamicIterationDict.maximum_iterable_index, DynamicIterationDict.new_items_skip_count, and DynamicIterationDict.new_items_skip_stack.
Referenced by DynamicIterationDict.get_iterator().


| def remove | ( | self, | |
| element | |||
| ) |
Remove new `element` anywhere in the container.
Definition at line 462 of file dynamic_iteration.py.
| def trim_indexes_sorted | ( | self | ) |
Fix the the outdated indexes on the internal lists after their dictionary removal,
keeping the items original ordering O(n).
Definition at line 318 of file dynamic_iteration.py.
References DynamicIterationDict.clear(), DynamicIterable.empty_slots, DynamicIterationDict.empty_slots, DynamicIterationDict.items_dictionary, DynamicIterationDict.keys_list, and DynamicIterationDict.values_list.

| def trim_indexes_unsorted | ( | self | ) |
Fix the the outdated indexes on the internal lists after their dictionary removal.
keeping the items original ordering O(k), where `k` is length of `self.empty_slots`.
Definition at line 340 of file dynamic_iteration.py.
References DynamicIterable.empty_slots, DynamicIterationDict.empty_slots, DynamicIterationDict.items_dictionary, DynamicIterationDict.keys_list, and DynamicIterationDict.values_list.
| def values | ( | self, | |
how_many_times = -1 |
|||
| ) |
Return a DynamicIterable over the values stored in this collection.
`how_many_times` is for how many iterations it should keep ignoring the new items.
Definition at line 374 of file dynamic_iteration.py.
References DynamicIterationDict.get_iterator(), and DynamicIterationDict.get_value().
