Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Nov 11, 2024
1 parent 4a0dbd9 commit 04088dc
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/hdmf/container.py
Original file line number Diff line number Diff line change
Expand Up @@ -723,12 +723,12 @@ def _generate_field_html(self, key, value, level, access_code):
return f'<div style="margin-left: {level * 20}px;" class="container-fields"><span class="field-key"' \
f' title="{access_code}">{key}: </span><span class="field-value">{value}</span></div>'

# Detects array-like objects that conform to the Array Interface specification
# Detects array-like objects that conform to the Array Interface specification
# (e.g., NumPy arrays, HDF5 datasets, DataIO objects). Objects must have both
# 'shape' and 'dtype' attributes. Iterators are excluded as they lack 'shape'.
# This approach keeps the implementation generic without coupling to specific backends methods
is_array_data = hasattr(value, "shape") and hasattr(value, "dtype")

if is_array_data:
html_content = self._generate_array_html(value, level + 1)
elif hasattr(value, "generate_html_repr"):
Expand Down Expand Up @@ -766,12 +766,12 @@ def _generate_array_html(self, array, level):
elif is_data_io:
array_info_dict = get_basic_array_info(array.data)
repr_html = generate_array_html_repr(array_info_dict, array.data, "DataIO")

Check warning on line 768 in src/hdmf/container.py

View check run for this annotation

Codecov / codecov/patch

src/hdmf/container.py#L767-L768

Added lines #L767 - L768 were not covered by tests
elif it_was_read_with_io:
elif it_was_read_with_io:
# The backend handles the representation here. Two special cases worth noting:
# 1. Array-type attributes (e.g., start_frame in ImageSeries) remain NumPy arrays
# 1. Array-type attributes (e.g., start_frame in ImageSeries) remain NumPy arrays
# even when their parent container has an IO
# 2. Data may have been modified after being read from storage
read_io = self.get_read_io()
read_io = self.get_read_io()
repr_html = read_io.generate_dataset_html(array)
else: # Not sure which object could get here
object_class = array.__class__.__name__
Expand Down

0 comments on commit 04088dc

Please sign in to comment.