Skip to content

Graph-Native Infrastructure for Context and Accountable AI Systems

fix(utils): resolve Python 3.13 NameError by deferring annotation evaluation

KaifAhmad143c14e41fa86
diff --git a/semantica/utils/exceptions.py b/semantica/utils/exceptions.py
index 9a5385a0..d3f558e0 100644
--- a/semantica/utils/exceptions.py
+++ b/semantica/utils/exceptions.py
@@ -39,9 +39,11 @@ Author: Semantica Contributors
License: MIT
"""
+from __future__ import annotations
+
import sys
import traceback
-from typing import Any, Dict, Optional, Type
+from typing import Any, Dict, Optional
class SemanticaError(Exception):
diff --git a/semantica/utils/helpers.py b/semantica/utils/helpers.py
index 3b19ae6e..1457e4d1 100644
--- a/semantica/utils/helpers.py
+++ b/semantica/utils/helpers.py
@@ -55,13 +55,15 @@ Author: Semantica Contributors
License: MIT
"""
+from __future__ import annotations
+
import hashlib
import json
import os
import re
from datetime import datetime, timezone
from pathlib import Path
-from typing import Any, Dict, List, Optional, Tuple, Type, Union
+from typing import Any, Dict, List, Optional, Tuple, Union
def format_data(data: Any, format_type: str = "json") -> str:
@@ -470,7 +472,7 @@ def retry_on_error(
max_retries: int = 3,
delay: float = 1.0,
backoff_factor: float = 2.0,
- exceptions: Tuple[Type[Exception], ...] = (Exception,),
+ exceptions: Tuple[type[Exception], ...] = (Exception,),
):
"""
Decorator for retrying function on error.