diff --git a/swh/storage/in_memory.py b/swh/storage/in_memory.py --- a/swh/storage/in_memory.py +++ b/swh/storage/in_memory.py @@ -263,7 +263,9 @@ ) yield from self.objstorage.content_get(contents) - def content_get_range(self, start, end, limit=1000): + def content_get_range( + self, start: bytes, end: bytes, limit: int = 1000 + ) -> Dict[str, Any]: if limit is None: raise StorageArgumentException("limit should not be None") sha1s = ( @@ -271,7 +273,7 @@ for sha1 in self._sorted_sha1s.iter_from(start) for content_key in self._content_indexes["sha1"][sha1] ) - matched = [] + matched: List[Dict[str, Any]] = [] next_content = None for sha1, key in sha1s: if sha1 > end: diff --git a/swh/storage/interface.py b/swh/storage/interface.py --- a/swh/storage/interface.py +++ b/swh/storage/interface.py @@ -177,7 +177,9 @@ @deprecated @remote_api_endpoint("content/range") - def content_get_range(self, start, end, limit=1000): + def content_get_range( + self, start: bytes, end: bytes, limit: int = 1000 + ) -> Dict[str, Any]: """Retrieve contents within range [start, end] bound by limit. Note that this function may return more than one blob per hash. The @@ -185,11 +187,11 @@ will count twice toward the limit). Args: - **start** (bytes): Starting identifier range (expected smaller + **start**: Starting identifier range (expected smaller than end) - **end** (bytes): Ending identifier range (expected larger + **end**: Ending identifier range (expected larger than start) - **limit** (int): Limit result (default to 1000) + **limit**: Limit result (default to 1000) Returns: a dict with keys: diff --git a/swh/storage/storage.py b/swh/storage/storage.py --- a/swh/storage/storage.py +++ b/swh/storage/storage.py @@ -278,7 +278,9 @@ @timed @db_transaction() - def content_get_range(self, start, end, limit=1000, db=None, cur=None): + def content_get_range( + self, start: bytes, end: bytes, limit: int = 1000, db=None, cur=None + ) -> Dict[str, Any]: if limit is None: raise StorageArgumentException("limit should not be None") contents = []