diff --git a/swh/storage/backfill.py b/swh/storage/backfill.py --- a/swh/storage/backfill.py +++ b/swh/storage/backfill.py @@ -16,7 +16,7 @@ """ import logging -from typing import Any, Callable, Dict, Optional +from typing import Any, Callable, Dict, Iterable, Optional, Tuple, TypeVar from swh.core.db import BaseDb from swh.model.model import ( @@ -446,7 +446,11 @@ yield start, start + block_size -RANGE_GENERATORS = { +T = TypeVar("T", bytes, int) + +RANGE_GENERATORS: Dict[ + str, Callable[[T, T], Iterable[Tuple[Optional[T], Optional[T]]]] +] = { "content": lambda start, end: byte_ranges(24, start, end), "skipped_content": lambda start, end: [(None, None)], "directory": lambda start, end: byte_ranges(24, start, end),