vector layers: allow both snake_case and lowerCamelCase options #1672
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #1452
In folium we use PEP8, which means function arguments and variables are in snake_case notation. This can be confusing when users look up path options from Leaflet for vector type layers, which use lowerCamelCase notation. We refer to these options in multiple places, for example here:
folium/folium/vector_layers.py
Lines 152 to 153 in 5b079fb
Address this by allowing both snake_case as lowerCamelCase notation for vector path options. Implement this by converting the function arguments directly to lowerCamelCase within the
path_options
function. This way, both notation styles are merged into one: lowerCamelCase. Which is also the notation used in the output of this function.Note that the
parse_options
function we use in other places already has this dual behavior currently.Since we are sticking with PEP8 we don't have to broadcast this in every piece of documentation, but it should prevent more issue reports on this topic.