Skip to content

Commit 4967c8b

Browse files
authored
redis: fix more unconstrained TypeVars (#8084)
1 parent 5fa31e6 commit 4967c8b

File tree

1 file changed

+87
-11
lines changed

1 file changed

+87
-11
lines changed

stubs/redis/redis/commands/core.pyi

Lines changed: 87 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -904,7 +904,7 @@ class SortedSetCommands(Generic[_StrType]):
904904
end: int,
905905
desc: bool,
906906
withscores: Literal[True],
907-
score_cast_func: Callable[[_StrType], _ScoreCastFuncReturn] = ...,
907+
score_cast_func: Callable[[_StrType], _ScoreCastFuncReturn],
908908
byscore: bool = ...,
909909
bylex: bool = ...,
910910
offset: int | None = ...,
@@ -916,16 +916,43 @@ class SortedSetCommands(Generic[_StrType]):
916916
name: _Key,
917917
start: int,
918918
end: int,
919-
desc: bool = ...,
919+
desc: bool,
920+
withscores: Literal[True],
921+
score_cast_func: Callable[[_StrType], float] = ...,
922+
byscore: bool = ...,
923+
bylex: bool = ...,
924+
offset: int | None = ...,
925+
num: int | None = ...,
926+
) -> list[tuple[_StrType, float]]: ...
927+
@overload
928+
def zrange(
929+
self,
930+
name: _Key,
931+
start: int,
932+
end: int,
920933
*,
921934
withscores: Literal[True],
922-
score_cast_func: Callable[[_StrType], _ScoreCastFuncReturn] = ...,
935+
score_cast_func: Callable[[_StrType], _ScoreCastFuncReturn],
923936
byscore: bool = ...,
924937
bylex: bool = ...,
925938
offset: int | None = ...,
926939
num: int | None = ...,
927940
) -> list[tuple[_StrType, _ScoreCastFuncReturn]]: ...
928941
@overload
942+
def zrange(
943+
self,
944+
name: _Key,
945+
start: int,
946+
end: int,
947+
*,
948+
withscores: Literal[True],
949+
score_cast_func: Callable[[_StrType], float] = ...,
950+
byscore: bool = ...,
951+
bylex: bool = ...,
952+
offset: int | None = ...,
953+
num: int | None = ...,
954+
) -> list[tuple[_StrType, float]]: ...
955+
@overload
929956
def zrange(
930957
self,
931958
name: _Key,
@@ -946,9 +973,11 @@ class SortedSetCommands(Generic[_StrType]):
946973
start: int,
947974
end: int,
948975
withscores: Literal[True],
949-
score_cast_func: Callable[[_StrType], _ScoreCastFuncReturn] = ...,
976+
score_cast_func: Callable[[_StrType], _ScoreCastFuncReturn],
950977
) -> list[tuple[_StrType, _ScoreCastFuncReturn]]: ...
951978
@overload
979+
def zrevrange(self, name: _Key, start: int, end: int, withscores: Literal[True]) -> list[tuple[_StrType, float]]: ...
980+
@overload
952981
def zrevrange(
953982
self, name: _Key, start: int, end: int, withscores: bool = ..., score_cast_func: Callable[[Any], Any] = ...
954983
) -> list[_StrType]: ...
@@ -980,9 +1009,13 @@ class SortedSetCommands(Generic[_StrType]):
9801009
num: int | None = ...,
9811010
*,
9821011
withscores: Literal[True],
983-
score_cast_func: Callable[[_StrType], _ScoreCastFuncReturn] = ...,
1012+
score_cast_func: Callable[[_StrType], _ScoreCastFuncReturn],
9841013
) -> list[tuple[_StrType, _ScoreCastFuncReturn]]: ...
9851014
@overload
1015+
def zrangebyscore(
1016+
self, name: _Key, min: _Value, max: _Value, start: int | None = ..., num: int | None = ..., *, withscores: Literal[True]
1017+
) -> list[tuple[_StrType, float]]: ...
1018+
@overload
9861019
def zrangebyscore(
9871020
self,
9881021
name: _Key,
@@ -1003,9 +1036,13 @@ class SortedSetCommands(Generic[_StrType]):
10031036
num: int | None = ...,
10041037
*,
10051038
withscores: Literal[True],
1006-
score_cast_func: Callable[[_StrType], _ScoreCastFuncReturn] = ...,
1039+
score_cast_func: Callable[[_StrType], _ScoreCastFuncReturn],
10071040
) -> list[tuple[_StrType, _ScoreCastFuncReturn]]: ...
10081041
@overload
1042+
def zrevrangebyscore(
1043+
self, name: _Key, max: _Value, min: _Value, start: int | None = ..., num: int | None = ..., *, withscores: Literal[True]
1044+
) -> list[tuple[_StrType, float]]: ...
1045+
@overload
10091046
def zrevrangebyscore(
10101047
self,
10111048
name: _Key,
@@ -1068,13 +1105,27 @@ class AsyncSortedSetCommands(Generic[_StrType]):
10681105
end: int,
10691106
desc: bool,
10701107
withscores: Literal[True],
1071-
score_cast_func: Callable[[_StrType], _ScoreCastFuncReturn] = ...,
1108+
score_cast_func: Callable[[_StrType], _ScoreCastFuncReturn],
10721109
byscore: bool = ...,
10731110
bylex: bool = ...,
10741111
offset: int | None = ...,
10751112
num: int | None = ...,
10761113
) -> list[tuple[_StrType, _ScoreCastFuncReturn]]: ...
10771114
@overload
1115+
async def zrange(
1116+
self,
1117+
name: _Key,
1118+
start: int,
1119+
end: int,
1120+
desc: bool,
1121+
withscores: Literal[True],
1122+
score_cast_func: Callable[[_StrType], float] = ...,
1123+
byscore: bool = ...,
1124+
bylex: bool = ...,
1125+
offset: int | None = ...,
1126+
num: int | None = ...,
1127+
) -> list[tuple[_StrType, float]]: ...
1128+
@overload
10781129
async def zrange(
10791130
self,
10801131
name: _Key,
@@ -1083,13 +1134,28 @@ class AsyncSortedSetCommands(Generic[_StrType]):
10831134
desc: bool = ...,
10841135
*,
10851136
withscores: Literal[True],
1086-
score_cast_func: Callable[[_StrType], _ScoreCastFuncReturn] = ...,
1137+
score_cast_func: Callable[[_StrType], _ScoreCastFuncReturn],
10871138
byscore: bool = ...,
10881139
bylex: bool = ...,
10891140
offset: int | None = ...,
10901141
num: int | None = ...,
10911142
) -> list[tuple[_StrType, _ScoreCastFuncReturn]]: ...
10921143
@overload
1144+
async def zrange(
1145+
self,
1146+
name: _Key,
1147+
start: int,
1148+
end: int,
1149+
desc: bool = ...,
1150+
*,
1151+
withscores: Literal[True],
1152+
score_cast_func: Callable[[_StrType], float] = ...,
1153+
byscore: bool = ...,
1154+
bylex: bool = ...,
1155+
offset: int | None = ...,
1156+
num: int | None = ...,
1157+
) -> list[tuple[_StrType, float]]: ...
1158+
@overload
10931159
async def zrange(
10941160
self,
10951161
name: _Key,
@@ -1110,9 +1176,11 @@ class AsyncSortedSetCommands(Generic[_StrType]):
11101176
start: int,
11111177
end: int,
11121178
withscores: Literal[True],
1113-
score_cast_func: Callable[[_StrType], _ScoreCastFuncReturn] = ...,
1179+
score_cast_func: Callable[[_StrType], _ScoreCastFuncReturn],
11141180
) -> list[tuple[_StrType, _ScoreCastFuncReturn]]: ...
11151181
@overload
1182+
async def zrevrange(self, name: _Key, start: int, end: int, withscores: Literal[True]) -> list[tuple[_StrType, float]]: ...
1183+
@overload
11161184
async def zrevrange(
11171185
self, name: _Key, start: int, end: int, withscores: bool = ..., score_cast_func: Callable[[Any], Any] = ...
11181186
) -> list[_StrType]: ...
@@ -1144,9 +1212,13 @@ class AsyncSortedSetCommands(Generic[_StrType]):
11441212
num: int | None = ...,
11451213
*,
11461214
withscores: Literal[True],
1147-
score_cast_func: Callable[[_StrType], _ScoreCastFuncReturn] = ...,
1215+
score_cast_func: Callable[[_StrType], _ScoreCastFuncReturn],
11481216
) -> list[tuple[_StrType, _ScoreCastFuncReturn]]: ...
11491217
@overload
1218+
async def zrangebyscore(
1219+
self, name: _Key, min: _Value, max: _Value, start: int | None = ..., num: int | None = ..., *, withscores: Literal[True]
1220+
) -> list[tuple[_StrType, float]]: ...
1221+
@overload
11501222
async def zrangebyscore(
11511223
self,
11521224
name: _Key,
@@ -1167,9 +1239,13 @@ class AsyncSortedSetCommands(Generic[_StrType]):
11671239
num: int | None = ...,
11681240
*,
11691241
withscores: Literal[True],
1170-
score_cast_func: Callable[[_StrType], _ScoreCastFuncReturn] = ...,
1242+
score_cast_func: Callable[[_StrType], _ScoreCastFuncReturn],
11711243
) -> list[tuple[_StrType, _ScoreCastFuncReturn]]: ...
11721244
@overload
1245+
async def zrevrangebyscore(
1246+
self, name: _Key, max: _Value, min: _Value, start: int | None = ..., num: int | None = ..., *, withscores: Literal[True]
1247+
) -> list[tuple[_StrType, float]]: ...
1248+
@overload
11731249
async def zrevrangebyscore(
11741250
self,
11751251
name: _Key,

0 commit comments

Comments
 (0)