Skip to content

Commit

Permalink
maint: LICENSE property
Browse files Browse the repository at this point in the history
  • Loading branch information
AhmetNSimsek committed Oct 16, 2024
1 parent a2e4155 commit 44139cc
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 12 deletions.
19 changes: 13 additions & 6 deletions siibra/core/concept.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,12 +118,19 @@ def description(self):

@property
def LICENSE(self) -> str:
licenses = {ds.LICENSE for ds in self.datasets if ds.LICENSE}
if not licenses:
return "No license information is found."
if len(licenses) == 1:
return next(iter(licenses))
logger.info("Found multiple licenses corresponding to datasets.")
licenses = []
for ds in self.datasets:
if ds.LICENSE is None or ds.LICENSE == "No license information is found.":
continue
if isinstance(ds.LICENSE, str):
licenses.append(ds.LICENSE)
if isinstance(ds.LICENSE, list):
licenses.extend(ds.LICENSE)
if len(licenses) == 0:
logger.warning("No license information is found.")
return ""
if len(licenses) > 1:
logger.info("Found multiple licenses corresponding to datasets.")
return '\n'.join(licenses)

@property
Expand Down
19 changes: 13 additions & 6 deletions siibra/features/feature.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,12 +172,19 @@ def description(self):

@property
def LICENSE(self) -> str:
licenses = {ds.LICENSE for ds in self.datasets if ds.LICENSE}
if not licenses:
return "No license information is found."
if len(licenses) == 1:
return next(iter(licenses))
logger.info("Found multiple licenses corresponding to datasets.")
licenses = []
for ds in self.datasets:
if ds.LICENSE is None or ds.LICENSE == "No license information is found.":
continue
if isinstance(ds.LICENSE, str):
licenses.append(ds.LICENSE)
if isinstance(ds.LICENSE, list):
licenses.extend(ds.LICENSE)
if len(licenses) == 0:
logger.warning("No license information is found.")
return ""
if len(licenses) > 1:
logger.info("Found multiple licenses corresponding to datasets.")
return '\n'.join(licenses)

@property
Expand Down

0 comments on commit 44139cc

Please sign in to comment.