Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ignore_key_func #63

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

jinoobaek-qz
Copy link

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

@pep8speaks
Copy link

pep8speaks commented Jan 29, 2020

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! 🍻

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

@jinoobaek-qz jinoobaek-qz requested a review from amirziai January 29, 2020 07:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants