Skip to content

Commit 1721325

Browse files
author
notactuallyfinn
committed
clean up
1 parent 2db93cf commit 1721325

File tree

2 files changed

+1
-15
lines changed

2 files changed

+1
-15
lines changed

src/hermes/model/api.py

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from hermes.model.types import ld_dict, ld_list
1+
from hermes.model.types import ld_dict
22

33
from hermes.model.types.ld_context import ALL_CONTEXTS
44

@@ -8,15 +8,3 @@ class SoftwareMetadata(ld_dict):
88
def __init__(self, data: dict = None, extra_vocabs: dict[str, str] = None) -> None:
99
ctx = ALL_CONTEXTS + [{**extra_vocabs}] if extra_vocabs is not None else ALL_CONTEXTS
1010
super().__init__([ld_dict.from_dict(data, context=ctx).data_dict if data else {}], context=ctx)
11-
12-
def add(self, key, value):
13-
if key not in self:
14-
self[key] = value
15-
return
16-
if isinstance(val := self[key], ld_list):
17-
val.append(value)
18-
else:
19-
temp = ld_list([{"@list": []}], parent=self, key=self.ld_proc.expand_iri(self.active_ctx, key),
20-
context=self.context)
21-
temp.extend([val, value])
22-
self[key] = temp

test/hermes_test/model/test_api.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ def test_append():
6060
data["foo"].append("c")
6161
assert data["foo"].item_list == [{"@value": "a"}, {"@value": "b"}, {"@value": "c"}]
6262
data = SoftwareMetadata()
63-
# FIXME: #433 will fix this
6463
data["foo"].append({"schema:name": "foo"})
6564
assert type(data["foo"]) is ld_list and type(data["foo"][0]) is ld_dict
6665
assert data["foo"][0].data_dict == {"http://schema.org/name": [{"@value": "foo"}]}
@@ -83,7 +82,6 @@ def test_iterative_assignment():
8382
author1["email"] = "author@example.com"
8483
authors[0] = author1
8584
authors.append({"name": "Bar", "email": "author2@example.com"})
86-
data["author"] = authors
8785
assert len(authors) == 2
8886

8987

0 commit comments

Comments
 (0)