python-intervaltree
Port variant py39
Summary Editable interval tree data structure (3.9)
Package version 3.1.0
Homepage https://github.com/chaimleib/intervaltree
Keywords python
Maintainer Python Automaton
License Not yet specified
Other variants py310
Ravenports Buildsheet | History
Ravensource Port Directory | History
Last modified 20 NOV 2021, 04:14:38 UTC
Port created 15 AUG 2018, 15:32:35 UTC
Subpackage Descriptions
single [![Build status badge][]][build status] intervaltree ============ A mutable, self-balancing interval tree for Python 2 and 3. Queries may be by point, by range overlap, or by range envelopment. This library was designed to allow tagging text and time intervals, where the intervals include the lower bound but not the upper bound. **Version 3 changes!** * The `search(begin, end, strict)` method no longer exists. Instead, use one of these: * `at(point)` * `overlap(begin, end)` * `envelop(begin, end)` * The `extend(items)` method no longer exists. Instead, use `update(items)`. * Methods like `merge_overlaps()` which took a `strict` argument consistently default to `strict=True`. Before, some methods defaulted to `True` and others to `False`. Installing ---------- `sh pip install intervaltree ` Features -------- * Supports Python 2.7 and Python 3.5+ (Tested under 2.7, and 3.5 thru 3.8) * Initializing * blank `tree = IntervalTree()` * from an iterable of `Interval` objects (`tree = IntervalTree(intervals)`) * from an iterable of tuples (`tree = IntervalTree.from_tuples(interval_tuples)`) * Insertions * `tree[begin:end] = data` * `tree.add(interval)` * `tree.addi(begin, end, data)` * Deletions * `tree.remove(interval)` (raises `ValueError` if not present) * `tree.discard(interval)` (quiet if not present) * `tree.removei(begin, end, data)` (short for `tree.remove(Interval(begin, end, data))`) * `tree.discardi(begin, end, data)` (short for `tree.discard(Interval(begin, end, data))`) * `tree.remove_overlap(point)` * `tree.remove_overlap(begin, end)` (removes all overlapping the range) * `tree.remove_envelop(begin, end)` (removes all enveloped in the range) * Point queries * `tree[point]` * `tree.at(point)` (same as previous) * Overlap queries * `tree[begin:end]` * `tree.overlap(begin, end)` (same as previous) * Envelop queries * `tree.envelop(begin, end)` * Membership queries * `interval_obj in tree` (this is fastest, O(1)) * `tree.containsi(begin, end, data)` * `tree.overlaps(point)` * `tree.overlaps(begin, end)` * Iterable * `for interval_obj in tree:` * `tree.items()` * Sizing * `len(tree)` * `tree.is_empty()` * `not tree` * `tree.begin()` (the `begin` coordinate of the leftmost interval) * `tree.end()` (the `end` coordinate of the rightmost interval) * Set-like operations * union * `result_tree = tree.union(iterable)` * `result_tree = tree1 | tree2` * `tree.update(iterable)` * `tree |= other_tree` * difference * `result_tree = tree.difference(iterable)`
Configuration Switches (platform-specific settings discarded)
PY310 OFF Build using Python 3.10 PY39 ON Build using Python 3.9
Package Dependencies by Type
Build (only) python-setuptools:single:py39
autoselect-python:single:standard
Build and Runtime python-sortedcontainers:single:py39
python39:single:standard
Download groups
main mirror://PYPI/i/intervaltree
Distribution File Information
902b1b88936918f9b2a19e0e5eb7ccb430ae45cde4f39ea4b36932920d33952d 32861 intervaltree-3.1.0.tar.gz
Ports that require python-intervaltree:py39
python-xml2rfc:py39 Request For Comment authoring with XML (3.9)