From 5532e4e267e4dbb2bee05e95180d981572255f30 Mon Sep 17 00:00:00 2001 From: aclist <92275929+aclist@users.noreply.github.com> Date: Thu, 13 Aug 2026 13:42:51 +0900 Subject: [PATCH] chore: simplify control flow --- dzgui/util/map_count.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/dzgui/util/map_count.py b/dzgui/util/map_count.py index de135f8..9adc00e 100644 --- a/dzgui/util/map_count.py +++ b/dzgui/util/map_count.py @@ -22,9 +22,11 @@ def is_map_count_valid(count: int | None) -> bool: def get_map_count() -> int | None: path = Path(VM_FILE) - if path.is_file() is False: + try: + count = int(path.read_text()) + except Exception as e: + logger.debug(e) return None - count = int(path.read_text()) return count @@ -38,11 +40,10 @@ def test_map_count() -> None: def set_map_count() -> None: count = get_map_count() - valid = is_map_count_valid(count) if count is None: print(map_count.failed_to_parse) return - elif valid: + if is_map_count_valid(count): msg = map_count.meets_minimum.format(count) print(msg) return