bioimageio.spec.dataset.v0_2

 1from typing import TYPE_CHECKING, ClassVar, Literal, Optional
 2
 3from .._internal.common_nodes import Node
 4from .._internal.url import HttpUrl as HttpUrl
 5from ..generic.v0_2 import VALID_COVER_IMAGE_EXTENSIONS as VALID_COVER_IMAGE_EXTENSIONS
 6from ..generic.v0_2 import AttachmentsDescr as AttachmentsDescr
 7from ..generic.v0_2 import Author as Author
 8from ..generic.v0_2 import BadgeDescr as BadgeDescr
 9from ..generic.v0_2 import CiteEntry as CiteEntry
10from ..generic.v0_2 import Doi as Doi
11from ..generic.v0_2 import GenericDescrBase, ResourceId
12from ..generic.v0_2 import LinkedResource as LinkedResource
13from ..generic.v0_2 import Maintainer as Maintainer
14from ..generic.v0_2 import OrcidId as OrcidId
15from ..generic.v0_2 import RelativeFilePath as RelativeFilePath
16from ..generic.v0_2 import Uploader as Uploader
17from ..generic.v0_2 import Version as Version
18
19
20class DatasetId(ResourceId):
21    pass
22
23
24class DatasetDescr(GenericDescrBase):
25    """A bioimage.io dataset resource description file (dataset RDF) describes a dataset relevant to bioimage
26    processing.
27    """
28
29    implemented_type: ClassVar[Literal["dataset"]] = "dataset"
30    if TYPE_CHECKING:
31        type: Literal["dataset"] = "dataset"
32    else:
33        type: Literal["dataset"]
34
35    id: Optional[DatasetId] = None
36    """bioimage.io-wide unique resource identifier
37    assigned by bioimage.io; version **un**specific."""
38
39    source: Optional[HttpUrl] = None
40    """"URL to the source of the dataset."""
41
42
43class LinkedDataset(Node):
44    """Reference to a bioimage.io dataset."""
45
46    id: DatasetId
47    """A valid dataset `id` from the bioimage.io collection."""
48
49    version_number: Optional[int] = None
50    """version number (n-th published version, not the semantic version) of linked dataset"""
class DatasetId(bioimageio.spec.generic.v0_2.ResourceId):
21class DatasetId(ResourceId):
22    pass

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.__str__() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.

class DatasetDescr(bioimageio.spec.generic.v0_2.GenericDescrBase):
25class DatasetDescr(GenericDescrBase):
26    """A bioimage.io dataset resource description file (dataset RDF) describes a dataset relevant to bioimage
27    processing.
28    """
29
30    implemented_type: ClassVar[Literal["dataset"]] = "dataset"
31    if TYPE_CHECKING:
32        type: Literal["dataset"] = "dataset"
33    else:
34        type: Literal["dataset"]
35
36    id: Optional[DatasetId] = None
37    """bioimage.io-wide unique resource identifier
38    assigned by bioimage.io; version **un**specific."""
39
40    source: Optional[HttpUrl] = None
41    """"URL to the source of the dataset."""

A bioimage.io dataset resource description file (dataset RDF) describes a dataset relevant to bioimage processing.

implemented_type: ClassVar[Literal['dataset']] = 'dataset'
id: Optional[DatasetId]

bioimage.io-wide unique resource identifier assigned by bioimage.io; version unspecific.

"URL to the source of the dataset.

implemented_format_version_tuple: ClassVar[Tuple[int, int, int]] = (0, 2, 4)
model_config: ClassVar[pydantic.config.ConfigDict] = {'extra': 'forbid', 'frozen': False, 'populate_by_name': True, 'revalidate_instances': 'never', 'validate_assignment': True, 'validate_default': False, 'validate_return': True, 'use_attribute_docstrings': True, 'model_title_generator': <function _node_title_generator>, 'validate_by_alias': True, 'validate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

def model_post_init(self: pydantic.main.BaseModel, context: Any, /) -> None:
337def init_private_attributes(self: BaseModel, context: Any, /) -> None:
338    """This function is meant to behave like a BaseModel method to initialise private attributes.
339
340    It takes context as an argument since that's what pydantic-core passes when calling it.
341
342    Args:
343        self: The BaseModel instance.
344        context: The context.
345    """
346    if getattr(self, '__pydantic_private__', None) is None:
347        pydantic_private = {}
348        for name, private_attr in self.__private_attributes__.items():
349            default = private_attr.get_default()
350            if default is not PydanticUndefined:
351                pydantic_private[name] = default
352        object_setattr(self, '__pydantic_private__', pydantic_private)

This function is meant to behave like a BaseModel method to initialise private attributes.

It takes context as an argument since that's what pydantic-core passes when calling it.

Arguments:
  • self: The BaseModel instance.
  • context: The context.
class LinkedDataset(bioimageio.spec._internal.node.Node):
44class LinkedDataset(Node):
45    """Reference to a bioimage.io dataset."""
46
47    id: DatasetId
48    """A valid dataset `id` from the bioimage.io collection."""
49
50    version_number: Optional[int] = None
51    """version number (n-th published version, not the semantic version) of linked dataset"""

Reference to a bioimage.io dataset.

id: DatasetId

A valid dataset id from the bioimage.io collection.

version_number: Optional[int]

version number (n-th published version, not the semantic version) of linked dataset

model_config: ClassVar[pydantic.config.ConfigDict] = {'extra': 'forbid', 'frozen': False, 'populate_by_name': True, 'revalidate_instances': 'never', 'validate_assignment': True, 'validate_default': False, 'validate_return': True, 'use_attribute_docstrings': True, 'model_title_generator': <function _node_title_generator>, 'validate_by_alias': True, 'validate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].