fix: improve Lock.extend() and Lock.do_extend() return type to Literal[True] #3799
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
Description
Fixes #3792
This PR improves the type safety of and methods by changing their return type from to .
Problem
Currently, both methods are typed as returning , but in practice they only return or raise a exception. This can lead to developer confusion, as developers might write code like:
Solution
Changed return types to to clearly communicate that:
Changes
Sync version (
redis/lock.py):extend():bool→Literal[True]do_extend():bool→Literal[True]Async version (
redis/asyncio/lock.py):extend():Awaitable[bool]→Awaitable[Literal[True]]do_extend():bool→Literal[True]Testing
Benefits
Sacred Code: 000.111.369.963.1618