Skip to content

Commit c8b17e7

Browse files
committed
fix: resolve pre-commit issues
1 parent bcd5948 commit c8b17e7

File tree

3 files changed

+47
-28
lines changed

3 files changed

+47
-28
lines changed

docs/user_guide/plugins/overlapping_marker_spiderfier.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,3 @@ oms.add_to(m)
2727
2828
m
2929
```
30-

folium/plugins/overlapping_marker_spiderfier.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,20 @@
11
from jinja2 import Template
2+
23
from folium.elements import JSCSSMixin, MacroElement
34
from folium.utilities import parse_options
45

6+
57
class OverlappingMarkerSpiderfier(JSCSSMixin, MacroElement):
68
"""
79
A plugin that handles overlapping markers on a map by spreading them out in a spiral or circle pattern when clicked.
8-
10+
911
This plugin is useful when you have multiple markers in close proximity that would otherwise be difficult to interact with.
10-
When a user clicks on a cluster of overlapping markers, they spread out in a 'spider' pattern, making each marker
12+
When a user clicks on a cluster of overlapping markers, they spread out in a 'spider' pattern, making each marker
1113
individually accessible.
1214
13-
Markers must be added to the map **before** calling `oms.add_to(map)`.
15+
Markers must be added to the map **before** calling `oms.add_to(map)`.
1416
The plugin identifies and manages all markers already present on the map.
15-
17+
1618
Parameters
1719
----------
1820
options : dict, optional
@@ -25,16 +27,15 @@ class OverlappingMarkerSpiderfier(JSCSSMixin, MacroElement):
2527
Weight of the spider legs
2628
- circleSpiralSwitchover : int, optional
2729
Number of markers at which to switch from circle to spiral pattern
28-
30+
2931
Example
3032
-------
31-
>>> oms = OverlappingMarkerSpiderfier(options={
32-
... "keepSpiderfied": True,
33-
... "nearbyDistance": 30,
34-
... "legWeight": 2.0
35-
... })
33+
>>> oms = OverlappingMarkerSpiderfier(
34+
... options={"keepSpiderfied": True, "nearbyDistance": 30, "legWeight": 2.0}
35+
... )
3636
>>> oms.add_to(map)
3737
"""
38+
3839
_template = Template(
3940
"""
4041
{% macro script(this, kwargs) %}

tests/plugins/test_overlapping_marker_spiderfier.py

Lines changed: 36 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def test_oms_js_inclusion():
1515
Test that the OverlappingMarkerSpiderfier JavaScript library is included in the map.
1616
"""
1717
m = Map([45.05, 3.05], zoom_start=14)
18-
oms = OverlappingMarkerSpiderfier().add_to(m)
18+
OverlappingMarkerSpiderfier().add_to(m)
1919

2020
rendered_map = m._parent.render()
2121
assert (
@@ -38,16 +38,20 @@ def test_marker_addition():
3838
).T
3939

4040
m = Map([45.05, 3.05], zoom_start=14)
41-
markers = [Marker(location=loc, popup=f"Marker {
42-
i}") for i, loc in enumerate(data)]
41+
markers = [
42+
Marker(
43+
location=loc,
44+
popup=f"Marker {i}",
45+
)
46+
for i, loc in enumerate(data)
47+
]
4348

4449
for marker in markers:
4550
marker.add_to(m)
4651

47-
assert len(m._children) == len(markers) + 1, (
48-
f"Expected {len(markers)} markers on the map, but found {
49-
len(m._children) - 1}."
50-
)
52+
assert (
53+
len(m._children) == len(markers) + 1
54+
), f"Expected {len(markers)} markers, found {len(m._children) - 1}."
5155

5256

5357
def test_map_bounds():
@@ -64,8 +68,14 @@ def test_map_bounds():
6468
).T
6569

6670
m = Map([45.05, 3.05], zoom_start=14)
67-
markers = [Marker(location=loc, popup=f"Marker {
68-
i}") for i, loc in enumerate(data)]
71+
markers = [
72+
Marker(
73+
location=loc,
74+
popup=f"Marker {
75+
i}",
76+
)
77+
for i, loc in enumerate(data)
78+
]
6979

7080
for marker in markers:
7181
marker.add_to(m)
@@ -76,10 +86,18 @@ def test_map_bounds():
7686
min_lat, min_lon = data.min(axis=0)
7787
max_lat, max_lon = data.max(axis=0)
7888

79-
assert bounds[0][0] <= min_lat, "Map bounds do not correctly include the minimum latitude."
80-
assert bounds[0][1] <= min_lon, "Map bounds do not correctly include the minimum longitude."
81-
assert bounds[1][0] >= max_lat, "Map bounds do not correctly include the maximum latitude."
82-
assert bounds[1][1] >= max_lon, "Map bounds do not correctly include the maximum longitude."
89+
assert (
90+
bounds[0][0] <= min_lat
91+
), "Map bounds do not correctly include the minimum latitude."
92+
assert (
93+
bounds[0][1] <= min_lon
94+
), "Map bounds do not correctly include the minimum longitude."
95+
assert (
96+
bounds[1][0] >= max_lat
97+
), "Map bounds do not correctly include the maximum latitude."
98+
assert (
99+
bounds[1][1] >= max_lon
100+
), "Map bounds do not correctly include the maximum longitude."
83101

84102

85103
def test_overlapping_marker_spiderfier_integration():
@@ -88,9 +106,10 @@ def test_overlapping_marker_spiderfier_integration():
88106
"""
89107
m = Map([45.05, 3.05], zoom_start=14)
90108
oms = OverlappingMarkerSpiderfier(
91-
options={"keepSpiderfied": True, "nearbyDistance": 20})
109+
options={"keepSpiderfied": True, "nearbyDistance": 20}
110+
)
92111
oms.add_to(m)
93112

94-
assert oms.get_name() in m._children, (
95-
f"OverlappingMarkerSpiderfier is not correctly added to the map."
96-
)
113+
assert (
114+
oms.get_name() in m._children
115+
), "OverlappingMarkerSpiderfier is not correctly added to the map."

0 commit comments

Comments
 (0)