From 432b108db77b5aee891fddbe91706c50de9a3baf Mon Sep 17 00:00:00 2001 From: cheizdo2-art Date: Sun, 12 Oct 2025 19:22:54 +0200 Subject: [PATCH] Add return type annotations to from_url methods - Add return type annotation to Redis.from_url() in client.py - Add parameter and return type annotations to utils.from_url() - Improves type safety and IDE autocomplete support - Resolves MyPy no-untyped-call errors for users --- redis/asyncio/client.py | 4 ++-- redis/asyncio/utils.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/redis/asyncio/client.py b/redis/asyncio/client.py index 1cc0365a7b..59ae3052db 100644 --- a/redis/asyncio/client.py +++ b/redis/asyncio/client.py @@ -126,12 +126,12 @@ class Redis( @classmethod def from_url( - cls, + cls: type[_RedisT], url: str, single_connection_client: bool = False, auto_close_connection_pool: Optional[bool] = None, **kwargs, - ): + ) -> _RedisT: """ Return a Redis client object configured from the given URL diff --git a/redis/asyncio/utils.py b/redis/asyncio/utils.py index fa014514ec..caa72bb021 100644 --- a/redis/asyncio/utils.py +++ b/redis/asyncio/utils.py @@ -1,10 +1,10 @@ -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING if TYPE_CHECKING: from redis.asyncio.client import Pipeline, Redis -def from_url(url, **kwargs): +def from_url(url: str, **kwargs: Any) -> "Redis": """ Returns an active Redis client generated from the given database URL.