summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrej Shadura <andrew.shadura@collabora.co.uk>2019-06-24 16:48:31 -0500
committerAndrej Shadura <andrew.shadura@collabora.co.uk>2019-06-24 16:48:31 -0500
commitf6c7008dcbe43bc4bcccb9cd3d4252270e3330da (patch)
treefda4df12ef94a3f6487892110a9e746b13ad6133
parent23a903622f592574a9823b68f71ed7d8ccf26faf (diff)
parent6151b5b28602b1b6980da41143dab183aca5996a (diff)
Update upstream source from tag 'upstream/2.1.0'
Update to upstream version '2.1.0' with Debian dir fbc8ae7ee27f7f8bb71dcf7d5d05c46531bd1d96
-rw-r--r--.pylintrc4
-rw-r--r--.travis.yml6
-rw-r--r--HISTORY.rst15
-rw-r--r--README.rst4
-rw-r--r--appveyor.yml2
-rw-r--r--docs/development.rst1
-rw-r--r--docs/performance-load.rst2
-rw-r--r--docs/performance-runtime.rst8
-rw-r--r--docs/performance.rst2
-rw-r--r--setup.py2
-rw-r--r--sortedcontainers/__init__.py4
-rw-r--r--sortedcontainers/sorteddict.py14
-rw-r--r--sortedcontainers/sortedlist.py8
-rw-r--r--sortedcontainers/sortedset.py14
-rwxr-xr-xtests/benchmark.sh30
-rw-r--r--tox.ini3
16 files changed, 87 insertions, 32 deletions
diff --git a/.pylintrc b/.pylintrc
index 1e5ce7a..d49b011 100644
--- a/.pylintrc
+++ b/.pylintrc
@@ -135,7 +135,9 @@ disable=print-statement,
redefined-argument-from-local,
no-staticmethod-decorator,
super-init-not-called,
- ungrouped-imports
+ ungrouped-imports,
+ no-else-return,
+ useless-object-inheritance
# Enable the message, report, category or checker with the given id(s). You can
# either give multiple identifier separated by comma (,) or put this option
diff --git a/.travis.yml b/.travis.yml
index 0cd415d..eb8d7c5 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -12,9 +12,13 @@ matrix:
env: TOXENV=py35
- python: 3.6
env: TOXENV=py36
+ - python: 3.7
+ dist: xenial
+ env: TOXENV=py37
- python: pypy
env: TOXENV=pypy
- python: pypy3
env: TOXENV=pypy3
- - python: 3.6
+ - python: 3.7
+ dist: xenial
env: TOXENV=lint
diff --git a/HISTORY.rst b/HISTORY.rst
index 86ae1fd..15e7397 100644
--- a/HISTORY.rst
+++ b/HISTORY.rst
@@ -7,6 +7,21 @@ Sorted Containers Release History
.. currentmodule:: sortedcontainers
+2.1.0 (2018-11-21)
+------------------
+
+**Miscellaneous**
+
+* Small updates to docs and tests for Python 3.7.
+
+2.0.5 (2018-09-03)
+------------------
+
+**Bugfixes**
+
+* Change imports for Abstract Base Classes to `collections.abc` to avoid
+ warnings in Python 3.7.
+
2.0.4 (2018-06-06)
------------------
diff --git a/README.rst b/README.rst
index 80581d8..9632b14 100644
--- a/README.rst
+++ b/README.rst
@@ -111,8 +111,8 @@ Features
- Compatible API (nearly identical to older blist and bintrees modules)
- Feature-rich (e.g. get the five largest keys in a sorted dict: d.keys()[-5:])
- Pragmatic design (e.g. SortedSet is a Python set with a SortedList index)
-- Developed on Python 3.6
-- Tested on CPython 2.7, 3.2, 3.3, 3.4, 3.5, 3.6 and PyPy, PyPy3
+- Developed on Python 3.7
+- Tested on CPython 2.7, 3.2, 3.3, 3.4, 3.5, 3.6, 3.7 and PyPy, PyPy3
.. image:: https://api.travis-ci.org/grantjenks/python-sortedcontainers.svg?branch=master
:target: http://www.grantjenks.com/docs/sortedcontainers/
diff --git a/appveyor.yml b/appveyor.yml
index 2098117..dc376f1 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -6,10 +6,12 @@ environment:
- PYTHON: "C:\\Python34"
- PYTHON: "C:\\Python35"
- PYTHON: "C:\\Python36"
+ - PYTHON: "C:\\Python37"
- PYTHON: "C:\\Python27-x64"
- PYTHON: "C:\\Python34-x64"
- PYTHON: "C:\\Python35-x64"
- PYTHON: "C:\\Python36-x64"
+ - PYTHON: "C:\\Python37-x64"
install:
diff --git a/docs/development.rst b/docs/development.rst
index f713a22..9bc0e78 100644
--- a/docs/development.rst
+++ b/docs/development.rst
@@ -220,6 +220,7 @@ of Python:
* CPython 3.4
* CPython 3.5
* CPython 3.6
+* CPython 3.7
* PyPy
* PyPy3
diff --git a/docs/performance-load.rst b/docs/performance-load.rst
index 849512a..e38d1dd 100644
--- a/docs/performance-load.rst
+++ b/docs/performance-load.rst
@@ -17,7 +17,7 @@ in-depth analysis of the load factor read :doc:`Performance at
Scale<performance-scale>`.
Performance of competing implementations are benchmarked against the CPython
-3.6 runtime. An :doc:`implementation performance comparison<performance>` is
+3.7 runtime. An :doc:`implementation performance comparison<performance>` is
also included with data from popular sorted collections packages.
Because :doc:`Sorted Containers<index>` is pure-Python, its performance also
diff --git a/docs/performance-runtime.rst b/docs/performance-runtime.rst
index 4337e14..9114542 100644
--- a/docs/performance-runtime.rst
+++ b/docs/performance-runtime.rst
@@ -4,17 +4,17 @@ Runtime Performance Comparison
Because :doc:`Sorted Containers<index>` is implemented in pure-Python, its
performance depends directly on the Python runtime. :doc:`Sorted
Containers<index>` is primarily developed, tested and benchmarked on CPython
-3.6.
+3.7.
Not all runtimes are created equal. The graphs below compare :doc:`Sorted
-Containers<index>` running on the CPython 3.6, CPython 2.7, and PyPy
-runtimes. As of Python 3.6 the CPython 3.6 runtime is now faster than the
+Containers<index>` running on the CPython 3.7, CPython 2.7, and PyPy
+runtimes. As of Python 3.7 the CPython 3.7 runtime is now faster than the
CPython 2.7 runtime. The PyPy runtime displays much more variability due to its
JIT-ed nature. Once the just-in-time compiler optimizes the code, performance
is often two to ten times faster.
Performance of competing implementations are benchmarked against the CPython
-3.6 runtime. An :doc:`implementation performance comparison<performance>` is
+3.7 runtime. An :doc:`implementation performance comparison<performance>` is
also included with data from popular sorted container packages.
:doc:`Sorted Containers<index>` uses a segmented-list data structure similar to
diff --git a/docs/performance.rst b/docs/performance.rst
index 73ed02b..0ecea4e 100644
--- a/docs/performance.rst
+++ b/docs/performance.rst
@@ -211,7 +211,7 @@ Deleting objects at random using :func:`SortedList.__delitem__`.
__getitem__
...........
-Retrieving ojbects by index using :func:`SortedList.__getitem__`.
+Retrieving objects by index using :func:`SortedList.__getitem__`.
.. image:: _static/SortedList-getitem.png
diff --git a/setup.py b/setup.py
index f0de60e..a76ccc5 100644
--- a/setup.py
+++ b/setup.py
@@ -44,6 +44,8 @@ setup(
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
+ 'Programming Language :: Python :: 3.6',
+ 'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: Implementation :: CPython',
'Programming Language :: Python :: Implementation :: PyPy',
),
diff --git a/sortedcontainers/__init__.py b/sortedcontainers/__init__.py
index 532ca5f..5943639 100644
--- a/sortedcontainers/__init__.py
+++ b/sortedcontainers/__init__.py
@@ -67,8 +67,8 @@ __all__ = [
]
__title__ = 'sortedcontainers'
-__version__ = '2.0.4'
-__build__ = 0x020004
+__version__ = '2.1.0'
+__build__ = 0x020100
__author__ = 'Grant Jenks'
__license__ = 'Apache 2.0'
__copyright__ = '2014-2018, Grant Jenks'
diff --git a/sortedcontainers/sorteddict.py b/sortedcontainers/sorteddict.py
index b7be9c5..ba9ed72 100644
--- a/sortedcontainers/sorteddict.py
+++ b/sortedcontainers/sorteddict.py
@@ -18,11 +18,23 @@ Sorted dict implementations:
import sys
import warnings
-from collections import ItemsView, KeysView, ValuesView, Sequence
from .sortedlist import SortedList, recursive_repr
from .sortedset import SortedSet
+###############################################################################
+# BEGIN Python 2/3 Shims
+###############################################################################
+
+try:
+ from collections.abc import ItemsView, KeysView, ValuesView, Sequence
+except ImportError:
+ from collections import ItemsView, KeysView, ValuesView, Sequence
+
+###############################################################################
+# END Python 2/3 Shims
+###############################################################################
+
class SortedDict(dict):
"""Sorted dict is a sorted mutable mapping.
diff --git a/sortedcontainers/sortedlist.py b/sortedcontainers/sortedlist.py
index f63026a..b3f1250 100644
--- a/sortedcontainers/sortedlist.py
+++ b/sortedcontainers/sortedlist.py
@@ -17,7 +17,6 @@ Sorted list implementations:
from __future__ import print_function
from bisect import bisect_left, bisect_right, insort
-from collections import Sequence, MutableSequence
from itertools import chain, repeat, starmap
from math import log
from operator import add, eq, ne, gt, ge, lt, le, iadd
@@ -27,6 +26,11 @@ from textwrap import dedent
# BEGIN Python 2/3 Shims
###############################################################################
+try:
+ from collections.abc import Sequence, MutableSequence
+except ImportError:
+ from collections import Sequence, MutableSequence
+
from functools import wraps
from sys import hexversion
@@ -195,7 +199,7 @@ class SortedList(MutableSequence):
@property
- def key(self):
+ def key(self): # pylint: disable=useless-return
"""Function used to extract comparison key from values.
Sorted list compares values directly so the key function is none.
diff --git a/sortedcontainers/sortedset.py b/sortedcontainers/sortedset.py
index b88cbaf..be2b899 100644
--- a/sortedcontainers/sortedset.py
+++ b/sortedcontainers/sortedset.py
@@ -13,13 +13,25 @@ Sorted set implementations:
"""
-from collections import MutableSet, Sequence, Set
from itertools import chain
from operator import eq, ne, gt, ge, lt, le
from textwrap import dedent
from .sortedlist import SortedList, recursive_repr
+###############################################################################
+# BEGIN Python 2/3 Shims
+###############################################################################
+
+try:
+ from collections.abc import MutableSet, Sequence, Set
+except ImportError:
+ from collections import MutableSet, Sequence, Set
+
+###############################################################################
+# END Python 2/3 Shims
+###############################################################################
+
class SortedSet(MutableSet, Sequence):
"""Sorted set is a sorted mutable set.
diff --git a/tests/benchmark.sh b/tests/benchmark.sh
index 1d12dbb..2930ef4 100755
--- a/tests/benchmark.sh
+++ b/tests/benchmark.sh
@@ -4,31 +4,31 @@ set -x
# Compare Implementations
-echo ". env36/bin/activate && python -m tests.benchmark_sortedlist --bare > tests/results_sortedlist.txt" | bash
+echo ". env37/bin/activate && python -m tests.benchmark_sortedlist --bare > tests/results_sortedlist.txt" | bash
python -m tests.benchmark_plot tests/results_sortedlist.txt SortedList --save
-echo ". env36/bin/activate && python -m tests.benchmark_sorteddict --bare > tests/results_sorteddict.txt" | bash
+echo ". env37/bin/activate && python -m tests.benchmark_sorteddict --bare > tests/results_sorteddict.txt" | bash
python -m tests.benchmark_plot tests/results_sorteddict.txt SortedDict --save
-echo ". env36/bin/activate && python -m tests.benchmark_sortedset --bare > tests/results_sortedset.txt" | bash
+echo ". env37/bin/activate && python -m tests.benchmark_sortedset --bare > tests/results_sortedset.txt" | bash
python -m tests.benchmark_plot tests/results_sortedset.txt SortedSet --save
# Compare Python Versions
rm tests/results_runtime_sortedlist.txt
-echo ". env36/bin/activate && python -m tests.benchmark_sortedlist --bare --kind SortedList --suffix _Py36 >> tests/results_runtime_sortedlist.txt" | bash
+echo ". env37/bin/activate && python -m tests.benchmark_sortedlist --bare --kind SortedList --suffix _Py37 >> tests/results_runtime_sortedlist.txt" | bash
echo ". env27/bin/activate && python -m tests.benchmark_sortedlist --bare --kind SortedList --suffix _Py27 >> tests/results_runtime_sortedlist.txt" | bash
echo ". env27/bin/activate && pypy -m tests.benchmark_sortedlist --bare --kind SortedList --suffix _PyPy >> tests/results_runtime_sortedlist.txt" | bash
python -m tests.benchmark_plot tests/results_runtime_sortedlist.txt SortedList --suffix _runtime --save
rm tests/results_runtime_sorteddict.txt
-echo ". env36/bin/activate && python -m tests.benchmark_sorteddict --bare --kind SortedDict --suffix _Py36 >> tests/results_runtime_sorteddict.txt" | bash
+echo ". env37/bin/activate && python -m tests.benchmark_sorteddict --bare --kind SortedDict --suffix _Py37 >> tests/results_runtime_sorteddict.txt" | bash
echo ". env27/bin/activate && python -m tests.benchmark_sorteddict --bare --kind SortedDict --suffix _Py27 >> tests/results_runtime_sorteddict.txt" | bash
echo ". env27/bin/activate && pypy -m tests.benchmark_sorteddict --bare --kind SortedDict --suffix _PyPy >> tests/results_runtime_sorteddict.txt" | bash
python -m tests.benchmark_plot tests/results_runtime_sorteddict.txt SortedDict --suffix _runtime --save
rm tests/results_runtime_sortedset.txt
-echo ". env36/bin/activate && python -m tests.benchmark_sortedset --bare --kind SortedSet --suffix _Py36 >> tests/results_runtime_sortedset.txt" | bash
+echo ". env37/bin/activate && python -m tests.benchmark_sortedset --bare --kind SortedSet --suffix _Py37 >> tests/results_runtime_sortedset.txt" | bash
echo ". env27/bin/activate && python -m tests.benchmark_sortedset --bare --kind SortedSet --suffix _Py27 >> tests/results_runtime_sortedset.txt" | bash
echo ". env27/bin/activate && pypy -m tests.benchmark_sortedset --bare --kind SortedSet --suffix _PyPy >> tests/results_runtime_sortedset.txt" | bash
python -m tests.benchmark_plot tests/results_runtime_sortedset.txt SortedSet --suffix _runtime --save
@@ -36,19 +36,19 @@ python -m tests.benchmark_plot tests/results_runtime_sortedset.txt SortedSet --s
# Compare Loads
rm tests/results_load_sortedlist.txt
-echo ". env36/bin/activate && python -m tests.benchmark_sortedlist --bare --kind SortedList --suffix _100 --load 100 --no-limit >> tests/results_load_sortedlist.txt" | bash
-echo ". env36/bin/activate && python -m tests.benchmark_sortedlist --bare --kind SortedList --suffix _1000 --load 1000 --no-limit >> tests/results_load_sortedlist.txt" | bash
-echo ". env36/bin/activate && python -m tests.benchmark_sortedlist --bare --kind SortedList --suffix _10000 --load 10000 --no-limit >> tests/results_load_sortedlist.txt" | bash
+echo ". env37/bin/activate && python -m tests.benchmark_sortedlist --bare --kind SortedList --suffix _100 --load 100 --no-limit >> tests/results_load_sortedlist.txt" | bash
+echo ". env37/bin/activate && python -m tests.benchmark_sortedlist --bare --kind SortedList --suffix _1000 --load 1000 --no-limit >> tests/results_load_sortedlist.txt" | bash
+echo ". env37/bin/activate && python -m tests.benchmark_sortedlist --bare --kind SortedList --suffix _10000 --load 10000 --no-limit >> tests/results_load_sortedlist.txt" | bash
python -m tests.benchmark_plot tests/results_load_sortedlist.txt SortedList --suffix _load --save
rm tests/results_load_sorteddict.txt
-echo ". env36/bin/activate && python -m tests.benchmark_sorteddict --bare --kind SortedDict --suffix _100 --load 100 --no-limit >> tests/results_load_sorteddict.txt" | bash
-echo ". env36/bin/activate && python -m tests.benchmark_sorteddict --bare --kind SortedDict --suffix _1000 --load 1000 --no-limit >> tests/results_load_sorteddict.txt" | bash
-echo ". env36/bin/activate && python -m tests.benchmark_sorteddict --bare --kind SortedDict --suffix _10000 --load 10000 --no-limit >> tests/results_load_sorteddict.txt" | bash
+echo ". env37/bin/activate && python -m tests.benchmark_sorteddict --bare --kind SortedDict --suffix _100 --load 100 --no-limit >> tests/results_load_sorteddict.txt" | bash
+echo ". env37/bin/activate && python -m tests.benchmark_sorteddict --bare --kind SortedDict --suffix _1000 --load 1000 --no-limit >> tests/results_load_sorteddict.txt" | bash
+echo ". env37/bin/activate && python -m tests.benchmark_sorteddict --bare --kind SortedDict --suffix _10000 --load 10000 --no-limit >> tests/results_load_sorteddict.txt" | bash
python -m tests.benchmark_plot tests/results_load_sorteddict.txt SortedDict --suffix _load --save
rm tests/results_load_sortedset.txt
-echo ". env36/bin/activate && python -m tests.benchmark_sortedset --bare --kind SortedSet --suffix _100 --load 100 --no-limit >> tests/results_load_sortedset.txt" | bash
-echo ". env36/bin/activate && python -m tests.benchmark_sortedset --bare --kind SortedSet --suffix _1000 --load 1000 --no-limit >> tests/results_load_sortedset.txt" | bash
-echo ". env36/bin/activate && python -m tests.benchmark_sortedset --bare --kind SortedSet --suffix _10000 --load 10000 --no-limit >> tests/results_load_sortedset.txt" | bash
+echo ". env37/bin/activate && python -m tests.benchmark_sortedset --bare --kind SortedSet --suffix _100 --load 100 --no-limit >> tests/results_load_sortedset.txt" | bash
+echo ". env37/bin/activate && python -m tests.benchmark_sortedset --bare --kind SortedSet --suffix _1000 --load 1000 --no-limit >> tests/results_load_sortedset.txt" | bash
+echo ". env37/bin/activate && python -m tests.benchmark_sortedset --bare --kind SortedSet --suffix _10000 --load 10000 --no-limit >> tests/results_load_sortedset.txt" | bash
python -m tests.benchmark_plot tests/results_load_sortedset.txt SortedSet --suffix _load --save
diff --git a/tox.ini b/tox.ini
index 7ffa34c..dc46e84 100644
--- a/tox.ini
+++ b/tox.ini
@@ -1,5 +1,6 @@
[tox]
-envlist=py27,py34,py35,py36,pypy,pypy3,lint
+envlist=py27,py34,py35,py36,py37,pypy,pypy3,lint
+skip_missing_interpreters=True
[testenv]
deps=pytest