Skip to content

Commit 466f9c2

Browse files
redis: Fix unconstrained TypeVars in a few redis commands (#7942)
Part of #7928
1 parent d511312 commit 466f9c2

File tree

1 file changed

+52
-4
lines changed

1 file changed

+52
-4
lines changed

stubs/redis/redis/commands/core.pyi

Lines changed: 52 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -635,20 +635,43 @@ class ScanCommands(Generic[_StrType]):
635635
def hscan_iter(
636636
self, name: _Key, match: _Key | None = ..., count: int | None = ...
637637
) -> Iterator[tuple[_StrType, _StrType]]: ...
638+
@overload
639+
def zscan(
640+
self, name: _Key, cursor: int = ..., match: _Key | None = ..., count: int | None = ...
641+
) -> tuple[int, list[tuple[_StrType, float]]]: ...
642+
@overload
638643
def zscan(
639644
self,
640645
name: _Key,
641646
cursor: int = ...,
642647
match: _Key | None = ...,
643648
count: int | None = ...,
644-
score_cast_func: Callable[[_StrType], _ScoreCastFuncReturn] = ...,
649+
*,
650+
score_cast_func: Callable[[_StrType], _ScoreCastFuncReturn],
645651
) -> tuple[int, list[tuple[_StrType, _ScoreCastFuncReturn]]]: ...
652+
@overload
653+
def zscan(
654+
self,
655+
name: _Key,
656+
cursor: int,
657+
match: _Key | None,
658+
count: int | None,
659+
score_cast_func: Callable[[_StrType], _ScoreCastFuncReturn],
660+
) -> tuple[int, list[tuple[_StrType, _ScoreCastFuncReturn]]]: ...
661+
@overload
662+
def zscan_iter(self, name: _Key, match: _Key | None = ..., count: int | None = ...) -> Iterator[tuple[_StrType, float]]: ...
663+
@overload
646664
def zscan_iter(
647665
self,
648666
name: _Key,
649667
match: _Key | None = ...,
650668
count: int | None = ...,
651-
score_cast_func: Callable[[_StrType], _ScoreCastFuncReturn] = ...,
669+
*,
670+
score_cast_func: Callable[[_StrType], _ScoreCastFuncReturn],
671+
) -> Iterator[tuple[_StrType, _ScoreCastFuncReturn]]: ...
672+
@overload
673+
def zscan_iter(
674+
self, name: _Key, match: _Key | None, count: int | None, score_cast_func: Callable[[_StrType], _ScoreCastFuncReturn]
652675
) -> Iterator[tuple[_StrType, _ScoreCastFuncReturn]]: ...
653676

654677
class AsyncScanCommands(Generic[_StrType]):
@@ -673,20 +696,45 @@ class AsyncScanCommands(Generic[_StrType]):
673696
def hscan_iter(
674697
self, name: _Key, match: _Key | None = ..., count: int | None = ...
675698
) -> AsyncIterator[tuple[_StrType, _StrType]]: ...
699+
@overload
700+
async def zscan(
701+
self, name: _Key, cursor: int = ..., match: _Key | None = ..., count: int | None = ...
702+
) -> tuple[int, list[tuple[_StrType, float]]]: ...
703+
@overload
676704
async def zscan(
677705
self,
678706
name: _Key,
679707
cursor: int = ...,
680708
match: _Key | None = ...,
681709
count: int | None = ...,
682-
score_cast_func: Callable[[_StrType], _ScoreCastFuncReturn] = ...,
710+
*,
711+
score_cast_func: Callable[[_StrType], _ScoreCastFuncReturn],
712+
) -> tuple[int, list[tuple[_StrType, _ScoreCastFuncReturn]]]: ...
713+
@overload
714+
async def zscan(
715+
self,
716+
name: _Key,
717+
cursor: int,
718+
match: _Key | None,
719+
count: int | None,
720+
score_cast_func: Callable[[_StrType], _ScoreCastFuncReturn],
683721
) -> tuple[int, list[tuple[_StrType, _ScoreCastFuncReturn]]]: ...
722+
@overload
723+
def zscan_iter(
724+
self, name: _Key, match: _Key | None = ..., count: int | None = ...
725+
) -> AsyncIterator[tuple[_StrType, float]]: ...
726+
@overload
684727
def zscan_iter(
685728
self,
686729
name: _Key,
687730
match: _Key | None = ...,
688731
count: int | None = ...,
689-
score_cast_func: Callable[[_StrType], _ScoreCastFuncReturn] = ...,
732+
*,
733+
score_cast_func: Callable[[_StrType], _ScoreCastFuncReturn],
734+
) -> AsyncIterator[tuple[_StrType, _ScoreCastFuncReturn]]: ...
735+
@overload
736+
def zscan_iter(
737+
self, name: _Key, match: _Key | None, count: int | None, score_cast_func: Callable[[_StrType], _ScoreCastFuncReturn]
690738
) -> AsyncIterator[tuple[_StrType, _ScoreCastFuncReturn]]: ...
691739

692740
class SetCommands(Generic[_StrType]):

0 commit comments

Comments
 (0)