Skip to content

Commit 4aa0bfa

Browse files
willfreyvladvildanov
authored andcommitted
Update ResponseT type alias (#3227)
Pyright treats explicit and implicit `Any` differently, with implicit `Any` being treated as `Unknown`. Pyright raised a warning indicating an unknown member type for 'Awaitable' when used in 'ResponseT'. Using the `incr` method as an example, the warning is: ``` "warning: Type of 'incr' is partially unknown Type of 'incr' is '(name: bytes | str | memoryview, amount: int = 1) -> (Awaitable[Unknown] | Any)' (reportUnknownMemberType)" ``` By explicitly specifying 'Awaitable[Any]' in the union for 'ResponseT', this resolves the ambiguity about the member type.
1 parent 4192550 commit 4aa0bfa

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

CHANGES

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
* Update `ResponseT` type hint
12
* Allow to control the minimum SSL version
23
* Add an optional lock_name attribute to LockError.
34
* Fix return types for `get`, `set_path` and `strappend` in JSONCommands

redis/typing.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
PatternT = _StringLikeT # Patterns matched against keys, fields etc
3434
FieldT = EncodableT # Fields within hash tables, streams and geo commands
3535
KeysT = Union[KeyT, Iterable[KeyT]]
36-
ResponseT = Union[Awaitable, Any]
36+
ResponseT = Union[Awaitable[Any], Any]
3737
ChannelT = _StringLikeT
3838
GroupT = _StringLikeT # Consumer group
3939
ConsumerT = _StringLikeT # Consumer name

0 commit comments

Comments
 (0)