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

docstring and typehints for Container.set_data_io #1014

Merged
merged 2 commits into from
Dec 12, 2023
Merged
Changes from all commits
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
14 changes: 13 additions & 1 deletion src/hdmf/container.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from abc import abstractmethod
from collections import OrderedDict
from copy import deepcopy
from typing import Type
from uuid import uuid4
from warnings import warn

Expand Down Expand Up @@ -746,7 +747,18 @@ def __smart_str_dict(d, num_indent):
out += '\n' + indent + right_br
return out

def set_data_io(self, dataset_name, data_io_class, **kwargs):
def set_data_io(self, dataset_name: str, data_io_class: Type[DataIO], **kwargs) -> None:
"""

Parameters
----------
dataset_name: str
Name of dataset to wrap in DataIO
data_io_class: Type[DataIO]
Class to use for DataIO, e.g. H5DataIO or ZarrDataIO
**kwargs:
kwargs are passed to the constructor of the DataIO class
"""
data = self.fields.get(dataset_name)
if data is None:
raise ValueError(f"{dataset_name} is None and cannot be wrapped in a DataIO class")
Expand Down