bioimageio.spec.generic
implementaions of all released minor versions are available in submodules:
- generic v0_2:
bioimageio.spec.generic.v0_2.GenericDescr
- generic v0_3:
bioimageio.spec.generic.v0_3.GenericDescr
1# autogen: start 2""" 3implementaions of all released minor versions are available in submodules: 4- generic v0_2: `bioimageio.spec.generic.v0_2.GenericDescr` 5- generic v0_3: `bioimageio.spec.generic.v0_3.GenericDescr` 6""" 7 8from typing import Union 9 10from pydantic import Discriminator, Field 11from typing_extensions import Annotated 12 13from . import v0_2, v0_3 14 15GenericDescr = v0_3.GenericDescr 16GenericDescr_v0_2 = v0_2.GenericDescr 17GenericDescr_v0_3 = v0_3.GenericDescr 18 19AnyGenericDescr = Annotated[ 20 Union[ 21 Annotated[GenericDescr_v0_2, Field(title="generic 0.2")], 22 Annotated[GenericDescr_v0_3, Field(title="generic 0.3")], 23 ], 24 Discriminator("format_version"), 25 Field(title="generic"), 26] 27"""Union of any released generic desription""" 28# autogen: stop
491class GenericDescr(GenericDescrBase, extra="ignore"): 492 """Specification of the fields used in a generic bioimage.io-compliant resource description file (RDF). 493 494 An RDF is a YAML file that describes a resource such as a model, a dataset, or a notebook. 495 Note that those resources are described with a type-specific RDF. 496 Use this generic resource description, if none of the known specific types matches your resource. 497 """ 498 499 implemented_type: ClassVar[Literal["generic"]] = "generic" 500 if TYPE_CHECKING: 501 type: Annotated[str, LowerCase] = "generic" 502 """The resource type assigns a broad category to the resource.""" 503 else: 504 type: Annotated[str, LowerCase] 505 """The resource type assigns a broad category to the resource.""" 506 507 id: Optional[ 508 Annotated[ResourceId, Field(examples=["affable-shark", "ambitious-sloth"])] 509 ] = None 510 """bioimage.io-wide unique resource identifier 511 assigned by bioimage.io; version **un**specific.""" 512 513 parent: Optional[ResourceId] = None 514 """The description from which this one is derived""" 515 516 source: Optional[HttpUrl] = None 517 """The primary source of the resource""" 518 519 @field_validator("type", mode="after") 520 @classmethod 521 def check_specific_types(cls, value: str) -> str: 522 if value in KNOWN_SPECIFIC_RESOURCE_TYPES: 523 raise ValueError( 524 f"Use the {value} description instead of this generic description for" 525 + f" your '{value}' resource." 526 ) 527 528 return value
Specification of the fields used in a generic bioimage.io-compliant resource description file (RDF).
An RDF is a YAML file that describes a resource such as a model, a dataset, or a notebook. Note that those resources are described with a type-specific RDF. Use this generic resource description, if none of the known specific types matches your resource.
bioimage.io-wide unique resource identifier assigned by bioimage.io; version unspecific.
The description from which this one is derived
519 @field_validator("type", mode="after") 520 @classmethod 521 def check_specific_types(cls, value: str) -> str: 522 if value in KNOWN_SPECIFIC_RESOURCE_TYPES: 523 raise ValueError( 524 f"Use the {value} description instead of this generic description for" 525 + f" your '{value}' resource." 526 ) 527 528 return value
Configuration for the model, should be a dictionary conforming to [ConfigDict
][pydantic.config.ConfigDict].
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.
Inherited Members
- bioimageio.spec.generic.v0_3.GenericDescrBase
- implemented_format_version
- convert_from_old_format_wo_validation
- documentation
- badges
- config
- bioimageio.spec.generic.v0_3.GenericModelDescrBase
- name
- description
- covers
- id_emoji
- attachments
- cite
- license
- git_repo
- icon
- links
- uploader
- maintainers
- warn_about_tag_categories
- version
- version_comment
Union of any released generic desription