Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Properly open filehandles for RemoteReadableAssets #1376

Merged
merged 2 commits into from
Dec 13, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion dandi/misctypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,10 @@
# Optional dependency:
import fsspec

return cast(IO[bytes], fsspec.open(self.url, mode="rb"))
# 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
# context manager.
return cast(IO[bytes], fsspec.open(self.url, mode="rb").open())

Check warning on line 351 in dandi/misctypes.py

View check run for this annotation

Codecov / codecov/patch

dandi/misctypes.py#L351

Added line #L351 was not covered by tests
yarikoptic marked this conversation as resolved.
Show resolved Hide resolved

def get_size(self) -> int:
return self.size
Expand Down