From 08461bbe7f3510d9515c991a5d1cfec3c39055c9 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 14 Nov 2025 04:59:00 +0000 Subject: [PATCH] Fix Python 3.9 compatibility by adding future annotations Add 'from __future__ import annotations' to eigen_memory.py, eigen_transformer.py, and eigen_attention.py to support Python 3.9. The pipe union syntax (e.g., str | torch.device | None) is only available in Python 3.10+. Using future annotations allows this syntax to work in Python 3.9 by deferring type annotation evaluation. This fixes the TypeError during test collection in the CI pipeline running pytest on macOS with Python 3.9. --- eigen_attention.py | 2 ++ eigen_memory.py | 2 ++ eigen_transformer.py | 2 ++ 3 files changed, 6 insertions(+) diff --git a/eigen_attention.py b/eigen_attention.py index 1c06945..6148ddb 100644 --- a/eigen_attention.py +++ b/eigen_attention.py @@ -1,3 +1,5 @@ +from __future__ import annotations + import torch import torch.nn as nn import torch.nn.functional as F diff --git a/eigen_memory.py b/eigen_memory.py index 9a9b7dd..d043c53 100644 --- a/eigen_memory.py +++ b/eigen_memory.py @@ -1,3 +1,5 @@ +from __future__ import annotations + import torch import torch.nn as nn import torch.nn.functional as F diff --git a/eigen_transformer.py b/eigen_transformer.py index 0ecc6bf..22d8dca 100644 --- a/eigen_transformer.py +++ b/eigen_transformer.py @@ -1,3 +1,5 @@ +from __future__ import annotations + import torch import torch.nn as nn