Skip to content

Commit

Permalink
expose __len__ for IntervalSets
Browse files Browse the repository at this point in the history
  • Loading branch information
TyberiusPrime committed Mar 18, 2024
1 parent ea8a808 commit 4db988b
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "mbf_nested_intervals"
version = "0.3.1"
version = "0.4.0"
authors = ["Florian Finkernagel <finkernagel@imt.uni-marburg.de>"]
edition = "2018"

Expand Down
2 changes: 1 addition & 1 deletion mbf_nested_intervals/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import pandas as pd
import itertools

__version__ = "0.3.1"
__version__ = "0.4.0"


def _df_to_tup(df):
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[metadata]
name = mbf_nested_intervals
description = wrapper around https://crates.io/crates/nested_intervals
version = 0.3.1
version = 0.4.0
author = Florian Finkernagel
author-email = finkernagel@imt.uni-marburg.de
license = mit
Expand Down
4 changes: 4 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,10 @@ impl PyIntervalSet {
}


pub fn __len__(&self) -> PyResult<usize> {
Ok(self.inner.len())
}

}

/// Wrapper around nested intervals
Expand Down
1 change: 1 addition & 0 deletions tests/test_interval_set.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ def test_from_tuples(self):
(1,15),
(1,10),
]
assert len(i) == 3

def test_from_tuples_with_id(self):
i = IntervalSet.from_tuples_with_id([
Expand Down

0 comments on commit 4db988b

Please sign in to comment.