Skip to content
Permalink
Browse files

Merge pull request pepkit#63 from pepkit/dev

0.12.7
  • Loading branch information...
vreuter committed Jun 24, 2019
2 parents 9469c9d + a597e7e commit ca2eb3af7ea745482b42cf31383392045d90e166
Showing with 9 additions and 6 deletions.
  1. +1 −1 attmap/_version.py
  2. +1 −3 attmap/attmap.py
  3. +3 −2 attmap/ordattmap.py
  4. +4 −0 docs/changelog.md
@@ -1 +1 @@
__version__ = "0.12.6"
__version__ = "0.12.7"
@@ -31,15 +31,13 @@ def __delitem__(self, key):
def __getitem__(self, item):
return self.__dict__[item]

def __setitem__(self, key, value, finalize=True):
def __setitem__(self, key, value):
"""
This is the key to making this a unique data type.
:param str key: name of the key/attribute for which to establish value
:param object value: value to which set the given key; if the value is
a mapping-like object, other keys' values may be combined.
:param bool finalize: whether to attempt a transformation of the value
to store before storing it
"""
# TODO: consider enforcement of type constraint, that value of different
# type may not overwrite existing.
@@ -39,9 +39,10 @@ def __getitem__(self, item):
except KeyError:
return AttMap.__getitem__(self, item)

def __setitem__(self, key, value):
def __setitem__(self, key, value, finalize=True):
""" Support hook for value transformation before storage. """
super(OrdAttMap, self).__setitem__(key, self._final_for_store(key, value))
super(OrdAttMap, self).__setitem__(
key, self._final_for_store(key, value) if finalize else value)

def __delitem__(self, key):
""" Make unmapped key deletion unexceptional. """
@@ -1,5 +1,9 @@
# Changelog

## [0.12.7] - 2019-06-25
### Added
- Hook for calling value finalization in signature for `OrdAttMap`'s `__setitem__` implementation

## [0.12.6] - 2019-06-24
### Added
- Hook in value storage finalization for use of the key, not just the value

0 comments on commit ca2eb3a

Please sign in to comment.
You can’t perform that action at this time.