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

refactor: updating typing for xreadgroup / xread / xadd #130

Merged
Merged
Show file tree
Hide file tree
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
9 changes: 6 additions & 3 deletions valkey/commands/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@
from valkey.exceptions import ConnectionError, DataError, NoScriptError, ValkeyError
from valkey.typing import (
AbsExpiryT,
AnyEncodableT,
AnyFieldT,
AnyKeyT,
AnyStreamIdT,
BitfieldOffsetT,
ChannelT,
CommandsProtocol,
Expand Down Expand Up @@ -3508,7 +3511,7 @@ def xack(self, name: KeyT, groupname: GroupT, *ids: StreamIdT) -> ResponseT:
def xadd(
self,
name: KeyT,
fields: Dict[FieldT, EncodableT],
fields: Mapping[AnyFieldT, AnyEncodableT],
id: StreamIdT = "*",
maxlen: Union[int, None] = None,
approximate: bool = True,
Expand Down Expand Up @@ -3933,7 +3936,7 @@ def xrange(

def xread(
self,
streams: Dict[KeyT, StreamIdT],
streams: Mapping[AnyKeyT, AnyStreamIdT],
count: Union[int, None] = None,
block: Union[int, None] = None,
) -> ResponseT:
Expand Down Expand Up @@ -3973,7 +3976,7 @@ def xreadgroup(
self,
groupname: str,
consumername: str,
streams: Dict[KeyT, StreamIdT],
streams: Mapping[AnyKeyT, AnyStreamIdT],
count: Union[int, None] = None,
block: Union[int, None] = None,
noack: bool = False,
Expand Down
2 changes: 2 additions & 0 deletions valkey/typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@
AnyKeyT = TypeVar("AnyKeyT", bytes, str, memoryview)
AnyFieldT = TypeVar("AnyFieldT", bytes, str, memoryview)
AnyChannelT = TypeVar("AnyChannelT", bytes, str, memoryview)
AnyStreamIdT = TypeVar("AnyStreamIdT", int, bytes, str, memoryview)
AnyEncodableT = TypeVar("AnyEncodableT", int, float, bytes, str, memoryview)

ExceptionMappingT = Mapping[str, Union[Type[Exception], Mapping[str, Type[Exception]]]]

Expand Down
Loading