From eeb10bc817adc3b00b5f3ea7a661c58df90d2815 Mon Sep 17 00:00:00 2001 From: Nithin Date: Fri, 7 Aug 2026 15:06:10 -0400 Subject: [PATCH 1/2] fix: Fix mypy TorchTensor type alias error Fix the TypeAlias annotation of TorchTensor in the fallback branch of online_response.py to stop mypy from treating it as a variable and raising 'not valid as a type'. Fixes #5563 Signed-off-by: Nithin --- sdk/python/feast/online_response.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/sdk/python/feast/online_response.py b/sdk/python/feast/online_response.py index 7b6b4806e4d..0e122ff794a 100644 --- a/sdk/python/feast/online_response.py +++ b/sdk/python/feast/online_response.py @@ -13,7 +13,7 @@ # limitations under the License. import uuid as uuid_module -from typing import TYPE_CHECKING, Any, Dict, List, Optional, TypeAlias, Union +from typing import TYPE_CHECKING, Any, Dict, List, Optional, Union import pandas as pd import pyarrow as pa @@ -26,10 +26,9 @@ if TYPE_CHECKING: import torch - - TorchTensor: TypeAlias = torch.Tensor + from torch import Tensor as TorchTensor else: - TorchTensor: TypeAlias = Any + TorchTensor = Any TIMESTAMP_POSTFIX: str = "__ts" From a0c040ffa6468eb0af600ef416e768a355875183 Mon Sep 17 00:00:00 2001 From: Nithin <52503252+nithin42@users.noreply.github.com> Date: Mon, 10 Aug 2026 07:27:54 -0400 Subject: [PATCH 2/2] fix: remove redundant `import torch` under TYPE_CHECKING block The bare `import torch` statement inside the `if TYPE_CHECKING:` branch was superseded by `from torch import Tensor as TorchTensor` on the following line. Since `TorchTensor` is the only torch symbol referenced in type annotations, the standalone module import is unnecessary and can be dropped without affecting runtime or static-analysis behaviour. Addresses nitpick raised in code review. Signed-off-by: Nithin --- sdk/python/feast/online_response.py | 1 - 1 file changed, 1 deletion(-) diff --git a/sdk/python/feast/online_response.py b/sdk/python/feast/online_response.py index 0e122ff794a..9ee1e65074d 100644 --- a/sdk/python/feast/online_response.py +++ b/sdk/python/feast/online_response.py @@ -25,7 +25,6 @@ from feast.value_type import ValueType if TYPE_CHECKING: - import torch from torch import Tensor as TorchTensor else: TorchTensor = Any