From cc8ddc4fd9f769abd4b454d24814886081c0ec84 Mon Sep 17 00:00:00 2001 From: Oleksandr Kozachuk Date: Thu, 19 Oct 2023 14:49:56 +0200 Subject: [PATCH] Revert comments about location. --- chatmastermind/chat.py | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/chatmastermind/chat.py b/chatmastermind/chat.py index ff7c484..5f15a64 100644 --- a/chatmastermind/chat.py +++ b/chatmastermind/chat.py @@ -429,7 +429,7 @@ class ChatDB(Chat): unique_messages.append(m) try: unique_messages.sort(key=lambda m: m.msg_id()) - # messages in msg_location.MEM can have an empty file_path + # messages in 'mem' can have an empty file_path except MessageError: pass return unique_messages @@ -444,11 +444,11 @@ class ChatDB(Chat): found are ignored (i. e. the caller should check the result if they require all messages). Searches one of the following locations: - * msg_location.MEM : messages currently in memory - * msg_location.DISK : messages on disk (cache + DB directory), but not in memory + * 'mem' : messages currently in memory + * 'disk' : messages on disk (cache + DB directory), but not in memory * 'cache': messages in the cache directory - * msg_location.DB : messages in the DB directory - * msg_location.ALL : all messages (msg_location.MEM + msg_location.DISK) + * 'db' : messages in the DB directory + * 'all' : all messages ('mem' + 'disk') """ loc_messages = self.msg_gather(loc, require_file_path=True) return [m for m in loc_messages @@ -460,11 +460,11 @@ class ChatDB(Chat): (with or without suffix), full paths or Message.msg_id(). Also deletes the files of all given messages with a valid file_path. Delete files from one of the following locations: - * msg_location.MEM : messages currently in memory - * msg_location.DISK : messages on disk (cache + DB directory), but not in memory + * 'mem' : messages currently in memory + * 'disk' : messages on disk (cache + DB directory), but not in memory * 'cache': messages in the cache directory - * msg_location.DB : messages in the DB directory - * msg_location.ALL : all messages (msg_location.MEM + msg_location.DISK) + * 'db' : messages in the DB directory + * 'all' : all messages ('mem' + 'disk') """ if loc != msg_location.MEM: # delete the message files first @@ -480,13 +480,13 @@ class ChatDB(Chat): loc: msg_location = msg_location.MEM) -> Optional[Message]: """ Return the last added message (according to the file ID) that matches the given filter. - Only consider messages with a valid file_path (except if loc is msg_location.MEM). + Only consider messages with a valid file_path (except if loc is 'mem'). Searches one of the following locations: - * msg_location.MEM : messages currently in memory - * msg_location.DISK : messages on disk (cache + DB directory), but not in memory + * 'mem' : messages currently in memory + * 'disk' : messages on disk (cache + DB directory), but not in memory * 'cache': messages in the cache directory - * msg_location.DB : messages in the DB directory - * msg_location.ALL : all messages (msg_location.MEM + msg_location.DISK) + * 'db' : messages in the DB directory + * 'all' : all messages ('mem' + 'disk') """ # only consider messages with a valid file_path so they can be sorted loc_messages = self.msg_gather(loc, require_file_path=True)