From 9a493b57dac261fdf0bf947b1a54531c1cba9c7d Mon Sep 17 00:00:00 2001 From: Oleksandr Kozachuk Date: Thu, 19 Oct 2023 16:02:40 +0200 Subject: [PATCH] Per default use only files with .msg suffix ignoring other files. --- chatmastermind/chat.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/chatmastermind/chat.py b/chatmastermind/chat.py index 84fd9b5..1a12d64 100644 --- a/chatmastermind/chat.py +++ b/chatmastermind/chat.py @@ -52,12 +52,12 @@ def read_dir(dir_path: Path, Parameters: * 'dir_path': source directory * 'glob': if specified, files will be filtered using 'path.glob()', - otherwise it uses 'path.iterdir()'. + otherwise it uses '*{msg_suffix}'. * 'mfilter': use with 'Message.from_file()' to filter messages when reading them. """ messages: list[Message] = [] - file_iter = dir_path.glob(glob) if glob else dir_path.iterdir() + file_iter = dir_path.glob(glob) if glob else dir_path.glob(f'*{msg_suffix}') for file_path in sorted(file_iter): if (file_path.is_file() and file_path.name not in ignored_files # noqa: W503