Skip to content

typing: Fix signature of Redis.transaction#4002

Open
stephenfin wants to merge 1 commit intoredis:masterfrom
stephenfin:typing
Open

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

Conversation

@stephenfin
Copy link

@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
Type-only API signature changes to Redis.transaction; runtime behavior is effectively unchanged aside from accepting explicit keyword parameters instead of popping them from **kwargs. Low risk unless callers relied on passing these options only via **kwargs in unusual ways.

Overview
Improves type hints for Redis.transaction so its return type is conditional on value_from_callable (returns List[Any] when false, otherwise returns the callable’s generic T) via @overload + TypeVar.

Updates the runtime signature to expose shard_hint, value_from_callable, and watch_delay as explicit keyword parameters (instead of pulling them out of **kwargs), tightening typing around watches and keyword arguments.

Written by Cursor Bugbot for commit 03d11c4. 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

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
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