Skip to content

Commit

Permalink
feat: add __contains__ to CompressoArray
Browse files Browse the repository at this point in the history
  • Loading branch information
william-silversmith committed Mar 6, 2024
1 parent e5814e2 commit 751179c
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions compresso.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -604,6 +604,9 @@ class CompressoArray:
def remap(self, buf, mapping, preserve_missing_labels=False):
return CompressoArray(remap(buf, mapping, preserve_missing_labels))

def __contains__(self, label):
return label in self.labels()

def __getitem__(self, slcs):
slices = reify_slices(slcs, *self.shape)

Expand Down

0 comments on commit 751179c

Please sign in to comment.