From d5c000e58e5032aa827a4d81ac01908ca27e7357 Mon Sep 17 00:00:00 2001 From: Xavier Karma Date: Fri, 6 Nov 2026 19:29:21 +0530 Subject: [PATCH] refactor(utils): drop importlib.resources fallback below the 3.11 floor requires-python is >=3.11, so the ImportError branch that guarded importlib.resources.files is dead code. Import it at module scope and keep only the failures files() can really raise. The python37-compatibility rule still matches the import itself even though 3.11 has files(). That is a false positive for this floor, so the import carries a one-line nosemgrep. --- src/vocalinux/utils/model_checksums.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/vocalinux/utils/model_checksums.py b/src/vocalinux/utils/model_checksums.py index 3665776..0b6a46d 100644 --- a/src/vocalinux/utils/model_checksums.py +++ b/src/vocalinux/utils/model_checksums.py @@ -32,6 +32,7 @@ import logging import os import re from functools import lru_cache +from importlib.resources import files # nosemgrep: python37-compatibility-importlib2 -- py>=3.11 from typing import Dict, NamedTuple, Optional from ..app_identity import VERIFICATION_STAMP_NAME @@ -72,10 +73,8 @@ def _manifest_text() -> str: :func:`verify_model_file`, which is the safe direction to fail. """ try: - from importlib.resources import files - return files(__package__).joinpath(_MANIFEST_NAME).read_text(encoding="utf-8") - except (ImportError, TypeError, ModuleNotFoundError): + except (TypeError, ModuleNotFoundError): pass except (FileNotFoundError, OSError): return ""