flatten icon indicating copy to clipboard operation
flatten copied to clipboard

Add ignore_key_func

Open jinoobaek-qz opened this issue 5 years ago • 1 comments

Summary

This PR intends to add the functionality to ignore any key within any depth of the hierarchy via passing a callable that returns a boolean to determine whether it should ignore a key or not.

The specific use-case that I have here is to ignore all keys that start with a specific substring. However, I wanted to leave enough room to allow different types of behavior e.g. prefix, suffix, whole string, and/or containment check.

Bug Fixes/New Features

  • Ignore key at any level of the dictionary hierarchy

How to Verify

Added a new unit test. All unit tests should pass.

Side Effects

Should not have any side effects to existing call behaviors.

Resolves

None

Tests

Added test_keys_to_ignore Augmented test_flatten_ignore_keys (to catch converse behavior)

Code Reviewer(s)

@amirziai

jinoobaek-qz avatar Jan 29 '20 07:01 jinoobaek-qz

Hello @jinoobaek-qz! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

There are currently no PEP 8 issues detected in this Pull Request. Cheers! :beers:

Comment last updated at 2020-01-29 07:15:28 UTC

pep8speaks avatar Jan 29 '20 07:01 pep8speaks