-
Notifications
You must be signed in to change notification settings - Fork 389
Python: T7740: Update dict_search to return optional default value #4700
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
Conversation
- Update dict_search to return optional default value
👍 |
- Updated tooltip comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Useful extension to dict_search
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've often found myself needing to return a default value when using dict_search, requiring me to use .get() instead, which makes for inconsistent code for ultimately the same function.
I found myself in the same situation but was to biased to find such an easy solution. Thanks! As you already outlined some testcases - please be so kind and extend the build time test suite to cover these as well everytime. Those are run by make test
or make all
during DEB package assembly.
https://github.com/vyos/vyos-1x/blob/current/src/tests/test_dict_search.py
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Requested change addressed
CI integration 👍 passed! Details
|
Change summary
I've often found myself needing to return a default value when using dict_search, requiring me to use
.get()
instead, which makes for inconsistent code for ultimately the same function.Types of changes
Related Task(s)
https://vyos.dev/T7740
Related PR(s)
How to test / Smoketest result
Python Test script:
Results:
Checklist: