Skip to content

redis: Fix unconstrained TypeVars in a few redis commands #7942

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

Merged
merged 3 commits into from
May 26, 2022
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
56 changes: 52 additions & 4 deletions stubs/redis/redis/commands/core.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -635,20 +635,43 @@ class ScanCommands(Generic[_StrType]):
def hscan_iter(
self, name: _Key, match: _Key | None = ..., count: int | None = ...
) -> Iterator[tuple[_StrType, _StrType]]: ...
@overload
def zscan(
self, name: _Key, cursor: int = ..., match: _Key | None = ..., count: int | None = ...
) -> tuple[int, list[tuple[_StrType, float]]]: ...
@overload
def zscan(
self,
name: _Key,
cursor: int = ...,
match: _Key | None = ...,
count: int | None = ...,
score_cast_func: Callable[[_StrType], _ScoreCastFuncReturn] = ...,
*,
score_cast_func: Callable[[_StrType], _ScoreCastFuncReturn],
) -> tuple[int, list[tuple[_StrType, _ScoreCastFuncReturn]]]: ...
@overload
def zscan(
self,
name: _Key,
cursor: int,
match: _Key | None,
count: int | None,
score_cast_func: Callable[[_StrType], _ScoreCastFuncReturn],
) -> tuple[int, list[tuple[_StrType, _ScoreCastFuncReturn]]]: ...
@overload
def zscan_iter(self, name: _Key, match: _Key | None = ..., count: int | None = ...) -> Iterator[tuple[_StrType, float]]: ...
@overload
def zscan_iter(
self,
name: _Key,
match: _Key | None = ...,
count: int | None = ...,
score_cast_func: Callable[[_StrType], _ScoreCastFuncReturn] = ...,
*,
score_cast_func: Callable[[_StrType], _ScoreCastFuncReturn],
) -> Iterator[tuple[_StrType, _ScoreCastFuncReturn]]: ...
@overload
def zscan_iter(
self, name: _Key, match: _Key | None, count: int | None, score_cast_func: Callable[[_StrType], _ScoreCastFuncReturn]
) -> Iterator[tuple[_StrType, _ScoreCastFuncReturn]]: ...

class AsyncScanCommands(Generic[_StrType]):
Expand All @@ -673,20 +696,45 @@ class AsyncScanCommands(Generic[_StrType]):
def hscan_iter(
self, name: _Key, match: _Key | None = ..., count: int | None = ...
) -> AsyncIterator[tuple[_StrType, _StrType]]: ...
@overload
async def zscan(
self, name: _Key, cursor: int = ..., match: _Key | None = ..., count: int | None = ...
) -> tuple[int, list[tuple[_StrType, float]]]: ...
@overload
async def zscan(
self,
name: _Key,
cursor: int = ...,
match: _Key | None = ...,
count: int | None = ...,
score_cast_func: Callable[[_StrType], _ScoreCastFuncReturn] = ...,
*,
score_cast_func: Callable[[_StrType], _ScoreCastFuncReturn],
) -> tuple[int, list[tuple[_StrType, _ScoreCastFuncReturn]]]: ...
@overload
async def zscan(
self,
name: _Key,
cursor: int,
match: _Key | None,
count: int | None,
score_cast_func: Callable[[_StrType], _ScoreCastFuncReturn],
) -> tuple[int, list[tuple[_StrType, _ScoreCastFuncReturn]]]: ...
@overload
def zscan_iter(
self, name: _Key, match: _Key | None = ..., count: int | None = ...
) -> AsyncIterator[tuple[_StrType, float]]: ...
@overload
def zscan_iter(
self,
name: _Key,
match: _Key | None = ...,
count: int | None = ...,
score_cast_func: Callable[[_StrType], _ScoreCastFuncReturn] = ...,
*,
score_cast_func: Callable[[_StrType], _ScoreCastFuncReturn],
) -> AsyncIterator[tuple[_StrType, _ScoreCastFuncReturn]]: ...
@overload
def zscan_iter(
self, name: _Key, match: _Key | None, count: int | None, score_cast_func: Callable[[_StrType], _ScoreCastFuncReturn]
) -> AsyncIterator[tuple[_StrType, _ScoreCastFuncReturn]]: ...

class SetCommands(Generic[_StrType]):
Expand Down