Skip to content
This repository was archived by the owner on Aug 8, 2025. It is now read-only.

Commit c810d70

Browse files
authored
Improve type annotation for backoff.expo
`backoff.expo` accepts floats. Most usage in our codebase has a floating point `factor`. If we want to preserve exact inference in cases where the return type is `Generator[int, Any, None` we could use an overload (TypeVar could work, but would be a little worse for cases involving defaults).
1 parent 24ae1b9 commit c810d70

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

backoff/_wait_gen.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55

66

77
def expo(
8-
base: int = 2,
9-
factor: int = 1,
10-
max_value: Optional[int] = None
11-
) -> Generator[int, Any, None]:
8+
base: float = 2,
9+
factor: float = 1,
10+
max_value: Optional[float] = None
11+
) -> Generator[float, Any, None]:
1212

1313
"""Generator for exponential decay.
1414

0 commit comments

Comments
 (0)