Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
6 changes: 3 additions & 3 deletions retryhttp/_retry.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Any, Callable, Optional, Sequence, Tuple, Type, Union
from typing import Any, Optional, Sequence, Tuple, Type, Union

from tenacity import (
RetryCallState,
Expand All @@ -25,7 +25,7 @@


def retry(
func: Optional[Callable] = None,
func: Optional[F] = None,
*,
max_attempt_number: int = 3,
retry_server_errors: bool = True,
Expand All @@ -42,7 +42,7 @@ def retry(
] = None,
timeouts: Union[Type[BaseException], Tuple[Type[BaseException], ...], None] = None,
**kwargs: Any,
) -> Any:
) -> F:
"""Retry potentially transient HTTP errors with sensible default behavior.

By default, retries the following errors, for a total of 3 attempts, with
Expand Down
18 changes: 9 additions & 9 deletions retryhttp/_utils.py
Copy link
Contributor Author

@gyandeeps-hh gyandeeps-hh Feb 4, 2025

Choose a reason for hiding this comment

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

ruff format changes in this file only

Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
pass


def get_default_network_errors() -> (
Tuple[Union[Type[httpx.NetworkError], Type[requests.ConnectionError]], ...]
):
def get_default_network_errors() -> Tuple[
Union[Type[httpx.NetworkError], Type[requests.ConnectionError]], ...
]:
"""Get all network errors to use by default.

Args:
Expand Down Expand Up @@ -56,9 +56,9 @@ def get_default_network_errors() -> (
return tuple(exceptions)


def get_default_timeouts() -> (
Tuple[Type[Union[httpx.TimeoutException, requests.Timeout]], ...]
):
def get_default_timeouts() -> Tuple[
Type[Union[httpx.TimeoutException, requests.Timeout]], ...
]:
"""Get all timeout exceptions to use by default.

Returns:
Expand All @@ -73,9 +73,9 @@ def get_default_timeouts() -> (
return tuple(exceptions)


def get_default_http_status_exceptions() -> (
Tuple[Union[Type[httpx.HTTPStatusError], Type[requests.HTTPError]], ...]
):
def get_default_http_status_exceptions() -> Tuple[
Union[Type[httpx.HTTPStatusError], Type[requests.HTTPError]], ...
]:
"""Get default HTTP status 4xx or 5xx exceptions.

Returns:
Expand Down