Skip to content

Commit

Permalink
lint and remove comments on range based slicing for biocframes
Browse files Browse the repository at this point in the history
  • Loading branch information
jkanche committed Oct 31, 2023
1 parent c53be9a commit b52c2ff
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions src/iranges/IRanges.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ def _sanitize_names(self, names):
return None
elif not isinstance(names, list):
names = list(names)

return names

def _validate_names(self):
Expand All @@ -119,7 +120,7 @@ def _validate_mcols(self):

if self._mcols.shape[0] != len(self._start):
raise ValueError(
"Number of rows of 'mcols' should be equal to length of 'start'"
"Number of rows in 'mcols' should be equal to length of 'start'"
)

def _sanitize_metadata(self, metadata):
Expand Down Expand Up @@ -448,7 +449,7 @@ def __getitem__(
start=self._start[idx],
width=self._width[idx],
names=ut.subset(self._names, idx) if self._names is not None else None,
mcols=self._mcols[list(idx), :], # doesn't support ranges yet.
mcols=self._mcols[list(idx), :],
metadata=self._metadata,
)

Expand All @@ -473,7 +474,7 @@ def __setitem__(
idx, scalar = ut.normalize_subscript(args, len(self), self._names)
self._start[idx] = value._start
self._width[idx] = value._width
# self._mcols[list(idx),:] = value._mcols # doesn't support ranges yet.
self._mcols[list(idx), :] = value._mcols

if value._names is not None:
if self._names is None:
Expand Down
2 changes: 1 addition & 1 deletion tests/test_IRanges.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def test_IRanges_metadata():

with pytest.raises(ValueError) as ex:
IRanges(starts, widths, mcols=BiocFrame({}, number_of_rows=3))
assert str(ex.value).find("number of rows") >= 0
assert str(ex.value).find("Number of rows") >= 0

assert x.get_metadata() == {}
y = x.set_metadata({"A": 2})
Expand Down

0 comments on commit b52c2ff

Please sign in to comment.