3434)
3535from branca .utilities import color_brewer
3636
37+ import folium .map
3738from folium .elements import JSCSSMixin
3839from folium .folium import Map
39- from folium .map import FeatureGroup , Icon , Layer , Marker , Popup , Tooltip
4040from folium .template import Template
4141from folium .utilities import (
4242 JsCode ,
6060from folium .vector_layers import Circle , CircleMarker , PolyLine , path_options
6161
6262
63- class RegularPolygonMarker (JSCSSMixin , Marker ):
63+ class RegularPolygonMarker (JSCSSMixin , folium . map . Marker ):
6464 """
6565 Custom markers using the Leaflet Data Vis Framework.
6666
@@ -109,8 +109,8 @@ def __init__(
109109 number_of_sides : int = 4 ,
110110 rotation : int = 0 ,
111111 radius : int = 15 ,
112- popup : Union [Popup , str , None ] = None ,
113- tooltip : Union [Tooltip , str , None ] = None ,
112+ popup : Union [folium . map . Popup , str , None ] = None ,
113+ tooltip : Union [folium . map . Tooltip , str , None ] = None ,
114114 ** kwargs : TypePathOptions ,
115115 ):
116116 super ().__init__ (location , popup = popup , tooltip = tooltip )
@@ -310,7 +310,7 @@ def __init__(
310310 def render (self , ** kwargs ):
311311 """Renders the HTML representation of the element."""
312312 parent = self ._parent
313- if not isinstance (parent , (Figure , Div , Popup )):
313+ if not isinstance (parent , (Figure , Div , folium . map . Popup )):
314314 raise TypeError (
315315 "VegaLite elements can only be added to a Figure, Div, or Popup"
316316 )
@@ -480,7 +480,7 @@ def _embed_vegalite_v1(self, figure: Figure, parent: TypeContainer) -> None:
480480 )
481481
482482
483- class GeoJson (Layer ):
483+ class GeoJson (folium . map . Layer ):
484484 """
485485 Creates a GeoJson object for plotting into a Map.
486486
@@ -696,12 +696,12 @@ def __init__(
696696 control : bool = True ,
697697 show : bool = True ,
698698 smooth_factor : Optional [float ] = None ,
699- tooltip : Union [str , Tooltip , "GeoJsonTooltip" , None ] = None ,
699+ tooltip : Union [str , folium . map . Tooltip , "GeoJsonTooltip" , None ] = None ,
700700 embed : bool = True ,
701701 popup : Optional ["GeoJsonPopup" ] = None ,
702702 zoom_on_click : bool = False ,
703703 on_each_feature : Optional [JsCode ] = None ,
704- marker : Union [Circle , CircleMarker , Marker , None ] = None ,
704+ marker : Union [Circle , CircleMarker , folium . map . Marker , None ] = None ,
705705 ** kwargs : Any ,
706706 ):
707707 super ().__init__ (name = name , overlay = overlay , control = control , show = show )
@@ -715,7 +715,7 @@ def __init__(
715715 self .highlight = highlight_function is not None
716716 self .zoom_on_click = zoom_on_click
717717 if marker :
718- if not isinstance (marker , (Circle , CircleMarker , Marker )):
718+ if not isinstance (marker , (Circle , CircleMarker , folium . map . Marker )):
719719 raise TypeError (
720720 "Only Marker, Circle, and CircleMarker are supported as GeoJson marker types."
721721 )
@@ -744,11 +744,11 @@ def __init__(
744744 self .highlight_map : dict = {}
745745 self .feature_identifier = self .find_identifier ()
746746
747- if isinstance (tooltip , (GeoJsonTooltip , Tooltip )):
747+ if isinstance (tooltip , (GeoJsonTooltip , folium . map . Tooltip )):
748748 self .add_child (tooltip )
749749 elif tooltip is not None :
750- self .add_child (Tooltip (tooltip ))
751- if isinstance (popup , (GeoJsonPopup , Popup )):
750+ self .add_child (folium . map . Tooltip (tooltip ))
751+ if isinstance (popup , (GeoJsonPopup , folium . map . Popup )):
752752 self .add_child (popup )
753753
754754 def process_data (self , data : Any ) -> dict :
@@ -939,7 +939,7 @@ def _set_default_key(mapping: TypeStyleMapping) -> None:
939939 del mapping [key_longest ]
940940
941941
942- class TopoJson (JSCSSMixin , Layer ):
942+ class TopoJson (JSCSSMixin , folium . map . Layer ):
943943 """
944944 Creates a TopoJson object for plotting into a Map.
945945
@@ -1034,7 +1034,7 @@ def __init__(
10341034 control : bool = True ,
10351035 show : bool = True ,
10361036 smooth_factor : Optional [float ] = None ,
1037- tooltip : Union [str , Tooltip , None ] = None ,
1037+ tooltip : Union [str , folium . map . Tooltip , None ] = None ,
10381038 ):
10391039 super ().__init__ (name = name , overlay = overlay , control = control , show = show )
10401040 self ._name = "TopoJson"
@@ -1058,10 +1058,10 @@ def __init__(
10581058
10591059 self .smooth_factor = smooth_factor
10601060
1061- if isinstance (tooltip , (GeoJsonTooltip , Tooltip )):
1061+ if isinstance (tooltip , (GeoJsonTooltip , folium . map . Tooltip )):
10621062 self .add_child (tooltip )
10631063 elif tooltip is not None :
1064- self .add_child (Tooltip (tooltip ))
1064+ self .add_child (folium . map . Tooltip (tooltip ))
10651065
10661066 def style_data (self ) -> None :
10671067 """Applies self.style_function to each feature of self.data."""
@@ -1408,7 +1408,7 @@ def __init__(
14081408 self .popup_options = kwargs
14091409
14101410
1411- class Choropleth (FeatureGroup ):
1411+ class Choropleth (folium . map . FeatureGroup ):
14121412 """Apply a GeoJSON overlay to the map.
14131413
14141414 Plot a GeoJSON overlay on the base map. There is no requirement
@@ -1886,7 +1886,7 @@ def __init__(self, format_str: Optional[str] = None, alert: bool = True):
18861886 self .alert = alert
18871887
18881888
1889- class CustomIcon (Icon ):
1889+ class CustomIcon (folium . map . Icon ):
18901890 """
18911891 Create a custom icon, based on an image.
18921892
@@ -1939,7 +1939,7 @@ def __init__(
19391939 shadow_anchor : Optional [Tuple [int , int ]] = None ,
19401940 popup_anchor : Optional [Tuple [int , int ]] = None ,
19411941 ):
1942- super (Icon , self ).__init__ ()
1942+ super (folium . map . Icon , self ).__init__ ()
19431943 self ._name = "CustomIcon"
19441944 self .options = remove_empty (
19451945 icon_url = image_to_url (icon_image ),
@@ -1952,7 +1952,7 @@ def __init__(
19521952 )
19531953
19541954
1955- class ColorLine (FeatureGroup ):
1955+ class ColorLine (folium . map . FeatureGroup ):
19561956 """
19571957 Draw data on a map with specified colors.
19581958
0 commit comments