-
Notifications
You must be signed in to change notification settings - Fork 64
add custom dict camelize logic #246
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
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: dalthecow <[email protected]>
🎉 Live Preview: Click here to view the live version |
Signed-off-by: dalthecow <[email protected]>
|
||
for key_pair in updated_key_pairs: | ||
old_key, updated_key = key_pair | ||
d[updated_key] = d[old_key] |
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.
Small nit. Might want to throw an exception here in the case that updated_key
already exists. Could save a bunch of debugging time later.
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.
Isn't this handled by line 13 where we prevent any addition to updated_key_pairs if the old key and updated key are the same? So it is impossible for updated_key_pairs to contain anything but updated keys I would say.
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.
Also sort of a sidenote but it will be pretty common for keys to already exist in the case of a camelizing function being the update function, since for example benchmarks
would not require any updating and that is an expected behavior that we don't need to update every key if it is already the same as the updated version
This removes reliance on the library pyhumps converting dicts keys from snake_case to camelCase for use in the UI