-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Change 'zrange' args type hints - adding Optional type hint for args that can be None #3610
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
base: master
Are you sure you want to change the base?
Conversation
Replace all occurrences of Union[T, None] = None and bare T = None with Optional[T] = None in zrange, _zrange, arrtrim, and other methods so that type checkers no longer report errors.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You have several places where Union[int, None] is replaced with Optional[None]. Please check them and change to Optional[int]
…ations and correct arrtrim return type body: replaced all Union[T, None] = None and bare T = None with Optional[T] = None; changed arrtrim return annotation to Optional[int]
fingers crossed this one gets merged after the latest update |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just one more changes and it is done :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a comment for one of the test failures I saw, can you please also check the linters - there are some formatting errors as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR updates type annotations for various Redis command methods to use Optional types instead of Union[..., None] or plain defaults where applicable.
- Updates type hints in JSON command methods in redis/commands/json/commands.py
- Updates type hints in core Redis commands in redis/commands/core.py
- Documents the change in the CHANGES file
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
redis/commands/json/commands.py | Updated return type annotations for methods in JSON commands |
redis/commands/core.py | Changed method signatures to utilize Optional for nullable parameters |
CHANGES | Updated changelog to reflect the changes in type annotations |
Title:
fix(redis-client): change
zrange
num parameter type toOptional[int]
Pull Request check‑list
Description of change
This PR adjusts the signature of the
zrange
method inredis/commands/core.py
, changing thenum
parameter from a plainint = None
toOptional[int] = None
.