From 83470fb29ebb952240963060e18d222e8ae334f1 Mon Sep 17 00:00:00 2001 From: Matthias Mair Date: Mon, 22 Jun 2026 22:40:37 +0200 Subject: [PATCH] bump / refactor code refs --- src/backend/InvenTree/InvenTree/version.py | 2 +- src/backend/InvenTree/common/setting/type.py | 14 +------------- src/backend/InvenTree/plugin/installer.py | 3 +-- 3 files changed, 3 insertions(+), 16 deletions(-) diff --git a/src/backend/InvenTree/InvenTree/version.py b/src/backend/InvenTree/InvenTree/version.py index 68072e2fc6..de7196122f 100644 --- a/src/backend/InvenTree/InvenTree/version.py +++ b/src/backend/InvenTree/InvenTree/version.py @@ -18,7 +18,7 @@ from .api_version import INVENTREE_API_TEXT, INVENTREE_API_VERSION INVENTREE_SW_VERSION = '1.4.0 dev' # Minimum supported Python version -MIN_PYTHON_VERSION = (3, 11) +MIN_PYTHON_VERSION = (3, 12) logger = logging.getLogger('inventree') diff --git a/src/backend/InvenTree/common/setting/type.py b/src/backend/InvenTree/common/setting/type.py index 0e788c017f..3a704d5e24 100644 --- a/src/backend/InvenTree/common/setting/type.py +++ b/src/backend/InvenTree/common/setting/type.py @@ -1,19 +1,7 @@ """Types for settings.""" -import sys from collections.abc import Callable -from typing import Any, TypedDict - -if sys.version_info >= (3, 11): - from typing import NotRequired # pragma: no cover -else: - - class NotRequired: # pragma: no cover - """NotRequired type helper is only supported with Python 3.11+.""" - - def __class_getitem__(cls, item): - """Return the item.""" - return item +from typing import Any, NotRequired, TypedDict class SettingsKeyType(TypedDict, total=False): diff --git a/src/backend/InvenTree/plugin/installer.py b/src/backend/InvenTree/plugin/installer.py index acf6584a8d..acff2ea55a 100644 --- a/src/backend/InvenTree/plugin/installer.py +++ b/src/backend/InvenTree/plugin/installer.py @@ -117,8 +117,7 @@ def plugins_file_hash(): try: with pf.open('rb') as f: - # Note: Once we support 3.11 as a minimum, we can use hashlib.file_digest - return hashlib.sha256(f.read()).hexdigest() + return hashlib.file_digest(f, 'sha256').hexdigest() except Exception: log_error('plugins_file_hash', scope='plugins') return None