From fc6e0c3db39469639cbf439b5960db63a5fe5ada Mon Sep 17 00:00:00 2001 From: Mizaki Date: Tue, 12 Dec 2023 23:47:47 +0000 Subject: [PATCH] Parse ct version only once --- comictalker/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/comictalker/__init__.py b/comictalker/__init__.py index c2f92f8..540d023 100644 --- a/comictalker/__init__.py +++ b/comictalker/__init__.py @@ -24,6 +24,7 @@ __all__ = [ def get_talkers(version: str, cache: pathlib.Path) -> dict[str, ComicTalker]: """Returns all comic talker instances""" talkers: dict[str, ComicTalker] = {} + ct_version = parse(version) for talker in entry_points(group="comictagger.talker"): try: @@ -33,7 +34,7 @@ def get_talkers(version: str, cache: pathlib.Path) -> dict[str, ComicTalker]: logger.error("Talker ID must be the same as the entry point name") continue try: - if parse(version) >= parse(obj.comictagger_min_ver): + if ct_version >= parse(obj.comictagger_min_ver): talkers[talker.name] = obj else: logger.error(