diff --git a/.travis.yml b/.travis.yml index 8127d16..562a1c8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,14 +1,14 @@ language: python matrix: include: - - python: 2.7 - - python: 3.5 - - python: 3.6 - python: 3.7 - python: 3.8 + - python: 3.9 + - python: 3.10 + - python: 3.11 dist: xenial sudo: true - - python: 3.9-dev + - python: 3.12-dev env: FAILOK=y dist: xenial sudo: true diff --git a/HACKING.md b/HACKING.md index 6c73a30..4b17409 100644 --- a/HACKING.md +++ b/HACKING.md @@ -9,7 +9,7 @@ This is a developer's guide to modifying and maintaining `intervaltree`. * On Linux, you will need `apt-get`. -On all systems, Python 2.6, 2.7, 3.2, 3.3, 3.4 and 3.5 are needed to run the complete test suite. +On all systems, Python 3.7 thru 3.12 are needed to run the complete test suite. ### Single version of Python @@ -87,7 +87,7 @@ The two commands above run all the available tests on all versions of Python sup The first time you run `make`, you may be asked for your password. This is in order to install `pandoc`, a tool used for processing the README file. -Running all tests requires that you have all the supported versions of Python installed. These are 2.6, 2.7, 3.2, 3.3, 3.4 and 3.5. Try to use your package manager to install them if possible. Otherwise, go to [python.org/downloads][] and install them manually. +Running all tests requires that you have all the supported versions of Python installed. These are 3.7 thru 3.12. Try to use your package manager to install them if possible. Otherwise, go to [python.org/downloads][] and install them manually. #### Single version of Python diff --git a/Makefile b/Makefile index 10c3af1..d017fe0 100644 --- a/Makefile +++ b/Makefile @@ -9,7 +9,9 @@ TEMPS=$(shell \ -o \( -type d -name '__pycache__' \) \ ) -PYTHONS:=2.7.18 3.5.9 3.6.11 3.7.8 3.8.5 +# See https://devguide.python.org/versions +# Use every version that is not end-of-life. +PYTHONS:=3.7.16 3.8.16 3.9.16 3.10.9 3.11.1 3.12.0a4 PYTHON_MAJORS:=$(shell \ echo "$(PYTHONS)" | \ tr ' ' '\n' | cut -d. -f1 | \ diff --git a/README.md b/README.md index fb2c6fb..49043fd 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ intervaltree ============ -A mutable, self-balancing interval tree for Python 2 and 3. Queries may be by point, by range overlap, or by range envelopment. +A mutable, self-balancing interval tree for Python. 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. @@ -26,7 +26,7 @@ pip install intervaltree Features -------- -* Supports Python 2.7 and Python 3.5+ (Tested under 2.7, and 3.5 thru 3.8) +* Supports Python 3.7+ (Tested under 3.7 thru 3.12) * Initializing * blank `tree = IntervalTree()` * from an iterable of `Interval` objects (`tree = IntervalTree(intervals)`) diff --git a/intervaltree/__init__.py b/intervaltree/__init__.py index 72b2c55..b5c8b32 100644 --- a/intervaltree/__init__.py +++ b/intervaltree/__init__.py @@ -2,7 +2,7 @@ # -*- coding: utf-8 -*- """ -intervaltree: A mutable, self-balancing interval tree for Python 2 and 3. +intervaltree: A mutable, self-balancing interval tree for Python. Queries may be by point, by range overlap, or by range envelopment. Root package. diff --git a/intervaltree/interval.py b/intervaltree/interval.py index 865cca7..bb78b22 100644 --- a/intervaltree/interval.py +++ b/intervaltree/interval.py @@ -2,7 +2,7 @@ # -*- coding: utf-8 -*- """ -intervaltree: A mutable, self-balancing interval tree for Python 2 and 3. +intervaltree: A mutable, self-balancing interval tree for Python. Queries may be by point, by range overlap, or by range envelopment. Interval class diff --git a/intervaltree/intervaltree.py b/intervaltree/intervaltree.py index 2548eed..1539159 100644 --- a/intervaltree/intervaltree.py +++ b/intervaltree/intervaltree.py @@ -2,7 +2,7 @@ # -*- coding: utf-8 -*- """ -intervaltree: A mutable, self-balancing interval tree for Python 2 and 3. +intervaltree: A mutable, self-balancing interval tree for Python. Queries may be by point, by range overlap, or by range envelopment. Core logic. @@ -26,19 +26,10 @@ from .node import Node from numbers import Number from sortedcontainers import SortedDict +from collections.abc import MutableSet from copy import copy from warnings import warn -try: - from collections.abc import MutableSet # Python 3? -except ImportError: - from collections import MutableSet - -try: - xrange # Python 2? -except NameError: # pragma: no cover - xrange = range - # noinspection PyBroadException class IntervalTree(MutableSet): @@ -900,7 +891,7 @@ def envelop(self, begin, end=None): bound_end = boundary_table.bisect_left(end) # up to, but not including end result.update(root.search_overlap( # slice notation is slightly slower - boundary_table.keys()[index] for index in xrange(bound_begin, bound_end) + boundary_table.keys()[index] for index in range(bound_begin, bound_end) )) # TODO: improve envelop() to use node info instead of less-efficient filtering @@ -934,7 +925,7 @@ def overlap(self, begin, end=None): bound_end = boundary_table.bisect_left(end) # up to, but not including end result.update(root.search_overlap( # slice notation is slightly slower - boundary_table.keys()[index] for index in xrange(bound_begin, bound_end) + boundary_table.keys()[index] for index in range(bound_begin, bound_end) )) return result diff --git a/intervaltree/node.py b/intervaltree/node.py index fc8e35d..b86f27b 100644 --- a/intervaltree/node.py +++ b/intervaltree/node.py @@ -2,7 +2,7 @@ # -*- coding: utf-8 -*- """ -intervaltree: A mutable, self-balancing interval tree for Python 2 and 3. +intervaltree: A mutable, self-balancing interval tree for Python. Queries may be by point, by range overlap, or by range envelopment. Core logic: internal tree nodes. diff --git a/setup.py b/setup.py index faa6c56..fcd80f4 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ # -*- coding: utf-8 -*- """ -intervaltree: A mutable, self-balancing interval tree for Python 2 and 3. +intervaltree: A mutable, self-balancing interval tree for Python. Queries may be by point, by range overlap, or by range envelopment. Distribution logic @@ -24,7 +24,6 @@ See the License for the specific language governing permissions and limitations under the License. """ -from __future__ import absolute_import import io import os from sys import exit @@ -82,7 +81,7 @@ def run_tests(self): name='intervaltree', version=vinfo['version'], install_requires=['sortedcontainers >= 2.0, < 3.0'], - description='Editable interval tree data structure for Python 2 and 3', + description='Editable interval tree data structure for Python', long_description=long_description, long_description_content_type='text/markdown', classifiers=[ # Get strings from http://pypi.python.org/pypi?%3Aaction=list_classifiers @@ -92,13 +91,12 @@ def run_tests(self): 'Intended Audience :: Information Technology', 'Intended Audience :: Science/Research', 'Programming Language :: Python', - 'Programming Language :: Python :: 2', - 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.5', - 'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: 3.7', 'Programming Language :: Python :: 3.8', + 'Programming Language :: Python :: 3.9', + 'Programming Language :: Python :: 3.10', + 'Programming Language :: Python :: 3.11', 'License :: OSI Approved :: Apache Software License', 'Topic :: Scientific/Engineering :: Artificial Intelligence', 'Topic :: Scientific/Engineering :: Bio-Informatics', diff --git a/test/interval_methods/__init__.py b/test/interval_methods/__init__.py index 57ba27a..489bdd6 100644 --- a/test/interval_methods/__init__.py +++ b/test/interval_methods/__init__.py @@ -1,5 +1,5 @@ """ -intervaltree: A mutable, self-balancing interval tree for Python 2 and 3. +intervaltree: A mutable, self-balancing interval tree for Python. Queries may be by point, by range overlap, or by range envelopment. Test module: Interval methods diff --git a/test/interval_methods/binary_test.py b/test/interval_methods/binary_test.py index 68ef212..1725bbc 100644 --- a/test/interval_methods/binary_test.py +++ b/test/interval_methods/binary_test.py @@ -1,5 +1,5 @@ """ -intervaltree: A mutable, self-balancing interval tree for Python 2 and 3. +intervaltree: A mutable, self-balancing interval tree for Python. Queries may be by point, by range overlap, or by range envelopment. Test module: Intervals, methods on two intervals diff --git a/test/interval_methods/sorting_test.py b/test/interval_methods/sorting_test.py index 0521f37..14e6593 100644 --- a/test/interval_methods/sorting_test.py +++ b/test/interval_methods/sorting_test.py @@ -1,5 +1,5 @@ """ -intervaltree: A mutable, self-balancing interval tree for Python 2 and 3. +intervaltree: A mutable, self-balancing interval tree for Python. Queries may be by point, by range overlap, or by range envelopment. Test module: Intervals, sorting methods diff --git a/test/interval_methods/unary_test.py b/test/interval_methods/unary_test.py index 4e0196e..9f6d47d 100644 --- a/test/interval_methods/unary_test.py +++ b/test/interval_methods/unary_test.py @@ -1,5 +1,5 @@ """ -intervaltree: A mutable, self-balancing interval tree for Python 2 and 3. +intervaltree: A mutable, self-balancing interval tree for Python. Queries may be by point, by range overlap, or by range envelopment. Test module: Intervals, methods on self only diff --git a/test/intervals.py b/test/intervals.py index 7c2612e..e8c581b 100644 --- a/test/intervals.py +++ b/test/intervals.py @@ -1,5 +1,5 @@ """ -intervaltree: A mutable, self-balancing interval tree for Python 2 and 3. +intervaltree: A mutable, self-balancing interval tree for Python. Queries may be by point, by range overlap, or by range envelopment. Test module: utilities to generate intervals @@ -18,21 +18,12 @@ See the License for the specific language governing permissions and limitations under the License. """ -from __future__ import absolute_import from intervaltree import Interval from pprint import pprint from random import randint, choice from test.progress_bar import ProgressBar import os -try: - xrange -except NameError: - xrange = range -try: - unicode -except NameError: - unicode = str def make_iv(begin, end, label=False): if label: @@ -49,7 +40,7 @@ def nogaps_rand(size=100, labels=False): """ cur = -50 result = [] - for i in xrange(size): + for i in range(size): length = randint(1, 10) result.append(make_iv(cur, cur + length, labels)) cur += length @@ -65,7 +56,7 @@ def gaps_rand(size=100, labels=False): """ cur = -50 result = [] - for i in xrange(size): + for i in range(size): length = randint(1, 10) if choice([True, False]): cur += length @@ -114,7 +105,7 @@ def trepr(s): if docstring: f.write(trepr(docstring)) f.write('\n') - if isinstance(imports, (str, unicode)): + if isinstance(imports, str): f.write(imports) f.write('\n\n') elif isinstance(imports, (list, tuple, set)): diff --git a/test/intervaltree_methods/__init__.py b/test/intervaltree_methods/__init__.py index dd9822c..97bbf54 100644 --- a/test/intervaltree_methods/__init__.py +++ b/test/intervaltree_methods/__init__.py @@ -1,5 +1,5 @@ """ -intervaltree: A mutable, self-balancing interval tree for Python 2 and 3. +intervaltree: A mutable, self-balancing interval tree for Python. Queries may be by point, by range overlap, or by range envelopment. Test module: IntervalTree methods diff --git a/test/intervaltree_methods/copy_test.py b/test/intervaltree_methods/copy_test.py index e974eb7..2903923 100644 --- a/test/intervaltree_methods/copy_test.py +++ b/test/intervaltree_methods/copy_test.py @@ -1,5 +1,5 @@ """ -intervaltree: A mutable, self-balancing interval tree for Python 2 and 3. +intervaltree: A mutable, self-balancing interval tree for Python. Queries may be by point, by range overlap, or by range envelopment. Test module: IntervalTree, Copying @@ -18,13 +18,9 @@ See the License for the specific language governing permissions and limitations under the License. """ -from __future__ import absolute_import from intervaltree import Interval, IntervalTree from test import data -try: - import cPickle as pickle -except ImportError: - import pickle +import pickle def test_copy(): diff --git a/test/intervaltree_methods/debug_test.py b/test/intervaltree_methods/debug_test.py index 90d231a..3b4c24f 100644 --- a/test/intervaltree_methods/debug_test.py +++ b/test/intervaltree_methods/debug_test.py @@ -1,5 +1,5 @@ """ -intervaltree: A mutable, self-balancing interval tree for Python 2 and 3. +intervaltree: A mutable, self-balancing interval tree for Python. Queries may be by point, by range overlap, or by range envelopment. Test module: IntervalTree, Basic query methods (read-only) @@ -18,15 +18,11 @@ See the License for the specific language governing permissions and limitations under the License. """ -from __future__ import absolute_import from intervaltree import Interval, IntervalTree import pytest from test import data from pprint import pprint, pformat -try: - import cPickle as pickle -except ImportError: - import pickle +import pickle def test_print_empty(): diff --git a/test/intervaltree_methods/delete_test.py b/test/intervaltree_methods/delete_test.py index 1ff6927..b6a8f4a 100644 --- a/test/intervaltree_methods/delete_test.py +++ b/test/intervaltree_methods/delete_test.py @@ -1,5 +1,5 @@ """ -intervaltree: A mutable, self-balancing interval tree for Python 2 and 3. +intervaltree: A mutable, self-balancing interval tree for Python. Queries may be by point, by range overlap, or by range envelopment. Test module: IntervalTree, Basic deletion methods @@ -18,14 +18,10 @@ See the License for the specific language governing permissions and limitations under the License. """ -from __future__ import absolute_import from intervaltree import Interval, IntervalTree import pytest from test import data, match -try: - import cPickle as pickle -except ImportError: - import pickle +import pickle def test_delete(): diff --git a/test/intervaltree_methods/init_test.py b/test/intervaltree_methods/init_test.py index 08d570a..e9d2d2e 100644 --- a/test/intervaltree_methods/init_test.py +++ b/test/intervaltree_methods/init_test.py @@ -1,5 +1,5 @@ """ -intervaltree: A mutable, self-balancing interval tree for Python 2 and 3. +intervaltree: A mutable, self-balancing interval tree for Python. Queries may be by point, by range overlap, or by range envelopment. Test module: IntervalTree, initialization methods @@ -18,14 +18,9 @@ See the License for the specific language governing permissions and limitations under the License. """ -from __future__ import absolute_import from intervaltree import Interval, IntervalTree import pytest - -try: - import cPickle as pickle -except ImportError: - import pickle +import pickle def test_empty_init(): diff --git a/test/intervaltree_methods/insert_test.py b/test/intervaltree_methods/insert_test.py index f7ac8fd..b54719d 100644 --- a/test/intervaltree_methods/insert_test.py +++ b/test/intervaltree_methods/insert_test.py @@ -1,5 +1,5 @@ """ -intervaltree: A mutable, self-balancing interval tree for Python 2 and 3. +intervaltree: A mutable, self-balancing interval tree for Python. Queries may be by point, by range overlap, or by range envelopment. Test module: IntervalTree, Basic insertion methods @@ -18,14 +18,10 @@ See the License for the specific language governing permissions and limitations under the License. """ -from __future__ import absolute_import from intervaltree import Interval, IntervalTree import pytest from test import data, match -try: - import cPickle as pickle -except ImportError: - import pickle +import pickle def test_insert(): diff --git a/test/intervaltree_methods/query_test.py b/test/intervaltree_methods/query_test.py index 29e782e..71483f7 100644 --- a/test/intervaltree_methods/query_test.py +++ b/test/intervaltree_methods/query_test.py @@ -1,5 +1,5 @@ """ -intervaltree: A mutable, self-balancing interval tree for Python 2 and 3. +intervaltree: A mutable, self-balancing interval tree for Python. Queries may be by point, by range overlap, or by range envelopment. Test module: IntervalTree, Basic query methods (read-only) @@ -18,14 +18,10 @@ See the License for the specific language governing permissions and limitations under the License. """ -from __future__ import absolute_import from intervaltree import Interval, IntervalTree import pytest from test import data, match -try: - import cPickle as pickle -except ImportError: - import pickle +import pickle def test_empty_queries(): diff --git a/test/intervaltree_methods/restructure_test.py b/test/intervaltree_methods/restructure_test.py index 9d178b3..210d29d 100644 --- a/test/intervaltree_methods/restructure_test.py +++ b/test/intervaltree_methods/restructure_test.py @@ -1,5 +1,5 @@ """ -intervaltree: A mutable, self-balancing interval tree for Python 2 and 3. +intervaltree: A mutable, self-balancing interval tree for Python. Queries may be by point, by range overlap, or by range envelopment. Test module: IntervalTree, Special methods @@ -18,14 +18,10 @@ See the License for the specific language governing permissions and limitations under the License. """ -from __future__ import absolute_import from intervaltree import Interval, IntervalTree import pytest from test import data -try: - import cPickle as pickle -except ImportError: - import pickle +import pickle # ----------------------------------------------------------------------------- diff --git a/test/intervaltree_methods/setlike_test.py b/test/intervaltree_methods/setlike_test.py index f6a6298..d8844ed 100644 --- a/test/intervaltree_methods/setlike_test.py +++ b/test/intervaltree_methods/setlike_test.py @@ -1,5 +1,5 @@ """ -intervaltree: A mutable, self-balancing interval tree for Python 2 and 3. +intervaltree: A mutable, self-balancing interval tree for Python. Queries may be by point, by range overlap, or by range envelopment. Test module: IntervalTree, Special methods @@ -18,14 +18,10 @@ See the License for the specific language governing permissions and limitations under the License. """ -from __future__ import absolute_import from intervaltree import Interval, IntervalTree import pytest from test import data -try: - import cPickle as pickle -except ImportError: - import pickle +import pickle def test_update(): diff --git a/test/intervaltrees.py b/test/intervaltrees.py index e57c487..9fb6485 100644 --- a/test/intervaltrees.py +++ b/test/intervaltrees.py @@ -1,5 +1,5 @@ """ -intervaltree: A mutable, self-balancing interval tree for Python 2 and 3. +intervaltree: A mutable, self-balancing interval tree for Python. Queries may be by point, by range overlap, or by range envelopment. Test module: utilities to generate test trees @@ -18,15 +18,11 @@ See the License for the specific language governing permissions and limitations under the License. """ -from __future__ import absolute_import from intervaltree import IntervalTree from pprint import pprint from test import intervals, data from test.progress_bar import ProgressBar -try: - xrange -except NameError: - xrange = range + def nogaps_rand(size=100, labels=False): """ diff --git a/test/issues/__init__.py b/test/issues/__init__.py index 457f28e..097e4f4 100644 --- a/test/issues/__init__.py +++ b/test/issues/__init__.py @@ -1,5 +1,5 @@ """ -intervaltree: A mutable, self-balancing interval tree for Python 2 and 3. +intervaltree: A mutable, self-balancing interval tree for Python. Queries may be by point, by range overlap, or by range envelopment. Test module: issues by tracking number diff --git a/test/issues/issue25_test.py b/test/issues/issue25_test.py index 67d1c29..a27f189 100644 --- a/test/issues/issue25_test.py +++ b/test/issues/issue25_test.py @@ -1,5 +1,5 @@ """ -intervaltree: A mutable, self-balancing interval tree for Python 2 and 3. +intervaltree: A mutable, self-balancing interval tree for Python. Queries may be by point, by range overlap, or by range envelopment. Test module: IntervalTree, insertion and removal of float intervals @@ -19,7 +19,6 @@ See the License for the specific language governing permissions and limitations under the License. """ -from __future__ import absolute_import from intervaltree import IntervalTree from test import data import pytest diff --git a/test/issues/issue26_test.py b/test/issues/issue26_test.py index 9ebab49..fdb1cbd 100644 --- a/test/issues/issue26_test.py +++ b/test/issues/issue26_test.py @@ -1,5 +1,5 @@ """ -intervaltree: A mutable, self-balancing interval tree for Python 2 and 3. +intervaltree: A mutable, self-balancing interval tree for Python. Queries may be by point, by range overlap, or by range envelopment. Test module: IntervalTree, insertion and removal of float intervals @@ -20,7 +20,6 @@ See the License for the specific language governing permissions and limitations under the License. """ -from __future__ import absolute_import from intervaltree import IntervalTree, Interval # from test.intervaltrees import trees import pytest diff --git a/test/issues/issue27_test.py b/test/issues/issue27_test.py index a78ed39..a92aca8 100644 --- a/test/issues/issue27_test.py +++ b/test/issues/issue27_test.py @@ -1,5 +1,5 @@ """ -intervaltree: A mutable, self-balancing interval tree for Python 2 and 3. +intervaltree: A mutable, self-balancing interval tree for Python. Queries may be by point, by range overlap, or by range envelopment. Test module: IntervalTree, insertion and removal of float intervals @@ -20,7 +20,6 @@ See the License for the specific language governing permissions and limitations under the License. """ -from __future__ import absolute_import from intervaltree import IntervalTree, Interval import pytest diff --git a/test/issues/issue4.py b/test/issues/issue4.py index 2eac84a..d0b1829 100644 --- a/test/issues/issue4.py +++ b/test/issues/issue4.py @@ -4,7 +4,6 @@ Test contributed by jacekt ''' -from __future__ import absolute_import from intervaltree import IntervalTree from test.progress_bar import ProgressBar from test import data diff --git a/test/issues/issue41_test.py b/test/issues/issue41_test.py index 3bdfd0d..e8d39e0 100644 --- a/test/issues/issue41_test.py +++ b/test/issues/issue41_test.py @@ -1,5 +1,5 @@ """ -intervaltree: A mutable, self-balancing interval tree for Python 2 and 3. +intervaltree: A mutable, self-balancing interval tree for Python. Queries may be by point, by range overlap, or by range envelopment. Test module: IntervalTree, removal of intervals @@ -19,7 +19,6 @@ See the License for the specific language governing permissions and limitations under the License. """ -from __future__ import absolute_import from intervaltree import IntervalTree from test import data import pytest diff --git a/test/issues/issue67_test.py b/test/issues/issue67_test.py index d19363a..65c7af2 100644 --- a/test/issues/issue67_test.py +++ b/test/issues/issue67_test.py @@ -1,5 +1,5 @@ """ -intervaltree: A mutable, self-balancing interval tree for Python 2 and 3. +intervaltree: A mutable, self-balancing interval tree for Python. Queries may be by point, by range overlap, or by range envelopment. Test module: IntervalTree, insertion of a sequence of intervals caused @@ -21,7 +21,6 @@ See the License for the specific language governing permissions and limitations under the License. """ -from __future__ import absolute_import from intervaltree import IntervalTree import pytest diff --git a/test/issues/issue72_test.py b/test/issues/issue72_test.py index 3c96bb1..1692f42 100644 --- a/test/issues/issue72_test.py +++ b/test/issues/issue72_test.py @@ -1,5 +1,5 @@ """ -intervaltree: A mutable, self-balancing interval tree for Python 2 and 3. +intervaltree: A mutable, self-balancing interval tree for Python. Queries may be by point, by range overlap, or by range envelopment. Test module: IntervalTree, remove_overlap caused incorrect balancing @@ -21,7 +21,6 @@ See the License for the specific language governing permissions and limitations under the License. """ -from __future__ import absolute_import from intervaltree import IntervalTree, Interval import pytest diff --git a/test/match.py b/test/match.py index d4ccd73..2d58aa7 100644 --- a/test/match.py +++ b/test/match.py @@ -1,5 +1,5 @@ """ -intervaltree: A mutable, self-balancing interval tree for Python 2 and 3. +intervaltree: A mutable, self-balancing interval tree for Python. Queries may be by point, by range overlap, or by range envelopment. Test module: IntervalTree, test utilities @@ -19,7 +19,6 @@ limitations under the License. """ -from __future__ import absolute_import from intervaltree import Interval def set_data(s): diff --git a/test/optimality/__init__.py b/test/optimality/__init__.py index b04a452..f7d470c 100644 --- a/test/optimality/__init__.py +++ b/test/optimality/__init__.py @@ -1,5 +1,5 @@ """ -intervaltree: A mutable, self-balancing interval tree for Python 2 and 3. +intervaltree: A mutable, self-balancing interval tree for Python. Queries may be by point, by range overlap, or by range envelopment. Test module: IntervalTree structure optimality tests diff --git a/test/optimality/optimality_test.py b/test/optimality/optimality_test.py index eb2223d..5e9676b 100644 --- a/test/optimality/optimality_test.py +++ b/test/optimality/optimality_test.py @@ -1,5 +1,5 @@ """ -intervaltree: A mutable, self-balancing interval tree for Python 2 and 3. +intervaltree: A mutable, self-balancing interval tree for Python. Queries may be by point, by range overlap, or by range envelopment. Test module: IntervalTree optimality @@ -18,7 +18,6 @@ See the License for the specific language governing permissions and limitations under the License. """ -from __future__ import absolute_import from pprint import pprint from warnings import warn diff --git a/test/optimality/optimality_test_matrix.py b/test/optimality/optimality_test_matrix.py index 5a2c40c..8667858 100644 --- a/test/optimality/optimality_test_matrix.py +++ b/test/optimality/optimality_test_matrix.py @@ -1,5 +1,5 @@ """ -intervaltree: A mutable, self-balancing interval tree for Python 2 and 3. +intervaltree: A mutable, self-balancing interval tree for Python. Queries may be by point, by range overlap, or by range envelopment. Test module: IntervalTree optimality @@ -18,18 +18,12 @@ See the License for the specific language governing permissions and limitations under the License. """ -from __future__ import absolute_import from intervaltree import IntervalTree, Interval from test import data from copy import deepcopy from pprint import pprint from test.progress_bar import ProgressBar -try: - xrange -except NameError: - xrange = range - class OptimalityTestMatrix(object): def __init__(self, ivs=None, verbose=False): diff --git a/test/pprint.py b/test/pprint.py index 7f8692f..6724d4e 100644 --- a/test/pprint.py +++ b/test/pprint.py @@ -51,18 +51,8 @@ ENABLE_PICKLE_DEFAULT = True from numbers import Number -try: - from cStringIO import StringIO as _StringIO -except ImportError: - try: - from StringIO import StringIO as _StringIO - except ImportError: - from io import StringIO as _StringIO +from io import StringIO as _StringIO -try: - basestring -except NameError: - basestring = str __all__ = ["pprint","pformat","isreadable","isrecursive","saferepr", "PrettyPrinter"] @@ -440,7 +430,7 @@ def _pickleable(typ, obj): Whether we can use __reduce__ to pprint. """ if (issubclass(typ, Number) or - issubclass(typ, basestring) + issubclass(typ, str) ): return False try: reduce_data = obj.__reduce__() diff --git a/test/progress_bar.py b/test/progress_bar.py index c1966eb..0a4b04e 100644 --- a/test/progress_bar.py +++ b/test/progress_bar.py @@ -1,5 +1,5 @@ """ -intervaltree: A mutable, self-balancing interval tree for Python 2 and 3. +intervaltree: A mutable, self-balancing interval tree for Python. Queries may be by point, by range overlap, or by range envelopment. Test module: progress bar @@ -18,17 +18,10 @@ See the License for the specific language governing permissions and limitations under the License. """ -from __future__ import print_function -from __future__ import division from time import time from functools import partial import sys -try: - xrange -except NameError: - xrange = range - def write(s): sys.stdout.write(s) @@ -414,7 +407,7 @@ def _slow_test(): from time import sleep total = 10 pbar = ProgressBar(total) - for i in xrange(total): + for i in range(total): pbar() sleep(0.5) @@ -425,7 +418,7 @@ def _fast_test(): total, fmt=ProgressBar.Formats.stats_only, ) - for i in xrange(total): + for i in range(total): pbar()