intervaltree
intervaltree copied to clipboard
The 'copy()' method does not work properly on subclasses of IntervalTree
As in the title. It always returns IntervalTree instance instead of the subclass instance.
In [1]: from intervaltree import IntervalTree
In [2]: class MyTree(IntervalTree):
...: pass
...:
In [3]: t = MyTree()
In [4]: isinstance(t.copy(), MyTree)
Out[4]: False
In [5]: type(t.copy())
Out[5]: intervaltree.intervaltree.IntervalTree
The same applies to other methods that return a new IntervalTree, like intersection, union... Also __repr__ always prints IntervalTree.