Skip to content

Commit d91110a

Browse files
committed
formatted with black
1 parent d7d5afa commit d91110a

3 files changed

Lines changed: 15 additions & 25 deletions

File tree

pipeline/src/collection.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,8 @@ def _get_blank_node_identifier(self):
6363
return fmt.format(identifier=identifier)
6464

6565
def _sort_nodes_by_id(self):
66-
sorted_nodes=dict(sorted(self.nodes.items()))
67-
self.nodes=sorted_nodes
68-
66+
sorted_nodes = dict(sorted(self.nodes.items()))
67+
self.nodes = sorted_nodes
6968

7069
def save(self, path, individual_files=False, include_empty_properties=False):
7170
"""

pipeline/src/properties.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@ def deserialize(self, data):
163163
Args:
164164
data: the JSON-LD data
165165
"""
166+
166167
# todo: check data type
167168
def deserialize_item(item):
168169
if self.types == (str,):

pipeline/tests/test_collections.py

Lines changed: 12 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -82,53 +82,43 @@ def test_collection_sort_by_id():
8282
uni1 = omcore.Organization(full_name="University of This Place", id="_:002")
8383
uni2 = omcore.Organization(full_name="University of That Place", id="_:001")
8484
person.affiliations = [
85-
omcore.Affiliation(member_of = uni1),
86-
omcore.Affiliation(member_of = uni2),
85+
omcore.Affiliation(member_of=uni1),
86+
omcore.Affiliation(member_of=uni2),
8787
]
8888

89-
c = Collection(person,uni1,uni2)
89+
c = Collection(person, uni1, uni2)
9090
output_paths = c.save("test_collection_sort_by_id.jsonld", individual_files=False, include_empty_properties=False)
91-
91+
9292
assert output_paths == ["test_collection_sort_by_id.jsonld"]
9393

9494
with open(output_paths[0]) as fp:
9595
saved_data = json.load(fp)
9696
os.remove("test_collection_sort_by_id.jsonld")
9797

98-
expected_saved_data={
98+
expected_saved_data = {
9999
"@context": {"@vocab": "https://openminds.om-i.org/props/"},
100100
"@graph": [
101101
{
102102
"@id": "_:001",
103103
"@type": "https://openminds.om-i.org/types/Organization",
104-
"fullName": "University of That Place"
104+
"fullName": "University of That Place",
105105
},
106106
{
107107
"@id": "_:002",
108108
"@type": "https://openminds.om-i.org/types/Organization",
109-
"fullName": "University of This Place"
109+
"fullName": "University of This Place",
110110
},
111111
{
112112
"@id": "_:004",
113113
"@type": "https://openminds.om-i.org/types/Person",
114114
"affiliation": [
115-
{
116-
"@type": "https://openminds.om-i.org/types/Affiliation",
117-
"memberOf": {
118-
"@id": "_:002"
119-
}
120-
},
121-
{
122-
"@type": "https://openminds.om-i.org/types/Affiliation",
123-
"memberOf": {
124-
"@id": "_:001"
125-
}
126-
}
115+
{"@type": "https://openminds.om-i.org/types/Affiliation", "memberOf": {"@id": "_:002"}},
116+
{"@type": "https://openminds.om-i.org/types/Affiliation", "memberOf": {"@id": "_:001"}},
127117
],
128118
"familyName": "Professor",
129-
"givenName": "A"
130-
}
131-
]
119+
"givenName": "A",
120+
},
121+
],
132122
}
133123

134124
assert saved_data == expected_saved_data

0 commit comments

Comments
 (0)