Skip to content

Commit

Permalink
separation of concerns to support targeted override in peppy; pepkit/…
Browse files Browse the repository at this point in the history
  • Loading branch information
vreuter committed Feb 20, 2019
1 parent 6f0c76b commit 5c702b2
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions attmap/_att_map_like.py
Expand Up @@ -103,13 +103,17 @@ def add_entries(self, entries):
except AttributeError:
entries_iter = entries
for k, v in entries_iter:
if k not in self or not (isinstance(v, Mapping) and
isinstance(self[k], AttMapLike)):
if self._ready_to_store(k, v):
self.__setitem__(k, v)
else:
self[k].add_entries(v)
return self

def _ready_to_store(self, k, v):
""" Determine whether given KV pair is ready to be stored. """
return k not in self or not \
(isinstance(v, Mapping) and isinstance(self[k], AttMapLike))

def is_null(self, item):
"""
Conjunction of presence in underlying mapping and value being None
Expand Down

0 comments on commit 5c702b2

Please sign in to comment.