File tree Expand file tree Collapse file tree 3 files changed +13
-6
lines changed Expand file tree Collapse file tree 3 files changed +13
-6
lines changed Original file line number Diff line number Diff line change 19
19
20
20
if TYPE_CHECKING :
21
21
from django_valkey .async_cache .cache import AsyncValkeyCache
22
- from django_valkey .async_cache .pool import AsyncConnectionFactory , AsyncSentinelConnectionFactory
22
+ from django_valkey .async_cache .pool import (
23
+ AsyncConnectionFactory ,
24
+ AsyncSentinelConnectionFactory ,
25
+ )
23
26
24
27
25
28
async def glove_escape (s : str ) -> str :
@@ -56,7 +59,9 @@ def __init__(
56
59
"DJANGO_VALKEY_CONNECTION_FACTORY" ,
57
60
"django_valkey.async_cache.pool.AsyncConnectionFactory" ,
58
61
)
59
- self .connection_factory : AsyncConnectionFactory | AsyncSentinelConnectionFactory | Any = pool .get_connection_factory (
62
+ self .connection_factory : (
63
+ AsyncConnectionFactory | AsyncSentinelConnectionFactory | Any
64
+ ) = pool .get_connection_factory (
60
65
options = self ._options , path = self ._connection_factory
61
66
)
62
67
Original file line number Diff line number Diff line change 9
9
from valkey .asyncio .sentinel import Sentinel
10
10
from valkey ._parsers .url_parser import to_bool
11
11
12
- from django_valkey .base_pool import BaseConnectionPool , Base , Pool
12
+ from django_valkey .base_pool import BaseConnectionPool
13
13
14
14
15
15
class AsyncConnectionFactory (BaseConnectionPool [AValkey , ConnectionPool ]):
@@ -31,8 +31,9 @@ async def connect(self, url: str) -> AValkey | Any:
31
31
32
32
async def get_connection (self , params : dict ) -> AValkey | Any :
33
33
pool = self .get_or_create_connection_pool (params )
34
- return await self .base_client_cls (connection_pool = pool , ** self .base_client_cls_kwargs )
35
-
34
+ return await self .base_client_cls (
35
+ connection_pool = pool , ** self .base_client_cls_kwargs
36
+ )
36
37
37
38
38
39
class AsyncSentinelConnectionFactory (AsyncConnectionFactory ):
Original file line number Diff line number Diff line change @@ -30,14 +30,15 @@ def get_parser_cls(self) -> type[DefaultParser] | type:
30
30
return DefaultParser
31
31
return import_string (cls )
32
32
33
- def connect (self , url : str ) -> Valkey | Any :
33
+ def connect (self , url : str ) -> Valkey | Any :
34
34
params = self .make_connection_params (url )
35
35
return self .get_connection (params )
36
36
37
37
def get_connection (self , params : dict ) -> Base | Any :
38
38
pool = self .get_or_create_connection_pool (params )
39
39
return self .base_client_cls (connection_pool = pool , ** self .base_client_cls_kwargs )
40
40
41
+
41
42
class SentinelConnectionFactory (ConnectionFactory ):
42
43
def __init__ (self , options : dict ):
43
44
# allow overriding the default SentinelConnectionPool class
You can’t perform that action at this time.
0 commit comments