From cf219c1d01193e8d47ac68eeb7f2d4b505b031e8 Mon Sep 17 00:00:00 2001 From: "Chris (Someguy123)" Date: Sun, 1 Dec 2019 03:12:22 +0000 Subject: [PATCH] 2.3.0 (final) New `collections` module + refactoring This is the final version of 2.3.0 (as published to PyPi) - merged from `develop` branch. Includes the following extra commits since original release: - (commit 600cccd2b723) Rename test_tuple to test_collections + add TestDictObject - (commit fa1f4db84c61) Re-factored dictable_namedtuple and related functions for py3.6 / 3.7 compat **Minor updates** - `docs/source/conf.py` now sets `PYTHON_PATH` which helps reduce issues with Sphinx finding the privex package folder - Fleshed out `docs/source/examples.rst` with `DictObject` and `dictable_namedtuple` examples. - Added documentation for `privex.helpers.collections` and `tests.test_collections` - Added `Pipfile` and `Pipfile.lock` for use with `pipenv` during development **Major changes** - Created module `privex.helpers.collections` - `DictObject` - A `dict` sub-class which allows keys to be read/written via attributes (`x.something`) as well as standard item/key notation (`x['something']`) - `MockDictObj` - Same as `DictObject`, but masquerades as the builtin `dict`, potentially allowing it to be used with certain code that expects the builtin dict type - `is_namedtuple` - Boolean function which returns `True` if all passed objects are named tuples - `dictable_namedtuple` - An improved version of the native `collections.namedtuple`, which adds additional functionality such as dict-like key/item access to fields, ability to cast directly to a dict, and ability to add new fields dynamically to an existing instance. - `convert_dictable_namedtuple` - Converts a `namedtuple` type class instance into a `dictable_namedtuple` instance - `subclass_dictable_namedtuple` - Converts a `namedtuple` type/class into a `dictable_namedtuple` type/class - Created unit tests for `is_namedtuple` and `dictable_namedtuple` in `tests/test_collections.py` **BREAKING CHANGES** - `Mocker` has been moved from `privex.helpers.common` into `privex.helpers.collections`. Code which imports via `from privex.helpers.common import Mocker` will no longer work. Code which imports `Mocker` from the shared `privex.helpers` module (i.e. `from privex.helpers import Mocker`) should be unaffected. - `Dictable` has been moved from `privex.helpers.common` into `privex.helpers.collections`. Code which imports via `from privex.helpers.common import Dictable` will no longer work. Code which imports `Dictable` from the shared `privex.helpers` module (i.e. `from privex.helpers import Dictable`) should be unaffected.