Skip to content

Commit

Permalink
Merge pull request #572 from bioimage-io/check_load_description_and_test
Browse files Browse the repository at this point in the history
return already loaded description with warning
  • Loading branch information
FynnBe authored Mar 20, 2024
2 parents 9aeacb5 + 4ed4fb9 commit 32d9287
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions bioimageio/spec/_io.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from typing import Literal, TextIO, Union, cast

from loguru import logger
from pydantic import FilePath, NewPath

from ._description import (
Expand All @@ -23,6 +24,11 @@ def load_description(
*,
format_version: Union[Literal["discover"], Literal["latest"], str] = DISCOVER,
) -> Union[ResourceDescr, InvalidDescr]:
if isinstance(source, ResourceDescrBase):
name = getattr(source, "name", f"{str(source)[:10]}...")
logger.warning("returning already loaded description '{}' as is", name)
return source # pyright: ignore[reportReturnType]

opened = open_bioimageio_yaml(source)

return build_description(
Expand Down

0 comments on commit 32d9287

Please sign in to comment.