From 63f567f6ea1aea678d1fe31488912adc35c5f0d8 Mon Sep 17 00:00:00 2001 From: M1nd3r Date: Mon, 11 Mar 2024 11:42:16 +0100 Subject: [PATCH] Fix SyntaxError - SESSIONLESS_FLAG cannot be used as a constant when imported --- core/src/storage/cache.py | 4 +++- core/src/storage/cache_common.py | 6 +----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/core/src/storage/cache.py b/core/src/storage/cache.py index 8a3518340..0d36faa72 100644 --- a/core/src/storage/cache.py +++ b/core/src/storage/cache.py @@ -4,7 +4,9 @@ from micropython import const from typing import TYPE_CHECKING from trezor import utils -from storage.cache_common import SESSIONLESS_FLAG, InvalidSessionError, SessionlessCache +from storage.cache_common import InvalidSessionError, SessionlessCache + +SESSIONLESS_FLAG = const(128) if TYPE_CHECKING: from typing import Sequence, TypeVar, overload diff --git a/core/src/storage/cache_common.py b/core/src/storage/cache_common.py index ac160cc52..8e06768dd 100644 --- a/core/src/storage/cache_common.py +++ b/core/src/storage/cache_common.py @@ -1,4 +1,3 @@ -from micropython import const from typing import TYPE_CHECKING from trezor import utils @@ -8,8 +7,6 @@ if TYPE_CHECKING: T = TypeVar("T") -SESSIONLESS_FLAG = const(128) - class InvalidSessionError(Exception): pass @@ -30,8 +27,7 @@ class DataCache: if TYPE_CHECKING: @overload - def get(self, key: int) -> bytes | None: - ... + def get(self, key: int) -> bytes | None: ... @overload def get(self, key: int, default: T) -> bytes | T: # noqa: F811