Welcome to py-lapper’s documentation!

py_lapper is an simple datastructure for doing interval queries.

The primary interface for it is via the find method. For fast in-order queries use the seek method.

class py_lapper.lib.Cursor(cursor: int)

Cursor is a wrapper for an index to allow for mutation.

class py_lapper.lib.Interval(start: int, stop: int, val: T)

Interval represenation that is inclusive start, exclusive stop.

overlap(other: py_lapper.lib.Interval[~T][T]) → bool

Return true if self overlaps other.

overlap_pos(start: int, stop: int) → bool

Return true if self overlaps the passed in start / stop.

class py_lapper.lib.Lapper(intervals: Sequence[py_lapper.lib.Interval[~T][T]])

Lapper is the primary datastructure for py_lapper.

Lapper takes in a Sequence of intervals, sorts it, and finds the largest interval in the passed in set. The primary methods for interacting with Lapper are find and seek.

find(start: int, stop: int) → Iterator[py_lapper.lib.Interval[~T][T]]

Iterate over Intervals that overlap the input start and stop site.

static lower_bound(start: int, intervals: Sequence[py_lapper.lib.Interval[~T][T]]) → int

Find the lowest index that we should start searching from.

seek(start: int, stop: int, cursor: py_lapper.lib.Cursor) → Iterator[py_lapper.lib.Interval[~T][T]]

Iterate over Intervals that overlap the input start and stop site.

The cursor tracks the position so that the lower_bound does not need to be found for each new query.

Indices and tables