Skip to content

Commit

Permalink
Add return type to close functions (#3496)
Browse files Browse the repository at this point in the history
  • Loading branch information
patrick91 authored Feb 4, 2025
1 parent ceb12fe commit c675a56
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
3 changes: 1 addition & 2 deletions redis/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,7 @@ def __exit__(self, exc_type, exc_value, traceback):
def __del__(self):
self.close()

def close(self):
def close(self) -> None:
# In case a connection property does not yet exist
# (due to a crash earlier in the Redis() constructor), return
# immediately as there is nothing to clean-up.
Expand Down Expand Up @@ -1551,7 +1551,6 @@ def _disconnect_raise_reset(
conn.retry_on_error is None
or isinstance(error, tuple(conn.retry_on_error)) is False
):

self.reset()
raise error

Expand Down
4 changes: 2 additions & 2 deletions redis/cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -1227,7 +1227,7 @@ def _execute_command(self, target_node, *args, **kwargs):

raise ClusterError("TTL exhausted.")

def close(self):
def close(self) -> None:
try:
with self._lock:
if self.nodes_manager:
Expand Down Expand Up @@ -1669,7 +1669,7 @@ def initialize(self):
# If initialize was called after a MovedError, clear it
self._moved_exception = None

def close(self):
def close(self) -> None:
self.default_node = None
for node in self.nodes_cache.values():
if node.redis_connection:
Expand Down

0 comments on commit c675a56

Please sign in to comment.