mypy fixed

This commit is contained in:
Brian Bjarke Jensen
2025-09-17 12:04:45 +02:00
parent ee6acc6791
commit 538b26b62f
2 changed files with 14 additions and 4 deletions
@@ -1,7 +1,7 @@
"""Definition of RedisAdapter class."""
from __future__ import annotations
from typing import cast
from typing import cast, TYPE_CHECKING
import os
import structlog
@@ -12,6 +12,11 @@ from python_repositories.interfaces import (
ConnectionAwareInterface,
)
# Import for mypy type checking only
if TYPE_CHECKING:
import redis
from redis.commands.json.path import Path as RedisPath
class RedisAdapter(
ContextAwareInterface,
@@ -26,8 +31,8 @@ class RedisAdapter(
def __init__(self) -> None:
# Import here to avoid hard dependency to optional package
try:
import redis # type: ignore[import]
from redis.commands.json.path import Path as RedisPath # type: ignore[import]
import redis
from redis.commands.json.path import Path as RedisPath
except ImportError as e:
raise RuntimeError("RedisAdapter dependencies missing") from e
# Setup logger