Coverage for bioimageio/spec/utils.py: 100%
21 statements
« prev ^ index » next coverage.py v7.8.0, created at 2025-04-02 14:21 +0000
« prev ^ index » next coverage.py v7.8.0, created at 2025-04-02 14:21 +0000
1import json
2from typing import List, TypedDict
4from ._description import ensure_description_is_dataset, ensure_description_is_model
5from ._internal.io import (
6 download,
7 extract_file_name,
8 get_sha256,
9 identify_bioimageio_yaml_file_name,
10 is_valid_bioimageio_yaml_name,
11)
12from ._internal.io_utils import load_array, save_array, write_yaml
13from ._internal.utils import files
15__all__ = [
16 "download",
17 "ensure_description_is_dataset",
18 "ensure_description_is_model",
19 "extract_file_name",
20 "get_sha256",
21 "get_spdx_licenses",
22 "identify_bioimageio_yaml_file_name",
23 "is_valid_bioimageio_yaml_name",
24 "load_array",
25 "save_array",
26 "SpdxLicenseEntry",
27 "SpdxLicenses",
28 "write_yaml",
29]
32class SpdxLicenseEntry(TypedDict):
33 isDeprecatedLicenseId: bool
34 isKnownByZenodo: bool
35 isOsiApproved: bool
36 licenseId: str
37 name: str
38 reference: str
41class SpdxLicenses(TypedDict):
42 licenseListVersion: str
43 licenses: List[SpdxLicenseEntry]
44 releaseDate: str
47def get_spdx_licenses() -> SpdxLicenses:
48 """get details of the SPDX licenses known to bioimageio.spec"""
49 with files("bioimageio.spec").joinpath("static/spdx_licenses.json").open(
50 "r", encoding="utf-8"
51 ) as f:
52 return json.load(f)