Skip to content

Commit f22438f

Browse files
committed
call validate_sha256 directly
1 parent d1a27cd commit f22438f

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

bioimageio/core/digest_spec.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
from numpy.typing import NDArray
2626
from typing_extensions import Unpack, assert_never
2727

28-
from bioimageio.spec import get_validation_context
2928
from bioimageio.spec._internal.io import HashKwargs
3029
from bioimageio.spec.common import FileDescr, FileSource, ZipPath
3130
from bioimageio.spec.model import AnyModelDescr, v0_4, v0_5
@@ -86,9 +85,10 @@ def import_callable(
8685
def _import_from_file_impl(
8786
source: FileSource, callable_name: str, **kwargs: Unpack[HashKwargs]
8887
):
89-
with get_validation_context().replace(perform_io_checks=True):
90-
src_descr = FileDescr(source=source, **kwargs)
91-
assert src_descr.sha256 is not None
88+
src_descr = FileDescr(source=source, **kwargs)
89+
# ensure sha is valid even if perform_io_checks=False
90+
src_descr.validate_sha256()
91+
assert src_descr.sha256 is not None
9292

9393
local_source = src_descr.download()
9494
source_code = local_source.path.read_text(encoding="utf-8")

0 commit comments

Comments
 (0)