Skip to content

Commit 19171a5

Browse files
committed
feat: delay dandischema.models import in dandi/files/zarr.py
1 parent 2c06e3d commit 19171a5

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

dandi/files/zarr.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,8 @@
1111
import os.path
1212
from pathlib import Path
1313
from time import sleep
14-
from typing import Any, Optional
14+
from typing import TYPE_CHECKING, Any, Optional
1515

16-
from dandischema.models import BareAsset, DigestType
1716
from pydantic import BaseModel, ConfigDict, ValidationError
1817
import requests
1918
from zarr_checksum.tree import ZarrChecksumTree
@@ -55,6 +54,9 @@
5554
Validator,
5655
)
5756

57+
if TYPE_CHECKING:
58+
from dandischema.models import BareAsset
59+
5860
lgr = get_logger()
5961

6062

@@ -320,6 +322,8 @@ def get_digest(self) -> Digest:
320322
directory, the algorithm will be the DANDI Zarr checksum algorithm; if
321323
it is a file, it will be MD5.
322324
"""
325+
from dandischema.models import DigestType
326+
323327
# Avoid heavy import by importing within function:
324328
from dandi.support.digests import get_digest, get_zarr_checksum
325329

0 commit comments

Comments
 (0)