diff options
author | Lee Skillen <lskillen@cloudsmith.io> | 2018-01-31 16:36:16 +0000 |
---|---|---|
committer | Lee Skillen <lskillen@cloudsmith.io> | 2018-09-10 00:42:11 +0100 |
commit | 0823f1131022d1bdf89a083dbe060fe110ea6cd6 (patch) | |
tree | 12cf3ed26986e9ff025b9cb2f66bac8d0a169b2c /uritemplate | |
parent | 12c9fdf6cc413d2b227302181d20456361d94e3b (diff) | |
download | platform_external_python_uritemplates-0823f1131022d1bdf89a083dbe060fe110ea6cd6.tar.gz platform_external_python_uritemplates-0823f1131022d1bdf89a083dbe060fe110ea6cd6.tar.bz2 platform_external_python_uritemplates-0823f1131022d1bdf89a083dbe060fe110ea6cd6.zip |
Fix pep8 complaints
Diffstat (limited to 'uritemplate')
-rw-r--r-- | uritemplate/orderedset.py | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/uritemplate/orderedset.py b/uritemplate/orderedset.py index 94f4733..7a9d33e 100644 --- a/uritemplate/orderedset.py +++ b/uritemplate/orderedset.py @@ -1,25 +1,28 @@ -# From: https://github.com/ActiveState/code/blob/master/recipes/Python/576696_OrderedSet_with_Weakrefs/ +# From: https://github.com/ActiveState/code/blob/master/recipes/Python/576696_OrderedSet_with_Weakrefs/ # noqa import collections from weakref import proxy + class Link(object): __slots__ = 'prev', 'next', 'key', '__weakref__' + class OrderedSet(collections.MutableSet): 'Set the remembers the order elements were added' # Big-O running times for all methods are the same as for regular sets. - # The internal self.__map dictionary maps keys to links in a doubly linked list. - # The circular doubly linked list starts and ends with a sentinel element. - # The sentinel element never gets deleted (this simplifies the algorithm). - # The prev/next links are weakref proxies (to prevent circular references). - # Individual links are kept alive by the hard reference in self.__map. - # Those hard references disappear when a key is deleted from an OrderedSet. + # The internal self.__map dictionary maps keys to links in a doubly linked + # list. The circular doubly linked list starts and ends with a sentinel + # element. The sentinel element never gets deleted (this simplifies the + # algorithm). The prev/next links are weakref proxies (to prevent circular + # references). Individual links are kept alive by the hard reference in + # self.__map. Those hard references disappear when a key is deleted from + # an OrderedSet. def __init__(self, iterable=None): - self.__root = root = Link() # sentinel node for doubly linked list + self.__root = root = Link() # sentinel node for doubly linked list root.prev = root.next = root - self.__map = {} # key --> link + self.__map = {} # key --> link if iterable is not None: self |= iterable |