diff options
author | 2021-08-21 16:39:27 +0300 | |
---|---|---|
committer | 2021-08-21 16:39:27 +0300 | |
commit | aa2a6b436746f7e8b66f960bf3d41748c784469f (patch) | |
tree | 6b92bc317be87a2c44a4e97cf69a6af4d8ad3513 | |
parent | Fix MessageCache slicing bugs, improve tests (diff) |
Clean up code
Removed unused import, corrected docstring, and removed unnedded type annotation.
-rw-r--r-- | bot/utils/message_cache.py | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/bot/utils/message_cache.py b/bot/utils/message_cache.py index 67da8ecf3..6d219c313 100644 --- a/bot/utils/message_cache.py +++ b/bot/utils/message_cache.py @@ -1,5 +1,3 @@ -from __future__ import annotations - import typing as t from math import ceil @@ -10,7 +8,7 @@ class MessageCache: """ A data structure for caching messages. - The cache is implemented as a circular buffer to allow constant time append, prepend, push, pop, + The cache is implemented as a circular buffer to allow constant time append, prepend, pop from either side, and lookup by index. The cache therefore does not support removal at an arbitrary index (although it can be implemented to work in linear time relative to the maximum size). @@ -89,7 +87,7 @@ class MessageCache: def clear(self) -> None: """Remove all messages from the cache.""" - self._messages: list[t.Optional[Message]] = [None] * self.maxlen + self._messages = [None] * self.maxlen self._message_id_mapping = {} self._start = 0 |