Skip to content

Commit

Permalink
fix type annotation to expect a partial explicitly, rather than a cal…
Browse files Browse the repository at this point in the history
…lable (see python/mypy#1484)
  • Loading branch information
Benson Tucker committed Jan 8, 2018
1 parent 72a83c5 commit a98b67e
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions python/etl/errors.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import time
from typing import Callable, TypeVar

T = TypeVar("T")
from functools import partial


class ETLError(Exception):
Expand Down Expand Up @@ -223,9 +221,10 @@ class RetriesExhaustedError(ETLRuntimeError):
"""


def retry(max_retries: int, func: Callable[[], T], logger) -> T:
def retry(max_retries: int, func: partial, logger):
"""
Retry a function a maximum number of times and return its results.
The function should be a functools.partial called with no arguments.
Sleeps for 5 ^ attempt_number seconds if there are remaining retry attempts.
The given func function is only retried if it throws a TransientETLError. Any other error is considered
Expand Down

0 comments on commit a98b67e

Please sign in to comment.