File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -42,7 +42,11 @@ def __init__(
4242 if not allow_empty and not os .path .lexists (
4343 self .path_obj / dandiset_metadata_file
4444 ):
45- raise ValueError (f"No dandiset at { path } " )
45+ raise ValueError (
46+ f"No dandiset at { path } . "
47+ f"The directory does not contain a '{ dandiset_metadata_file } ' file. "
48+ "Use 'dandi download' to download a dandiset or check the path."
49+ )
4650 self .metadata : dict | None = None
4751 self ._metadata_file_obj = self .path_obj / dandiset_metadata_file
4852 self ._load_metadata ()
@@ -139,11 +143,17 @@ def _get_identifier(metadata: dict) -> str | None:
139143 @property
140144 def identifier (self ) -> str :
141145 if self .metadata is None :
142- raise ValueError ("No metadata record found in Dandiset" )
146+ raise ValueError (
147+ f"No metadata record found in Dandiset at { self .path } . "
148+ f"The '{ dandiset_metadata_file } ' file may be empty or corrupted. "
149+ "Use 'dandi download' to re-download the dandiset metadata."
150+ )
143151 id_ = self ._get_identifier (self .metadata )
144152 if not id_ :
145153 raise ValueError (
146- f"Found no dandiset.identifier in metadata record: { self .metadata } "
154+ f"Found no dandiset.identifier in metadata record. "
155+ f"The '{ dandiset_metadata_file } ' file must contain an 'identifier' field. "
156+ f"Metadata: { self .metadata } "
147157 )
148158 return id_
149159
Original file line number Diff line number Diff line change 1+ """Utilities for working with NWB (Neurodata Without Borders) files.
2+
3+ This module provides helper functions for reading, validating, and extracting
4+ metadata from NWB files using PyNWB. Features include:
5+ - NWB file I/O with caching
6+ - Metadata extraction for DANDI schema
7+ - Version compatibility checking
8+ - External link detection
9+ - Validation against NWB standards
10+ """
11+
112from __future__ import annotations
213
314from collections import Counter
Original file line number Diff line number Diff line change 44from collections .abc import Iterator , Sequence
55from contextlib import ExitStack
66from enum import Enum
7- from functools import reduce
87import io
98import os .path
109from pathlib import Path
@@ -493,7 +492,7 @@ def upload_agg(*ignored: Any) -> str:
493492 for p in paths :
494493 rp = os .path .relpath (p , dandiset .path )
495494 relpaths .append ("" if rp == "." else rp )
496- path_prefix = reduce ( os .path .commonprefix , relpaths ) # type: ignore[arg-type]
495+ path_prefix = os .path .commonprefix ( relpaths )
497496 to_delete = []
498497 for asset in remote_dandiset .get_assets_with_path_prefix (path_prefix ):
499498 if any (
Original file line number Diff line number Diff line change 1+ """Validation of DANDI datasets against schemas and standards.
2+
3+ This module provides validation functionality for dandisets, including:
4+ - DANDI schema validation
5+ - BIDS standard validation
6+ - File layout and organization validation
7+ - Metadata completeness checking
8+ """
9+
110from __future__ import annotations
211
312from collections .abc import Iterator
You can’t perform that action at this time.
0 commit comments