Skip to content

Commit 9572ffe

Browse files
committed
fix: license bug when dataset supplies a list or None
1 parent 6cefceb commit 9572ffe

File tree

3 files changed

+22
-2
lines changed

3 files changed

+22
-2
lines changed

siibra/core/concept.py

+9-1
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,15 @@ def description(self):
101101

102102
@property
103103
def LICENSE(self) -> str:
104-
return '\n'.join([ds.LICENSE for ds in self.datasets])
104+
licenses = []
105+
for ds in self.datasets:
106+
if ds.LICENSE is None or ds.LICENSE == "No license information is found.":
107+
continue
108+
if isinstance(ds.LICENSE, str):
109+
licenses.append(ds.LICENSE)
110+
if isinstance(ds.LICENSE, list):
111+
licenses.extend(ds.LICENSE)
112+
return '\n'.join(licenses)
105113

106114
@property
107115
def doi_or_url(self) -> str:

siibra/features/feature.py

+9-1
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,15 @@ def description(self):
164164

165165
@property
166166
def LICENSE(self) -> str:
167-
return '\n'.join([ds.LICENSE for ds in self.datasets])
167+
licenses = []
168+
for ds in self.datasets:
169+
if ds.LICENSE is None or ds.LICENSE == "No license information is found.":
170+
continue
171+
if isinstance(ds.LICENSE, str):
172+
licenses.append(ds.LICENSE)
173+
if isinstance(ds.LICENSE, list):
174+
licenses.extend(ds.LICENSE)
175+
return '\n'.join(licenses)
168176

169177
@property
170178
def doi_or_url(self) -> str:

siibra/retrieval/datasets.py

+4
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@ def id(self) -> str:
5656
def name(self) -> str:
5757
raise NotImplementedError
5858

59+
@abstractproperty
60+
def LICENSE(self) -> List[str]:
61+
raise NotImplementedError
62+
5963
@abstractproperty
6064
def urls(self) -> List[EbrainsDatasetUrl]:
6165
raise NotImplementedError

0 commit comments

Comments
 (0)