Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: FakeRedisMixin.from_url() return type is really Self. #305

Merged
merged 1 commit into from
Apr 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions fakeredis/_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import weakref
from collections import defaultdict
from typing import Dict, Tuple, Any, List, Optional, Union, Set
from typing_extensions import Self

import redis

Expand Down Expand Up @@ -139,7 +140,7 @@ def __init__(
self, *args: Any,
server: Optional[FakeServer] = None,
version: VersionType = (7,),
lua_modules: Set[str] = None,
lua_modules: Optional[Set[str]] = None,
**kwargs: Any) -> None:
# Interpret the positional and keyword arguments according to the
# version of redis in use.
Expand Down Expand Up @@ -204,7 +205,7 @@ def __init__(
super().__init__(**kwds)

@classmethod
def from_url(cls, *args: Any, **kwargs: Any) -> "FakeRedisMixin":
def from_url(cls, *args: Any, **kwargs: Any) -> Self:
pool = redis.ConnectionPool.from_url(*args, **kwargs)
# Now override how it creates connections
pool.connection_class = FakeConnection
Expand Down