From 1bb01c3e69f82079cc7c9a23b78ac3abcf8da4c3 Mon Sep 17 00:00:00 2001 From: Outvi V Date: Sun, 12 Jan 2025 00:18:13 +0800 Subject: [PATCH] fix: don't read() within `with` --- mw2fcitx/pipeline.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mw2fcitx/pipeline.py b/mw2fcitx/pipeline.py index b672771..03d4d16 100644 --- a/mw2fcitx/pipeline.py +++ b/mw2fcitx/pipeline.py @@ -53,8 +53,8 @@ def load_titles_from_file(self, filename, **kwargs): "remove this parameter (\"file_path\") or provide a readable file" ) sys.exit(1) - with open(filename, "r", encoding="utf-8").read() as fp: - self.load_titles(fp, limit=limit) + with open(filename, "r", encoding="utf-8") as fp: + self.load_titles(fp.read(), limit=limit) def fetch_titles(self, **kwargs): titles = fetch_all_titles(self.api_path, **kwargs)