|
39 | 39 | from typing_extensions import Annotated, LiteralString, Self |
40 | 40 |
|
41 | 41 | from bioimageio.spec._internal.constants import IN_PACKAGE_MESSAGE |
42 | | -from bioimageio.spec._internal.types import NotEmpty, RdfContent, YamlValue |
| 42 | +from bioimageio.spec._internal.types import NotEmpty, RdfContent, Version, YamlValue |
43 | 43 | from bioimageio.spec._internal.types.field_validation import is_valid_yaml_mapping |
44 | 44 | from bioimageio.spec._internal.utils import unindent |
45 | 45 | from bioimageio.spec._internal.validation_context import InternalValidationContext, get_internal_validation_context |
|
50 | 50 |
|
51 | 51 | if sys.version_info < (3, 9): |
52 | 52 |
|
53 | | - class FrozenDictBase(collections.abc.Mapping, Generic[K, V]): |
| 53 | + class FrozenDictBase(collections.abc.Mapping, Generic[K, V]): # pyright: ignore[reportMissingTypeArgument] |
54 | 54 | pass |
55 | 55 |
|
56 | 56 | else: |
@@ -209,8 +209,7 @@ def _update_context(cls, context: InternalValidationContext, data: RdfContent) - |
209 | 209 | # set original format if possible |
210 | 210 | original_format = data.get("format_version") |
211 | 211 | if "original_format" not in context and isinstance(original_format, str) and original_format.count(".") == 2: |
212 | | - context["original_format"] = cast(Tuple[int, int, int], tuple(map(int, original_format.split(".")))) |
213 | | - assert len(context["original_format"]) == 3 |
| 212 | + context["original_format"] = Version(original_format) |
214 | 213 |
|
215 | 214 | @classmethod |
216 | 215 | def model_validate( |
@@ -337,7 +336,7 @@ def keys(self) -> Set[K]: # type: ignore |
337 | 336 | def __contains__(self, key: Any): |
338 | 337 | return key in self.model_fields_set |
339 | 338 |
|
340 | | - def get(self, item: Any, default: D = None) -> Union[V, D]: # type: ignore |
| 339 | + def get(self, item: Any, default: D = None) -> Union[V, D]: |
341 | 340 | return getattr(self, item, default) |
342 | 341 |
|
343 | 342 | @model_validator(mode="after") |
|
0 commit comments