Skip to content

Commit

Permalink
docstring and typehints for Container.set_data_io (#1014)
Browse files Browse the repository at this point in the history
Co-authored-by: Ryan Ly <[email protected]>
  • Loading branch information
bendichter and rly authored Dec 12, 2023
1 parent 0ae01cd commit b575e50
Showing 1 changed file with 13 additions and 1 deletion.
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

0 comments on commit b575e50

Please sign in to comment.