flatten
flatten copied to clipboard
Add ignore_key_func
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
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: