- Ensure that (un)pickling OrderedBidicts is order-preserving.
- Refactor __reduce__, _reduce_factory, and _init_from
to use new private constructor _from_other.
- NamedBidictBase and GeneratedBidictInverse marker classes
don't need to derive from BidictBase.
bidict.BidirectionalMapping.__subclasshook__ now requires an ``inverse`` attribute
rather than an ``inv`` attribute for a class to qualify as a virtual subclass.
Closes#86.
Use bidicts for the backing ``_fwdm`` and ``_invm`` mappings,
obviating the need to store key and value data in linked list nodes.
Also drop the unnecessary ^ from the namedtuple identifier regexes.
- Refactor proxied- (i.e. delegated-) to-``_fwdm`` logic
for better composability and interoperability.
Drop the ``_Proxied*`` mixin classes
and instead move their methods
into :class:`~bidict.BidictBase`,
which now checks for an object defined by the
:attr:`~bidict.BidictBase.__delegate__` attribute.
The :attr:`~bidict.BidictBase.__delegate__` object
will be delegated to if the method is available on it,
otherwise a default implementation
(e.g. inherited from :class:`~collections.abc.Mapping`)
will be used otherwise.
Subclasses may set ``__delegate__ = None`` to opt out.
- Consolidate ``_MutableBidict`` into :class:`bidict.bidict`
now that the dropped mixin classes make it unnecessary.
- Change :attr:`~bidict.BidictBase.__repr_delegate__`
to take simply a type like :class:`dict` or :class:`list`.
- Upgrade to latest major
`sortedcontainers <https://github.com/grantjenks/python-sortedcontainers>`__
version (from v1 to v2)
for the :ref:`extending:Sorted Bidict Recipes`.
- ``bidict.compat.{view,iter}{keys,values,items}`` on Python2
no longer assumes the target object implements these methods,
as they're not actually part of the
:class:`~collections.abc.Mapping` interface,
and provides fallback implementations when the methods are unavailable.
This allows the :ref:`extending:Sorted Bidict Recipes`
to continue to work with sortedcontainers v2 on Python2.
- Test code in docs via Sphinx rather than pytest.
Enables running Python version-dependent tests conditionally
rather than skipping them altogether, as well as hiding import
statements (via `testsetup`) that otherwise just add noise.
Run tests (viz. pytest and Sphinx doctest) via a new
run-tests.py script.
- Also refactor and improve hypothesis tests.
- Add a test that ordered bidict nodes have no reference cycles.
- Enable coverage on Travis for PyPy 2 now that there is a code path
that is only taken on PyPy 2 (for FrozenOrderedBidict.iteritems).
- Restore running tests on Travis for all commits, not just for master.
- Docs:
- OrderedBidict: "What if my Python version has order-preserving dicts?"
- Equivalent but distinct Hashables: better code example demonstrating
that this even occurs with a bidict and its own inverse.
- Implement BidirectionalMapping.__subclasshook__ in terms of
Mapping.__subclasshook__ to simplify and correct its implementation.
- Add new test_class_relationships.py tests.
- Import collections ABCs from .compat. Importing them directly from
collections was deprecated and will stop working in Python 3.8.
In Python 2 collections.abc does not exist.
- rename util.py -> _util.py