From 35db3ae144f57b9386e88f9b8b6fbb066f207c5c Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 6 Oct 2026 19:30:48 +0000 Subject: [PATCH] Fix get_metadata return annotation and import order in misctypes get_metadata() always returns a dict, never None. The imports in RemoteReadableAsset.open() were not sorted as the pinned isort (5.12.0) of the pre-commit hook expects, so any change to dandi/misctypes.py re-sorted them. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Qn5WBSiQgoZoL4fytF6nEr --- dandi/metadata/nwb.py | 2 +- dandi/misctypes.py | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/dandi/metadata/nwb.py b/dandi/metadata/nwb.py index 38c2ac4e7..bf43dbcb2 100644 --- a/dandi/metadata/nwb.py +++ b/dandi/metadata/nwb.py @@ -31,7 +31,7 @@ @metadata_cache.memoize_path def get_metadata( path: str | Path | Readable, digest: Digest | None = None -) -> dict | None: +) -> dict[str, Any]: """ Get "flatdata" from a .nwb file diff --git a/dandi/misctypes.py b/dandi/misctypes.py index b50cffc42..5ecc25486 100644 --- a/dandi/misctypes.py +++ b/dandi/misctypes.py @@ -343,9 +343,8 @@ class RemoteReadableAsset(Readable): def open(self) -> IO[bytes]: # Optional dependency: - import fsspec - from aiohttp import ClientTimeout + import fsspec # We need to call open() on the return value of fsspec.open() because # otherwise the filehandle will only be opened when used to enter a