Skip to content

Commit

Permalink
Fix some comments and error messages.
Browse files Browse the repository at this point in the history
  • Loading branch information
erykoff committed Jan 24, 2024
1 parent 0322818 commit 008d455
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions healsparse/packedBoolArray.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,8 @@ def sum(self, shape=None, axis=None):
@property
def data_array(self):
if self._start_index != 0 or self._stop_index != self.size:
raise NotImplementedError("Cannot yet get data array from offset array")
raise NotImplementedError("_PackedBoolArray does not support extracting the "
"data_array from an unaligned _PackedBoolArray.")

return self._data

Expand All @@ -203,6 +204,10 @@ def copy(self):
-------
copy : `_PackedBoolArray`
"""
# Prior to copying the array, we mask any extra padding bits
# on either side of the data array. This requires unpacking
# the first and/or last parts of the data buffer and then
# repackaging the masked tails.
first_unpacked, mid_data, last_unpacked = self._extract_first_middle_last(mask_extra=True)
new_buffer = self._data.copy()
if first_unpacked[0] is not None:
Expand Down Expand Up @@ -539,9 +544,6 @@ def _extract_first_middle_last(self, mask_extra=False):
(last_unpacked, 0, self._stop_index % 8),
)

# Should not get here.
raise RuntimeError("Programmer mistake")

def _operation_helper_bool(self, operation, other):
"""Helper function for performing an operation with a boolean.
Expand Down

0 comments on commit 008d455

Please sign in to comment.