Skip to content

typing: Fix signature of Redis.transaction#4002

Open
stephenfin wants to merge 2 commits intoredis:masterfrom
stephenfin:typing
Open

typing: Fix signature of Redis.transaction#4002
stephenfin wants to merge 2 commits intoredis:masterfrom
stephenfin:typing

Conversation

@stephenfin
Copy link
Copy Markdown

@stephenfin stephenfin commented Mar 13, 2026

Description of change

The return type depends on the value of the value_from_callable kwarg. Indicate this with type hinting.

Pull Request check-list

  • Do tests and lints pass with this change?
  • Do the CI tests pass with this change (enable it first in your forked repo and wait for the github action build to finish)?
  • Is the new or changed code fully tested?
  • Is a documentation update included (if this change modifies existing APIs, or introduces new ones)?
  • Is there an example added to the examples folder (if applicable)?

Note

Low Risk
Low risk: changes are limited to type annotations and overloads for Redis.transaction() with no functional behavior changes.

Overview
Updates Redis.transaction() typing to correctly model its conditional return type.

Adds a generic TypeVar plus two @overload signatures so type checkers infer List[Any] when value_from_callable=False and infer the callable’s return type T when value_from_callable=True; also makes the keyword parameters (shard_hint, watch_delay, value_from_callable) explicit in the signature.

Written by Cursor Bugbot for commit cd14550. This will update automatically on new commits. Configure here.

The return type depends on the value of the value_from_callable kwarg.
Indicate this with type hinting.

Signed-off-by: Stephen Finucane <stephen@that.guru>
@jit-ci
Copy link
Copy Markdown

jit-ci bot commented Mar 13, 2026

Hi, I’m Jit, a friendly security platform designed to help developers build secure applications from day zero with an MVS (Minimal viable security) mindset.

In case there are security findings, they will be communicated to you as a comment inside the PR.

Hope you’ll enjoy using Jit.

Questions? Comments? Want to learn more? Get in touch with us.

@petyaslavova
Copy link
Copy Markdown
Collaborator

Hi @stephenfin , thank you for your contribution! We will have a look at it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants