Commit aca1aa60 authored by Tijmen de Mes's avatar Tijmen de Mes

Fixed adding css classes to messages

parent 33c7f377
...@@ -109,14 +109,14 @@ class ChatMessageStyle(object): ...@@ -109,14 +109,14 @@ class ChatMessageStyle(object):
# #
class Link(object): class Link(object):
__slots__ = 'prev', 'next', '__next__', 'key', '__weakref__' __slots__ = 'prev', 'next', 'key', '__weakref__'
class OrderedSet(MutableSet): class OrderedSet(MutableSet):
def __init__(self, iterable=None): def __init__(self, iterable=None):
self.__hardroot = Link() # sentinel node for doubly linked list self.__hardroot = Link() # sentinel node for doubly linked list
self.__root = root = proxy(self.__hardroot) self.__root = root = proxy(self.__hardroot)
root.prev = root.__next__ = root root.prev = root.next = root
self.__map = {} self.__map = {}
if iterable is not None: if iterable is not None:
self |= iterable self |= iterable
...@@ -129,10 +129,10 @@ class OrderedSet(MutableSet): ...@@ -129,10 +129,10 @@ class OrderedSet(MutableSet):
def __iter__(self): def __iter__(self):
root = self.__root root = self.__root
curr = root.__next__ curr = root.next
while curr is not root: while curr is not root:
yield curr.key yield curr.key
curr = curr.__next__ curr = curr.next
def __reversed__(self): def __reversed__(self):
root = self.__root root = self.__root
...@@ -157,13 +157,13 @@ class OrderedSet(MutableSet): ...@@ -157,13 +157,13 @@ class OrderedSet(MutableSet):
if key in self.__map: if key in self.__map:
link = self.__map.pop(key) link = self.__map.pop(key)
link_prev = link.prev link_prev = link.prev
link_next = link.__next__ link_next = link.next
link_prev.next = link_next link_prev.next = link_next
link_next.prev = link_prev link_next.prev = link_prev
def clear(self): def clear(self):
root = self.__root root = self.__root
root.prev = root.__next__ = root root.prev = root.next = root
self.__map.clear() self.__map.clear()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment