mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-08 13:04:46 +08:00
Redis Sentinel master_for, slave_for returns a Redis client (#6269)
This commit is contained in:
@@ -1,8 +1,11 @@
|
||||
from typing import Any
|
||||
from typing import Any, Type, TypeVar, overload
|
||||
|
||||
from redis.client import Redis
|
||||
from redis.connection import Connection, ConnectionPool
|
||||
from redis.exceptions import ConnectionError
|
||||
|
||||
_Redis = TypeVar("_Redis", bound=Redis[Any])
|
||||
|
||||
class MasterNotFoundError(ConnectionError): ...
|
||||
class SlaveNotFoundError(ConnectionError): ...
|
||||
|
||||
@@ -39,5 +42,11 @@ class Sentinel(object):
|
||||
def discover_master(self, service_name): ...
|
||||
def filter_slaves(self, slaves): ...
|
||||
def discover_slaves(self, service_name): ...
|
||||
def master_for(self, service_name, redis_class=..., connection_pool_class=..., **kwargs) -> None: ...
|
||||
def slave_for(self, service_name, redis_class=..., connection_pool_class=..., **kwargs) -> None: ...
|
||||
@overload
|
||||
def master_for(self, service_name: str, *, connection_pool_class=..., **kwargs) -> Redis[Any]: ...
|
||||
@overload
|
||||
def master_for(self, service_name: str, redis_class: Type[_Redis] = ..., connection_pool_class=..., **kwargs) -> _Redis: ...
|
||||
@overload
|
||||
def slave_for(self, service_name: str, connection_pool_class=..., **kwargs) -> Redis[Any]: ...
|
||||
@overload
|
||||
def slave_for(self, service_name: str, redis_class: Type[_Redis] = ..., connection_pool_class=..., **kwargs) -> _Redis: ...
|
||||
|
||||
Reference in New Issue
Block a user