deckhand.engine.utils module¶
-
deckhand.engine.utils.deep_delete(target, value, parent)[source]¶ Recursively search for then delete
targetfromparent.Parameters: - target – Target value to remove.
- value – Current value in a list or dict to compare against
targetand removed fromparentgiven match. - parent (list or dict) – Tracks the parent data structure from which
valueis removed.
Returns: Whether
targetwas found.Return type: bool
-
deckhand.engine.utils.deep_merge(dct, merge_dct)[source]¶ Recursive dict merge. Inspired by :meth:
dict.update(), instead of updating only top-level keys, deep_merge recurses down into dicts nested to an arbitrary depth, updating keys. Themerge_dctis merged intodct, except for merge conflicts, which are resolved by prioritizing thedctvalue.Borrowed from: https://gist.github.com/angstwad/bf22d1822c38a92ec0a9#file-deep_merge-py # noqa
Parameters: - dct – dict onto which the merge is executed
- merge_dct – dct merged into dct
Returns: None
-
deckhand.engine.utils.deep_scrub(value, parent)[source]¶ Scrubs all primitives in document data recursively. Useful for scrubbing any and all secret data that may have been substituted into the document data section before logging it out safely following an error.
-
deckhand.engine.utils.exclude_deleted_documents(documents)[source]¶ Excludes all documents that have been deleted including all documents earlier in the revision history with the same
metadata.nameandschemafromdocuments.
-
deckhand.engine.utils.filter_revision_documents(documents, unique_only, **filters)[source]¶ Return the list of documents that match filters.
Parameters: - documents – List of documents to apply
filtersto. - unique_only – Return only unique documents if
True. - filters – Dictionary attributes (including nested) used to filter out revision documents.
Returns: List of documents that match specified filters.
- documents – List of documents to apply