From 888531760c26744b3aa9797670ddcd5eb152c66a Mon Sep 17 00:00:00 2001 From: jab Date: Mon, 27 Feb 2017 17:27:08 +0000 Subject: [PATCH] update to latest sphinx and pre-commit --- foo.py | 22 ++++++++++++++++++++++ setup.py | 4 ++-- 2 files changed, 24 insertions(+), 2 deletions(-) create mode 100644 foo.py diff --git a/foo.py b/foo.py new file mode 100644 index 0000000..8f89d53 --- /dev/null +++ b/foo.py @@ -0,0 +1,22 @@ +import bidict, sortedcontainers, sortedcollections, collections + +class sortedbidict2(bidict.OrderedMapping, bidict.bidict): + _fwd_class = sortedcontainers.SortedDict +_inv_class = sortedcollections.ValueSortedDict + +elemByAtomicNum = sortedbidict2({1: 'hydrogen', 2: 'helium', 3: 'lithium'}) + +elemByAtomicNum.update({4: 'beryllium'}) + +# order is preserved correctly when passing .inv back into constructor: +atomicNumByElem = sortedbidict2(elemByAtomicNum.inv) + +# attrs not defined by bidict are passed through to the _fwd SortedDict: +elemByAtomicNum.peekitem(index=0) +elemByAtomicNum.popitem(last=False) +elemByAtomicNum.inv.popitem(last=True) + +elemByAtomicNum == {2: 'helium', 3: 'lithium'} +elemByAtomicNum == {3: 'lithium', 2: 'helium'} +bidict.OrderedMapping.__eq__(elemByAtomicNum, {3: 'lithium', 2: 'helium'}) +collections.Mapping.__eq__(elemByAtomicNum, {3: 'lithium', 2: 'helium'}) diff --git a/setup.py b/setup.py index 4a6edf6..be92b77 100644 --- a/setup.py +++ b/setup.py @@ -27,7 +27,7 @@ tests_require = [ 'pytest==3.0.6', 'pytest-benchmark==3.1.0a1', 'pytest-cov==2.4.0', - 'Sphinx==1.5.2', + 'Sphinx==1.5.3', 'sortedcollections==0.4.2', 'sortedcontainers==1.5.5', ] @@ -64,6 +64,6 @@ setup( tests_require=tests_require, extras_require=dict( test=tests_require, - dev=tests_require + ['pre-commit==0.12.2', 'tox==2.3.2'], + dev=tests_require + ['pre-commit==0.13.3', 'tox==2.6.0'], ), )