Commit Graph

70 Commits

Author SHA1 Message Date
jab 32084a0127 docs 2018-03-27 14:35:52 +07:00
jab 2c031f9cf0 revert back to izip, don't assume pkg_resources available, docs and code tweaks 2018-03-26 20:04:53 +08:00
jab 6912e2c8f9 docs tweaks 2018-03-04 14:16:05 +11:00
jab b73ba3c559 improve namedbidict docstring 2018-03-01 21:31:35 +11:00
jab 629481ec15 improve BidirectionalMapping.__subclasshook__, .compat, .util->._util, docs, tests, lint
- 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
2018-03-01 14:18:39 +11:00
jab bfb6ed2a3b finish refactoring, misc. bugfixes, improve docs + tests 2018-02-28 00:09:57 +11:00
jab 4234bf8ce3 split back out (Ordered)BidictBase classes, improve namedbidict validation, docs 2018-02-27 10:29:56 +11:00
jab c79e4df888 improve sorted bidict recipe docs + doctests 2018-02-20 22:34:47 +11:00
jab 456f247b1d numerous code improvements
- Refactor _dedup_item, _write_item, and _undo_write methods to use
  higher-level abstractions (_DedupResult and _WriteResult classes).
- Add internal _OnDup class to bundle (on_dup_key, on_dup_val, on_dup_kv)
  together into a single abstraction. Signatures of methods like _put and
  _update are cleaner as a result.
- Add the "_NOOP" _DedupResult abstraction.
- Make _Marker extend namedtuple, no need for it to be mutable.
- Enable the pylint messages that were disabled now that the code is cleaner.
- Make DuplicationPolicy extend _Marker and make RAISE, OVERWRITE, and
  IGNORE instances of DuplicationPolicy once again. This time deprecate
  access via DuplicationPolicy.(IGNORE|RAISE|OVERWRITE) to prevent
  infinite chaining.
- Misc. code and docs improvements.
2018-02-20 21:23:04 +11:00
jab 02dcb49329 improve code comments and APIs (give APIs that should be private a leading _) 2018-02-20 00:07:14 +11:00
jab 459f9365cf improve test coverage 2018-02-19 18:53:03 +11:00
jab 4d906b6eca code and documentation improvements
- Use __slots__ to speed up attribute access and decrease memory usage
  (adding _SlotPickleMixin to preserve pickleability)
- "Code review nav" comments
- Remove _clear from frozenbidict, leaving only the public `clear` methods on
  the mutable bidict types. Much clearer now! (ducks)
- Improve `pop` and `popitem` signatures. No need for them to take *args/**kw.
- Make bidict extend MutableMapping directly rather than registering it as a
  virtual subclass. Leave a comment explaining that it inherits
  MutableMapping's setdefault implementation now that it isn't added manually.
- Make the DuplicationPolicy class just a namespace holding
  RAISE, OVERWRITE, and IGNORE, not a _Marker itself.
  Make RAISE, OVERWRITE, and IGNORE just _Markers, not `DuplicationPolicy`s.
- Various other code and docs improvements.
2018-02-19 13:40:01 +11:00
jab 153ce361b3 tiny cosmetic docs tweaks 2018-02-13 23:13:24 +11:00
jab 24b3d9b7dc various improvements
- Make :func:`bidict.FrozenOrderedBidict.__iter__` slightly more efficient.

- :func:`~bidict.frozenbidict.__repr__` no longer dynamically checks
  for a ``__reversed__`` method to determine whether to use an ordered or
  unordered ``__repr__`` delegate. Now it always just calls the new
  :func:`~bidict.frozenbidict.__repr_delegate__` instead, which may be
  explicitly overridden as needed.
2018-02-13 12:34:33 +11:00
jab 256270489a tweak inv-avoids-reference-cycles docs 2018-01-16 19:43:39 -05:00
jab 31acba17ff ditch no longer necessary URLs in linkcheck_ignore
GitHub now gives 302 (rather than 404) for .../fork when not logged in
2018-01-15 22:01:54 -05:00
jab 3187c67078 more learning docs 2018-01-03 15:46:20 -05:00
jab 6223d4d6f0 docs 2018-01-03 13:16:37 -05:00
jab 1a67961423 flesh out "learning from bidict" outline 2018-01-02 19:24:44 -05:00
jab 958ca8570a use more concise :role:`~foo.bar` sphinx link syntax
+ other small docs improvements
2018-01-02 16:49:34 -05:00
jab b991f887c5 fix link to NotImplemented 2018-01-02 15:55:42 -05:00
jab 6f374c7d3c add "learning from bidict" docs 2018-01-02 15:32:06 -05:00
jab d0c6fdae3b happy 2018 2017-12-31 22:51:19 -05:00
jab fc89808af7 docs 2017-12-17 13:58:57 -05:00
jab 50a1042f68 rm outdated caveat about reference cycles 2017-12-07 17:01:36 -05:00
jab fb32b56de1 Fix #24 + other improvements.
- Use weakrefs to refer to a bidict's inverse to no longer create a reference
  cycle. Fixes #24.
- Rename fwd_cls to fwdm_cls.
- Rename inv_cls to invm_cls.
- inv_cls now returns the inverse class of the bidict, not its invm mapping.
- Rename isinv to _isinv.
2017-12-07 12:57:01 -05:00
jab ea93911f93 numerous improvements
- Make initializing (or updating an empty bidict) from only another
  BidirectionalMapping more efficient (skip dup checking).

- Fix accidental ignoring of specified base_type when (un)pickling
  namedbidicts.

- Fix incorrect inversion of some_named_bidict.inv.[fwdname]_for
  and some_named_bidict.inv.[invname]_for

- Only warn when unsupported Python version is detected.

- More tests.
2017-12-06 14:22:32 -05:00
jab 7b4d1df5fb Add pre-commit hooks + changes to appease them 2017-11-21 10:35:56 -05:00
jab 64662b1bc0 travis and docs fixes 2017-11-20 23:07:47 -05:00
jab 51c75d2bb0 another round of refinements
- Make OrderedBidict.__eq__ always order-insensitive.
  Add OrderedBidict.equals_order_sensitive for order-sensitive comparison.
  Drop OrderedBidict.ordered_cls and bidict.compat.Reversible.

- Add test coverage for bidict.metadata.

- Use setuptools_scm for automatic version discovery from source control.
  Drop bidict/VERSION file and associated machinery.

- Ditch testing macOS on Travis, it's just too slow.
  Testing on Linux should suffice.

- Ditch using pyenv on Travis to save time and complexity.
  Travis now has a better set of Python versions available out-of-the-box.

- Add support for "python setup.py test" and use that on Travis.
2017-11-20 22:27:27 -05:00
jab 64ed7278d8
more API and code improvements
including:
- simplify type hierarchy, merging the frozen types into the base types
- upgrade to latest hypothesis (3.38.0)
- use Reversible for order-sensitive FrozenOrderedBidict.__eq__
- fix bug where bidict._on_dup_kv was not set to ON_DUP_VAL as documented
- drop leading underscore from attrs that should be public
- improve setup.py/metadata
- rename DuplicationBehavior -> DuplicationPolicy
- drop ON_DUP_VAL duplication policy in preference to just using None
- reduce ordered bidict memory usage and speed up copy
2017-11-19 22:24:08 -05:00
jab 4b86b57689 docs tweaks 2017-11-17 23:54:56 -05:00
jab 22f4e78d09
numerous fixes and improvements (#43)
- .travis.yml and setup.py tweaks
- add regression tests for -O bug and document fix
- Make OrderedBidict equality comparison order-sensitive in more cases.
- Add bidict.BidictBase.ordered class attribute.
- Replacing OrderedBidictBase._should_compare_order_sensitive()
  with OrderedBidictBase.should_compare_order_sensitive_to().
- Revert the optimizations in v0.13.0 to make FrozenOrderedBidict instances
  that have the same items in different order have different hash values.
- Remove FrozenBidictBase.
- Remove frozenbidict._USE_ITEMSVIEW_HASH and
  frozenorderedbidict._HASH_NITEMS_MAX
2017-11-17 22:35:40 -05:00
jab 033083ca26
various code and CI improvements + dependency updates (#42) 2017-11-16 15:44:51 -05:00
jab 050e61e0f7 update to latest deps; tests + docs improvements 2017-10-11 10:26:22 -04:00
jab 2a47714a21 docs: factor out versioneye prompt from changelog and include in readme too 2017-03-31 14:58:44 -04:00
jab 19f7e9f90a change license to MPLv2 2017-03-15 16:43:05 -04:00
jab 6f5dbd4d5b tweak @knaperek's improvements from #41 + thanks 2017-03-15 15:45:40 -04:00
jab 887e078907 squashed changes for 0.13.0
- support Python 3.6, refactor CI/test setup, increase test coverage
- refactor BidirectionalMapping, BidictBase, OrderedBidictBase,
  FrozenBidictBase, and subclasses
- move frozenorderedbidict into _frozen and looseorderedbidict into _loose
- register bidict as a virtual subclass of MutableMapping rather than
  inheriting from it directly. This makes it clearer that it does not use any
  of the concrete generic methods that MutableMapping provides.
- improve performance and flexibility of frozenbidict and
  frozenorderedbidict hashing
- docs, including new type-hierarchy.png diagram
- rm unused imap, ifilter, izip_longest from compat, add PYPY
- update to latest versions of dependencies
- restore benchmarking on travis
2017-01-09 10:37:31 -05:00
jab b7815c5318 deps, docs linking fixes/improvements, skip benchmarking for now 2016-12-06 18:09:45 -05:00
jab 4b42d8dd3e pull out new "order matters" subsection of docs 2016-07-03 18:12:58 -04:00
jab c2fcc2be11 document effects of ordering on overwriting 2016-07-03 17:36:26 -04:00
jab 79228b78e3 squashed changes for 0.12.0 2016-06-28 00:05:23 -04:00
jab 2ec1bba8a7 bump version to 0.11.1.dev post-release
[ci skip]
2016-02-05 22:34:35 -05:00
jab 35d0e6bc78 prepare for 0.11.0 release 2016-02-05 22:27:30 -05:00
jab c4ae97dd8b several improvements to test setup
- use latest patch releases of all python versions via pyenv
- use caching to speed up travis builds
- peg to latest versions of test deps (including hypothesis 2.0)
- set hypothesis to strict
- explicitly set average_size on strategies that accept it
- drop pypy3, not worth supporting till it catches up to cpython
- only pass --cov for python27 and 35; with other versions, it slows down
  hypothesis data generation so much, the health checks fail
- refactor tox and travis setup to use new test.sh helper script
2016-01-26 19:28:43 -05:00
jab b1bff55987 tweak badges (including adding requires.io badge) 2016-01-13 11:52:26 -05:00
jab 2633febeaf adopt open code of conduct 2016-01-11 22:42:39 -05:00
jab 67c4d4ca77 happy 2016 2016-01-03 14:30:30 -05:00
jab 27160477ad add support for ordered bidict types 2015-12-25 14:13:03 -05:00