File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed
tensorflow_datasets/core/dataset_builders Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -417,12 +417,14 @@ def _get_license(self) -> str | None:
417
417
repo_id , token = self ._hf_repo_id , self ._hf_hub_token
418
418
dataset_info = huggingface_hub .dataset_info (repo_id , token = token )
419
419
# Second heuristic: check the card data.
420
- if 'license' in dataset_info .card_data :
421
- return dataset_info .card_data ['license' ]
420
+ if dataset_info .card_data :
421
+ if card_data_license := dataset_info .card_data .get ('license' ):
422
+ return card_data_license
422
423
# Third heuristic: check the tags.
423
- for tag in dataset_info .tags :
424
- if tag .startswith ('license:' ):
425
- return tag [len ('license:' ) :]
424
+ if dataset_info .tags :
425
+ for tag in dataset_info .tags :
426
+ if tag .startswith ('license:' ):
427
+ return tag .removeprefix ('license:' )
426
428
return None
427
429
428
430
You can’t perform that action at this time.
0 commit comments