2.3.0 - 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 600cccd) Rename test_tuple to test_collections + add TestDictObject
-
(commit fa1f4db) Re-factored dictable_namedtuple and related functions for py3.6 / 3.7 compat
Minor updates
-
docs/source/conf.py
now setsPYTHON_PATH
which helps reduce issues with Sphinx
finding the privex package folder -
Fleshed out
docs/source/examples.rst
withDictObject
anddictable_namedtuple
examples. -
Added documentation for
privex.helpers.collections
andtests.test_collections
-
Added
Pipfile
andPipfile.lock
for use withpipenv
during development
Major changes
-
Created module
privex.helpers.collections
-
DictObject
- Adict
sub-class which allows keys to be read/written via
attributes (x.something
) as well as standard item/key notation (x['something']
) -
MockDictObj
- Same asDictObject
, but masquerades as the builtindict
, potentially
allowing it to be used with certain code that expects the builtin dict type -
is_namedtuple
- Boolean function which returnsTrue
if all passed objects are named tuples -
dictable_namedtuple
- An improved version of the nativecollections.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 anamedtuple
type class instance into adictable_namedtuple
instance -
subclass_dictable_namedtuple
- Converts anamedtuple
type/class into adictable_namedtuple
type/class
-
-
Created unit tests for
is_namedtuple
anddictable_namedtuple
intests/test_collections.py
BREAKING CHANGES
-
Mocker
has been moved fromprivex.helpers.common
intoprivex.helpers.collections
.
Code which imports viafrom privex.helpers.common import Mocker
will no longer work.
Code which importsMocker
from the sharedprivex.helpers
module (i.e.from privex.helpers import Mocker
)
should be unaffected. -
Dictable
has been moved fromprivex.helpers.common
intoprivex.helpers.collections
.
Code which imports viafrom privex.helpers.common import Dictable
will no longer work.
Code which importsDictable
from the sharedprivex.helpers
module (i.e.from privex.helpers import Dictable
)
should be unaffected.