Skip to content

Commit dd338cf

Browse files
committed
Addressed minor copilot concerns
1 parent 7d1dc64 commit dd338cf

4 files changed

Lines changed: 15 additions & 2 deletions

File tree

hed/schema/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
- :data:`HedKey` / :data:`HedSectionKey` — enumerations of schema attribute and
3131
section names used when querying schema entries.
3232
- :func:`get_hed_versions` — list versions available in the local cache.
33+
- :func:`get_hed_xml_version` — read the HED version string from an XML schema file on disk.
3334
- :func:`cache_xml_versions` — pre-populate the local cache from the HED GitHub
3435
releases.
3536

hed/schema/hed_schema_entry.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -406,6 +406,7 @@ def _finalize_inherited_attributes(self):
406406
self.inherited_attributes = self.attributes.copy()
407407
for attribute in self._section.inheritable_attributes:
408408
value = self._check_inherited_attribute(attribute, return_value=True)
409+
# None means "not found in the hierarchy"; attribute values themselves are never None.
409410
if value is not None:
410411
self.inherited_attributes[attribute] = value
411412

hed/schema/schema_io/schema2base.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,12 @@ def _output_annotations(self, hed_schema):
124124
raise NotImplementedError("This needs to be defined in the subclass")
125125

126126
def _output_extras(self, hed_schema):
127-
raise NotImplementedError("This needs to be defined in the subclass")
127+
"""Optional hook for format-specific sections not covered by the standard traversal.
128+
129+
The base implementation is a deliberate no-op. Subclasses that need to
130+
emit additional content (e.g. the header-attributes sheet in TSV) override
131+
this method; subclasses that have nothing extra can safely omit it.
132+
"""
128133

129134
def _output_epilogue(self, epilogue):
130135
raise NotImplementedError("This needs to be defined in the subclass")

tests/models/test_hed_group.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,13 +125,19 @@ def test_shallow_copy_raises_copy_error(self):
125125
copy.copy(group)
126126

127127
def test_deep_copy_succeeds(self):
128-
"""copy.deepcopy() (and .copy()) must work correctly despite _parent cycles."""
128+
"""copy.deepcopy() and .copy() must work correctly despite _parent back-references."""
129129
hed_string = HedString("(Tag1, Tag2)", self.hed_schema)
130130
group = hed_string.get_first_group()
131+
131132
deep = copy.deepcopy(group)
132133
self.assertIsNot(deep, group)
133134
self.assertEqual(str(deep), str(group))
134135

136+
# .copy() is the documented public API for deep-copying a HedGroup
137+
via_copy = group.copy()
138+
self.assertIsNot(via_copy, group)
139+
self.assertEqual(str(via_copy), str(group))
140+
135141

136142
if __name__ == "__main__":
137143
unittest.main()

0 commit comments

Comments
 (0)