Page Menu
Home
Software Heritage
Search
Configure Global Search
Log In
Files
F7342962
D3701.id13060.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Subscribers
None
D3701.id13060.diff
View Options
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 = []
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mar 17 2025, 6:22 PM (7 w, 3 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3223275
Attached To
D3701: storage*: content_get_range: Type remaining existing endpoints
Event Timeline
Log In to Comment