Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion redis/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ def pipeline(self, transaction=True, shard_hint=None) -> "Pipeline":

def transaction(
self, func: Callable[["Pipeline"], None], *watches, **kwargs
) -> None:
) -> Optional[Union[List[Any], Any]]:
Copy link
Preview

Copilot AI May 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The return type hint Optional[Union[List[Any], Any]] can be simplified. Since Any already encompasses List[Any], consider using -> Any or -> Optional[Any]. For stronger typing, introduce a TypeVar for the callback return: e.g.

R = TypeVar('R')
def transaction(self, func: Callable[["Pipeline"], R], *watches, **kwargs) -> Optional[R]:
    ...

Copilot uses AI. Check for mistakes.

"""
Convenience method for executing the callable `func` as a transaction
while watching all keys specified in `watches`. The 'func' callable
Expand Down
Loading