From b575e501fed436a8d21bf0d9211051b28f0acb22 Mon Sep 17 00:00:00 2001 From: Ben Dichter Date: Mon, 11 Dec 2023 21:13:39 -0600 Subject: [PATCH] docstring and typehints for Container.set_data_io (#1014) Co-authored-by: Ryan Ly --- src/hdmf/container.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/hdmf/container.py b/src/hdmf/container.py index 8420805cb..7c0b5fdf4 100644 --- a/src/hdmf/container.py +++ b/src/hdmf/container.py @@ -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 @@ -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")