Skip to content

Commit

Permalink
Remove more references to region references and RegionBuilder
Browse files Browse the repository at this point in the history
  • Loading branch information
rly authored Nov 15, 2024
1 parent c73cb8b commit cc66e17
Show file tree
Hide file tree
Showing 7 changed files with 5 additions and 26 deletions.
1 change: 0 additions & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@

nitpicky = True
nitpick_ignore = [('py:class', 'Intracomm'),
('py:class', 'h5py.RegionReference'),
('py:class', 'h5py._hl.dataset.Dataset'),
('py:class', 'function'),
('py:class', 'unittest.case.TestCase'),
Expand Down
2 changes: 1 addition & 1 deletion src/hdmf/backends/hdf5/h5tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -1492,7 +1492,7 @@ def __is_ref(self, dtype):
if isinstance(dtype, dict): # may be dict from reading a compound dataset
return self.__is_ref(dtype['dtype'])
if isinstance(dtype, str):
return dtype == DatasetBuilder.OBJECT_REF_TYPE or dtype == DatasetBuilder.REGION_REF_TYPE
return dtype == DatasetBuilder.OBJECT_REF_TYPE
return False

def __queue_ref(self, func):
Expand Down
2 changes: 1 addition & 1 deletion src/hdmf/build/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from .builders import Builder, DatasetBuilder, GroupBuilder, LinkBuilder, ReferenceBuilder, RegionBuilder
from .builders import Builder, DatasetBuilder, GroupBuilder, LinkBuilder, ReferenceBuilder
from .classgenerator import CustomClassGenerator, MCIClassGenerator
from .errors import (BuildError, OrphanContainerBuildError, ReferenceTargetNotBuiltError, ContainerConfigurationError,
ConstructError)
Expand Down
4 changes: 1 addition & 3 deletions src/hdmf/build/objectmapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import numpy as np

from .builders import DatasetBuilder, GroupBuilder, LinkBuilder, Builder, ReferenceBuilder, RegionBuilder, BaseBuilder
from .builders import DatasetBuilder, GroupBuilder, LinkBuilder, Builder, ReferenceBuilder, BaseBuilder
from .errors import (BuildError, OrphanContainerBuildError, ReferenceTargetNotBuiltError, ContainerConfigurationError,
ConstructError)
from .manager import Proxy, BuildManager
Expand Down Expand Up @@ -1214,8 +1214,6 @@ def __get_subspec_values(self, builder, spec, manager):
continue
if isinstance(attr_val, (GroupBuilder, DatasetBuilder)):
ret[attr_spec] = manager.construct(attr_val)
elif isinstance(attr_val, RegionBuilder): # pragma: no cover
raise ValueError("RegionReferences as attributes is not yet supported")
elif isinstance(attr_val, ReferenceBuilder):
ret[attr_spec] = manager.construct(attr_val.builder)
else:
Expand Down
5 changes: 1 addition & 4 deletions src/hdmf/validate/validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

from .errors import Error, DtypeError, MissingError, MissingDataType, ShapeError, IllegalLinkError, IncorrectDataType
from .errors import ExpectedArrayError, IncorrectQuantityError
from ..build import GroupBuilder, DatasetBuilder, LinkBuilder, ReferenceBuilder, RegionBuilder
from ..build import GroupBuilder, DatasetBuilder, LinkBuilder, ReferenceBuilder
from ..build.builders import BaseBuilder
from ..spec import Spec, AttributeSpec, GroupSpec, DatasetSpec, RefSpec, LinkSpec
from ..spec import SpecNamespace
Expand Down Expand Up @@ -124,9 +124,6 @@ def get_type(data, builder_dtype=None):
# Bytes data
elif isinstance(data, bytes):
return 'ascii', get_string_format(data)
# RegionBuilder data
elif isinstance(data, RegionBuilder):
return 'region', None
# ReferenceBuilder data
elif isinstance(data, ReferenceBuilder):
return 'object', None
Expand Down
11 changes: 1 addition & 10 deletions tests/unit/build_tests/test_builder.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from hdmf.build import GroupBuilder, DatasetBuilder, LinkBuilder, ReferenceBuilder, RegionBuilder
from hdmf.build import GroupBuilder, DatasetBuilder, LinkBuilder, ReferenceBuilder
from hdmf.testing import TestCase


Expand Down Expand Up @@ -392,12 +392,3 @@ def test_constructor(self):
db = DatasetBuilder('db1', [1, 2, 3])
rb = ReferenceBuilder(db)
self.assertIs(rb.builder, db)


class TestRegionBuilder(TestCase):

def test_constructor(self):
db = DatasetBuilder('db1', [1, 2, 3])
rb = RegionBuilder(slice(1, 3), db)
self.assertEqual(rb.region, slice(1, 3))
self.assertIs(rb.builder, db)
6 changes: 0 additions & 6 deletions tests/unit/spec_tests/test_ref_spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,3 @@ def test_constructor(self):
def test_wrong_reference_type(self):
with self.assertRaises(ValueError):
RefSpec('TimeSeries', 'unknownreftype')

def test_isregion(self):
spec = RefSpec('TimeSeries', 'object')
self.assertFalse(spec.is_region())
spec = RefSpec('Data', 'region')
self.assertTrue(spec.is_region())

0 comments on commit cc66e17

Please sign in to comment.