diff --git a/src/frequenz/client/base/retry_strategy/_retry.py b/src/frequenz/client/base/retry_strategy.py similarity index 95% rename from src/frequenz/client/base/retry_strategy/_retry.py rename to src/frequenz/client/base/retry_strategy.py index f52c690..4eb19e0 100644 --- a/src/frequenz/client/base/retry_strategy/_retry.py +++ b/src/frequenz/client/base/retry_strategy.py @@ -10,10 +10,10 @@ from collections.abc import Iterator from copy import deepcopy -DEFAULT_RETRY_INTERVAL = 3.0 +_DEFAULT_RETRY_INTERVAL = 3.0 """Default retry interval, in seconds.""" -DEFAULT_RETRY_JITTER = 1.0 +_DEFAULT_RETRY_JITTER = 1.0 """Default retry jitter, in seconds.""" @@ -80,8 +80,8 @@ class LinearBackoff(RetryStrategy): def __init__( self, - interval: float = DEFAULT_RETRY_INTERVAL, - jitter: float = DEFAULT_RETRY_JITTER, + interval: float = _DEFAULT_RETRY_INTERVAL, + jitter: float = _DEFAULT_RETRY_JITTER, limit: int | None = None, ) -> None: """Create a `LinearBackoff` instance. @@ -116,7 +116,7 @@ def next_interval(self) -> float | None: class ExponentialBackoff(RetryStrategy): """Provides methods for calculating the exponential interval between retries.""" - DEFAULT_INTERVAL = DEFAULT_RETRY_INTERVAL + DEFAULT_INTERVAL = _DEFAULT_RETRY_INTERVAL """Default retry interval, in seconds.""" DEFAULT_MAX_INTERVAL = 60.0 @@ -131,7 +131,7 @@ def __init__( initial_interval: float = DEFAULT_INTERVAL, max_interval: float = DEFAULT_MAX_INTERVAL, multiplier: float = DEFAULT_MULTIPLIER, - jitter: float = DEFAULT_RETRY_JITTER, + jitter: float = _DEFAULT_RETRY_JITTER, limit: int | None = None, ) -> None: """Create a `ExponentialBackoff` instance. diff --git a/src/frequenz/client/base/retry_strategy/__init__.py b/src/frequenz/client/base/retry_strategy/__init__.py deleted file mode 100644 index 4f52fab..0000000 --- a/src/frequenz/client/base/retry_strategy/__init__.py +++ /dev/null @@ -1,8 +0,0 @@ -# License: MIT -# Copyright © 2023 Frequenz Energy-as-a-Service GmbH - -"""Implementations for retry strategies.""" - -from ._retry import ExponentialBackoff, LinearBackoff, RetryStrategy - -__all__ = ["RetryStrategy", "ExponentialBackoff", "LinearBackoff"]