Page Menu
Home
Software Heritage
Search
Configure Global Search
Log In
Files
F7066196
D3328.id11814.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Subscribers
None
D3328.id11814.diff
View Options
diff --git a/mypy.ini b/mypy.ini
--- a/mypy.ini
+++ b/mypy.ini
@@ -17,6 +17,9 @@
[mypy-confluent_kafka.*]
ignore_missing_imports = True
+[mypy-deprecated.*]
+ignore_missing_imports = True
+
# only shipped indirectly via hypothesis
[mypy-django.*]
ignore_missing_imports = True
diff --git a/requirements.txt b/requirements.txt
--- a/requirements.txt
+++ b/requirements.txt
@@ -5,3 +5,4 @@
aiohttp
tenacity
cassandra-driver >= 3.19.0, != 3.21.0
+deprecated
diff --git a/swh/storage/cassandra/storage.py b/swh/storage/cassandra/storage.py
--- a/swh/storage/cassandra/storage.py
+++ b/swh/storage/cassandra/storage.py
@@ -11,6 +11,7 @@
from typing import Any, Dict, List, Iterable, Optional
import attr
+from deprecated import deprecated
from swh.core.api.serializers import msgpack_loads, msgpack_dumps
from swh.model.model import (
@@ -775,6 +776,7 @@
self.origin_add_one(origin)
return {"origin:add": len(to_add)}
+ @deprecated("Use origin_add([origin]) instead")
def origin_add_one(self, origin: Origin) -> str:
known_origin = self.origin_get_one(origin.to_dict())
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
@@ -29,6 +29,8 @@
import attr
+from deprecated import deprecated
+
from swh.core.api.serializers import msgpack_loads, msgpack_dumps
from swh.model.model import (
BaseContent,
@@ -763,6 +765,7 @@
return {"origin:add": added}
+ @deprecated("Use origin_add([origin]) instead")
def origin_add_one(self, origin: Origin) -> str:
if origin.url not in self._origins:
self.journal_writer.origin_add([origin])
diff --git a/swh/storage/interface.py b/swh/storage/interface.py
--- a/swh/storage/interface.py
+++ b/swh/storage/interface.py
@@ -1065,6 +1065,7 @@
"""
...
+ @deprecated
@remote_api_endpoint("origin/add")
def origin_add_one(self, origin: Origin) -> str:
"""Add origin to the storage
diff --git a/swh/storage/storage.py b/swh/storage/storage.py
--- a/swh/storage/storage.py
+++ b/swh/storage/storage.py
@@ -9,6 +9,7 @@
from collections import defaultdict
from contextlib import contextmanager
+from deprecated import deprecated
from typing import Any, Dict, Iterable, List, Optional
import attr
@@ -1108,6 +1109,7 @@
added += 1
return {"origin:add": added}
+ @deprecated("Use origin_add([origin]) instead")
@timed
@db_transaction()
def origin_add_one(self, origin: Origin, db=None, cur=None) -> str:
diff --git a/swh/storage/validate.py b/swh/storage/validate.py
--- a/swh/storage/validate.py
+++ b/swh/storage/validate.py
@@ -6,6 +6,8 @@
import contextlib
from typing import Dict, Iterable, Iterator, Optional, Tuple, Type, TypeVar, Union
+from deprecated import deprecated
+
from swh.model.model import (
SkippedContent,
Content,
@@ -141,6 +143,7 @@
def origin_add(self, origins: Iterable[Union[Dict, Origin]]) -> Dict[str, int]:
return self.storage.origin_add([dict_converter(Origin, o) for o in origins])
+ @deprecated("Use origin_add([origin]) instead")
def origin_add_one(self, origin: Union[Dict, Origin]) -> int:
return self.storage.origin_add_one(dict_converter(Origin, origin))
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Nov 5 2024, 12:32 AM (11 w, 17 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3219915
Attached To
D3328: Deprecate the origin_add_one() endpoint
Event Timeline
Log In to Comment