Skip to content

Commit d000be8

Browse files
yarikopticclaude
andcommitted
fix: guard hed_standard import for compat with released dandischema
hed_standard does not exist in dandischema < 0.12.2, so gate the import on _SCHEMA_BAREASSET_HAS_DATASTANDARD (all new symbols ship together). HED detection is skipped when unavailable. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 53757db commit d000be8

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

dandi/files/bids.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,18 @@
1212
BareAsset,
1313
StandardsType,
1414
bids_standard,
15-
hed_standard,
1615
ome_ngff_standard,
1716
)
1817

1918
import dandi
2019
from dandi.bids_validator_deno import bids_validate
2120

2221
from .bases import GenericAsset, LocalFileAsset, NWBAsset, _SCHEMA_BAREASSET_HAS_DATASTANDARD
22+
23+
if _SCHEMA_BAREASSET_HAS_DATASTANDARD:
24+
from dandischema.models import hed_standard
25+
else:
26+
hed_standard = None # type: ignore[assignment]
2327
from .zarr import ZarrAsset
2428
from ..consts import ZARR_MIME_TYPE, dandiset_metadata_file
2529
from ..metadata.core import add_common_metadata, prepare_metadata
@@ -234,7 +238,7 @@ def get_metadata(
234238
_add_standard(metadata, bids_standard)
235239
return metadata
236240
_add_standard(metadata, bids_standard, version=desc.get("BIDSVersion"))
237-
if hed_version := desc.get("HEDVersion"):
241+
if hed_standard and (hed_version := desc.get("HEDVersion")):
238242
# HEDVersion can be a string or list.
239243
# List form: ["8.2.0", "sc:1.0.0"] where first element is base
240244
# HED version and subsequent "prefix:version" entries are library

0 commit comments

Comments
 (0)