Skip to content

Commit

Permalink
chore: refactor retry to use ensure_callable
Browse files Browse the repository at this point in the history
  • Loading branch information
kennedykori committed Mar 31, 2024
1 parent 3b70509 commit 84d6129
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/sghi/retry/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@

from sghi.exceptions import SGHIError, SGHITransientError
from sghi.utils import (
ensure_callable,
ensure_greater_or_equal,
ensure_greater_than,
ensure_predicate,
type_fqn,
)

Expand Down Expand Up @@ -289,11 +289,10 @@ def __init__(
timeout: float | None = _DEFAULT_TIMEOUT,
multiplicative_factor: float = _DEFAULT_MULTIPLICATIVE_FACTOR,
) -> None:
ensure_predicate(
callable(predicate),
self._predicate: _RetryPredicate = ensure_callable(
value=predicate,
message="'predicate' MUST be a callable.",
)
self._predicate: _RetryPredicate = predicate
self._initial_delay: float = ensure_greater_than(
value=initial_delay,
base_value=0.0,
Expand Down

0 comments on commit 84d6129

Please sign in to comment.