Revert comments about location.

This commit is contained in:
Oleksandr Kozachuk
2023-10-19 14:49:56 +02:00
parent 234cca394f
commit cc8ddc4fd9
+14 -14
View File
@@ -429,7 +429,7 @@ class ChatDB(Chat):
unique_messages.append(m) unique_messages.append(m)
try: try:
unique_messages.sort(key=lambda m: m.msg_id()) 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: except MessageError:
pass pass
return unique_messages 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 found are ignored (i. e. the caller should check the result if they require all
messages). messages).
Searches one of the following locations: Searches one of the following locations:
* msg_location.MEM : messages currently in memory * 'mem' : messages currently in memory
* msg_location.DISK : messages on disk (cache + DB directory), but not in memory * 'disk' : messages on disk (cache + DB directory), but not in memory
* 'cache': messages in the cache directory * 'cache': messages in the cache directory
* msg_location.DB : messages in the DB directory * 'db' : messages in the DB directory
* msg_location.ALL : all messages (msg_location.MEM + msg_location.DISK) * 'all' : all messages ('mem' + 'disk')
""" """
loc_messages = self.msg_gather(loc, require_file_path=True) loc_messages = self.msg_gather(loc, require_file_path=True)
return [m for m in loc_messages 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 (with or without suffix), full paths or Message.msg_id(). Also deletes the
files of all given messages with a valid file_path. files of all given messages with a valid file_path.
Delete files from one of the following locations: Delete files from one of the following locations:
* msg_location.MEM : messages currently in memory * 'mem' : messages currently in memory
* msg_location.DISK : messages on disk (cache + DB directory), but not in memory * 'disk' : messages on disk (cache + DB directory), but not in memory
* 'cache': messages in the cache directory * 'cache': messages in the cache directory
* msg_location.DB : messages in the DB directory * 'db' : messages in the DB directory
* msg_location.ALL : all messages (msg_location.MEM + msg_location.DISK) * 'all' : all messages ('mem' + 'disk')
""" """
if loc != msg_location.MEM: if loc != msg_location.MEM:
# delete the message files first # delete the message files first
@@ -480,13 +480,13 @@ class ChatDB(Chat):
loc: msg_location = msg_location.MEM) -> Optional[Message]: loc: msg_location = msg_location.MEM) -> Optional[Message]:
""" """
Return the last added message (according to the file ID) that matches the given filter. 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: Searches one of the following locations:
* msg_location.MEM : messages currently in memory * 'mem' : messages currently in memory
* msg_location.DISK : messages on disk (cache + DB directory), but not in memory * 'disk' : messages on disk (cache + DB directory), but not in memory
* 'cache': messages in the cache directory * 'cache': messages in the cache directory
* msg_location.DB : messages in the DB directory * 'db' : messages in the DB directory
* msg_location.ALL : all messages (msg_location.MEM + msg_location.DISK) * 'all' : all messages ('mem' + 'disk')
""" """
# only consider messages with a valid file_path so they can be sorted # only consider messages with a valid file_path so they can be sorted
loc_messages = self.msg_gather(loc, require_file_path=True) loc_messages = self.msg_gather(loc, require_file_path=True)