deckhand.engine.utils module¶
-
deckhand.engine.utils.
deep_delete
(target, value, parent)[source]¶ Recursively search for then delete
target
fromparent
.Parameters: - target – Target value to remove.
- value – Current value in a list or dict to compare against
target
and removed fromparent
given match. - parent (list or dict) – Tracks the parent data structure from which
value
is removed.
Returns: Whether
target
was 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_dct
is merged intodct
, except for merge conflicts, which are resolved by prioritizing thedct
value.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.name
andschema
fromdocuments
.
-
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
filters
to. - 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