77from jinja2 import Template
88
99from folium .map import Marker , Popup , Tooltip
10- from folium .utilities import get_bounds , validate_locations
10+ from folium .utilities import camelize , get_bounds , validate_locations
1111
1212
1313def path_options (line = False , radius = False , ** kwargs ):
@@ -59,21 +59,25 @@ def path_options(line=False, radius=False, **kwargs):
5959
6060 Note that the presence of `fill_color` will override `fill=False`.
6161
62+ This function accepts both snake_case and lowerCamelCase equivalents.
63+
6264 See https://leafletjs.com/reference.html#path
6365
6466 """
6567
68+ kwargs = {camelize (key ): value for key , value in kwargs .items ()}
69+
6670 extra_options = {}
6771 if line :
6872 extra_options = {
69- "smoothFactor" : kwargs .pop ("smooth_factor " , 1.0 ),
70- "noClip" : kwargs .pop ("no_clip " , False ),
73+ "smoothFactor" : kwargs .pop ("smoothFactor " , 1.0 ),
74+ "noClip" : kwargs .pop ("noClip " , False ),
7175 }
7276 if radius :
7377 extra_options .update ({"radius" : radius })
7478
7579 color = kwargs .pop ("color" , "#3388ff" )
76- fill_color = kwargs .pop ("fill_color " , False )
80+ fill_color = kwargs .pop ("fillColor " , False )
7781 if fill_color :
7882 fill = True
7983 elif not fill_color :
@@ -89,15 +93,15 @@ def path_options(line=False, radius=False, **kwargs):
8993 "color" : color ,
9094 "weight" : kwargs .pop ("weight" , 3 ),
9195 "opacity" : kwargs .pop ("opacity" , 1.0 ),
92- "lineCap" : kwargs .pop ("line_cap " , "round" ),
93- "lineJoin" : kwargs .pop ("line_join " , "round" ),
94- "dashArray" : kwargs .pop ("dash_array " , None ),
95- "dashOffset" : kwargs .pop ("dash_offset " , None ),
96+ "lineCap" : kwargs .pop ("lineCap " , "round" ),
97+ "lineJoin" : kwargs .pop ("lineJoin " , "round" ),
98+ "dashArray" : kwargs .pop ("dashArray " , None ),
99+ "dashOffset" : kwargs .pop ("dashOffset " , None ),
96100 "fill" : fill ,
97101 "fillColor" : fill_color ,
98- "fillOpacity" : kwargs .pop ("fill_opacity " , 0.2 ),
99- "fillRule" : kwargs .pop ("fill_rule " , "evenodd" ),
100- "bubblingMouseEvents" : kwargs .pop ("bubbling_mouse_events " , True ),
102+ "fillOpacity" : kwargs .pop ("fillOpacity " , 0.2 ),
103+ "fillRule" : kwargs .pop ("fillRule " , "evenodd" ),
104+ "bubblingMouseEvents" : kwargs .pop ("bubblingMouseEvents " , True ),
101105 }
102106 default .update (extra_options )
103107 return default
0 commit comments