Commit Graph

21 Commits

Author SHA1 Message Date
Joshua Bronson e7e456e885 Minor docs improvements 2022-02-16 12:24:19 -05:00
Joshua Bronson 2bee83b0d6 OrderedBidict pickling + minor code improvements
- 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.
2022-02-16 10:38:37 -05:00
Joshua Bronson 03d6cbc118 Compute inverse lazily, automatically add or remove __reversed__ implementations for BidictBase subclasses based on whether their backing mappings are reversible, improve mechanism for automatic dynamic generation of inverse bidict classes and use this for namedbidict, improve pickling. 2022-02-06 12:28:12 -05:00
Joshua Bronson 6be66a1e0b Refactor for better performance, code quality, and maintainability. 2022-02-02 14:58:06 -05:00
Joshua Bronson 5dc6d98381 Redesign OrderedBidict for better performance and code reuse. 2022-01-31 16:45:46 -05:00
Joshua Bronson 21beb84bf0 upgrade dependencies 2021-07-08 20:01:33 -04:00
Joshua Bronson 3ab6bc10fd Upgrade dependencies.
astroid upgrade requires adding two new ignores to .pylintrc.
2021-04-18 11:20:42 -04:00
Joshua Bronson c1a7612f64 Re-enable pylint, improve deps, tox, + GHA config. 2021-03-24 18:32:09 -04:00
Joshua Bronson 0ad5284f75 Finish first pass at adding type hints.
Fixes #93.
2020-08-12 10:22:25 -04:00
Joshua Bronson 01460c86a3 reduce noisy pylint comments 2020-08-01 09:44:24 -04:00
Joshua Bronson e62d85d933 Begin adding type hints, drop Python 3.5, rm bidict.compat 2020-08-01 09:31:15 -04:00
Joshua Bronson 2efdc0e7b8 Upgrade dependencies for various extras, precommit hooks, CI
Use a single job that runs all precommit hooks in CI
rather than separate jobs for flake8, pylint, pydocstyle, etc.
2020-07-29 21:59:45 -04:00
jab 5f9cab9acf drop Py3.4 from Travis, update to latest flake8 + pydocstyle, improve lint_src spelling 2019-01-30 23:53:50 -05:00
jab 2aebc46d96 Decrease hypothesis max_examples for daily Travis cron builds
...and suppress the "too_slow" health check for cron and coverage-
enabled builds since it recently started to fail intermittently.
2018-09-09 17:54:56 -04:00
jab 20e1c18af1 update to latest pylint (2.0.0) and appease it 2018-07-16 20:26:36 -04:00
jab 163667d5b4 optimize implementations of keys, values, and items
- 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.
2018-04-25 21:34:27 +07:00
jab aa704b3d6e improve hypothesis tests, use of setuptools_scm and linting 2018-02-26 10:44:21 +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 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 7fbc19090a appease latest pylint 2017-12-17 13:22:42 -05:00
jab 033083ca26
various code and CI improvements + dependency updates (#42) 2017-11-16 15:44:51 -05:00