in src/rpdk/core/contract/resource_client.py [0:0]
def prune_properties(document, paths):
"""Prune given properties from a document.
This assumes properties will always have an object (dict) as a parent.
The function modifies the document in-place, but also returns the document
for convenience. (The return value may be ignored.)
"""
for path in paths:
# if '*' is in path, we need to prune more than one property (prune property for all members of array)
if UNPACK_SEQUENCE_IDENTIFIER in path:
document = _prune_properties_for_all_sequence_members(document, path)
continue
try:
_prop, resolved_path, parent = traverse(document, path)
except LookupError:
# not found means nothing to delete
LOG.info(LOOKUP_ERROR_MESSAGE_FORMAT, document, path)
else:
key = resolved_path[-1]
del parent[key]
return document