Skip to content

Commit

Permalink
class docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
mavaylon1 committed Sep 24, 2023
1 parent aeb10cf commit 0674517
Showing 1 changed file with 25 additions and 6 deletions.
31 changes: 25 additions & 6 deletions src/hdmf_zarr/zarr_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@


class ZarrDataset(HDMFDataset):
"""
Extension of HDMFDataset to add Zarr compatibility
"""
@docval({'name': 'dataset', 'type': (np.ndarray, ZarrArray, Array), 'doc': 'the Zarr file lazily evaluate'},
{'name': 'io', 'type': 'ZarrIO', 'doc': 'the IO object that was used to read the underlying dataset'})
def __init__(self, **kwargs):
Expand Down Expand Up @@ -104,7 +107,7 @@ def get_object(self, zarr_obj):

class ContainerResolverMixin(ContainerResolver): # refactor to backend/utils.py
"""
A mixin for adding to Zarr reference-resolving types
A mixin for adding to Zarr reference-resolvinAbstractZarrReferenceDatasetg types
the get_object method that returns Containers
"""

Expand All @@ -116,7 +119,10 @@ def get_object(self, zarr_obj):


class AbstractZarrTableDataset(DatasetOfReferences): # Table refers to compound dataset

"""
Extension of DatasetOfReferences to serve as the base class for resolving Zarr
references in compound datasets to either Builders and Containers.
"""
@docval({'name': 'dataset', 'type': (np.ndarray, ZarrArray, Array), 'doc': 'the Zarr file lazily evaluate'},
{'name': 'io', 'type': 'ZarrIO', 'doc': 'the IO object that was used to read the underlying dataset'},
{'name': 'types', 'type': (list, tuple),
Expand Down Expand Up @@ -150,8 +156,9 @@ def __init__(self, **kwargs):
t = sub.metadata['ref']
if t is Reference:
tmp.append('object')
elif t is RegionReference:
tmp.append('region')
# elif t is RegionReference:
# tmp.append('region')
# TODO: Region References are not yet supported
else:
tmp.append(sub.type.__name__)
self.__dtype = tmp
Expand Down Expand Up @@ -197,7 +204,10 @@ def __iter__(self):


class AbstractZarrReferenceDataset(DatasetOfReferences):

"""
Extension of DatasetOfReferences to serve as the base class for resolving Zarr
references in datasets to either Builders and Containers.
"""
def __getitem__(self, arg):
ref = super().__getitem__(arg)
if isinstance(ref, np.ndarray):
Expand All @@ -211,7 +221,12 @@ def dtype(self):


class AbstractZarrRegionDataset(AbstractZarrReferenceDataset):
"""
Extension of DatasetOfReferences to serve as the base class for resolving Zarr
references in datasets to either Builders and Containers.
Note: Region References are not yet supported.
"""
def __getitem__(self, arg):
obj = super().__getitem__(arg)
ref = self.dataset[arg]
Expand Down Expand Up @@ -270,6 +285,8 @@ class ContainerZarrRegionDataset(ContainerResolverMixin, AbstractZarrRegionDatas
"""
A reference-resolving dataset for resolving region references that returns
resolved references as Containers
Note: Region References are not yet supported.
"""

@classmethod
Expand All @@ -280,7 +297,9 @@ def get_inverse_class(cls):
class BuilderZarrRegionDataset(BuilderResolverMixin, AbstractZarrRegionDataset):
"""
A reference-resolving dataset for resolving region references that returns
resolved references as Builders
resolved references as Builders.
Note: Region References are not yet supported.
"""

@classmethod
Expand Down

0 comments on commit 0674517

Please sign in to comment.