Coverage for bioimageio/spec/application/v0_2.py: 100%

34 statements  

« prev     ^ index     » next       coverage.py v7.9.1, created at 2025-06-27 09:20 +0000

1from typing import TYPE_CHECKING, ClassVar, Literal, Optional 

2 

3from pydantic import Field 

4from typing_extensions import Annotated 

5 

6from .._internal.common_nodes import Node 

7from .._internal.types import FileSource_ as FileSource_ 

8from .._internal.url import HttpUrl as HttpUrl 

9from ..generic.v0_2 import VALID_COVER_IMAGE_EXTENSIONS as VALID_COVER_IMAGE_EXTENSIONS 

10from ..generic.v0_2 import AttachmentsDescr as AttachmentsDescr 

11from ..generic.v0_2 import Author as Author 

12from ..generic.v0_2 import BadgeDescr as BadgeDescr 

13from ..generic.v0_2 import CiteEntry as CiteEntry 

14from ..generic.v0_2 import Doi as Doi 

15from ..generic.v0_2 import GenericDescrBase 

16from ..generic.v0_2 import LinkedResource as LinkedResource 

17from ..generic.v0_2 import Maintainer as Maintainer 

18from ..generic.v0_2 import OrcidId as OrcidId 

19from ..generic.v0_2 import RelativeFilePath as RelativeFilePath 

20from ..generic.v0_2 import ResourceId as ResourceId 

21from ..generic.v0_2 import Uploader as Uploader 

22from ..generic.v0_2 import Version as Version 

23 

24 

25class ApplicationId(ResourceId): 

26 pass 

27 

28 

29class ApplicationDescr(GenericDescrBase): 

30 """Bioimage.io description of an application.""" 

31 

32 implemented_type: ClassVar[Literal["application"]] = "application" 

33 if TYPE_CHECKING: 

34 type: Literal["application"] = "application" 

35 else: 

36 type: Literal["application"] 

37 

38 id: Optional[ApplicationId] = None 

39 """bioimage.io-wide unique resource identifier 

40 assigned by bioimage.io; version **un**specific.""" 

41 

42 source: Annotated[ 

43 Optional[FileSource_], 

44 Field(description="URL or path to the source of the application"), 

45 ] = None 

46 """The primary source of the application""" 

47 

48 

49class LinkedApplication(Node): 

50 """Reference to a bioimage.io application.""" 

51 

52 id: ApplicationId 

53 """A valid application `id` from the bioimage.io collection.""" 

54 

55 version_number: Optional[int] = None 

56 """version number (n-th published version, not the semantic version) of linked application"""