2323)
2424from branca .utilities import color_brewer
2525
26+ import folium .map
2627from folium .elements import JSCSSMixin
2728from folium .folium import Map
28- from folium .map import FeatureGroup , Icon , Layer , Marker , Popup , Tooltip
2929from folium .template import Template
3030from folium .utilities import (
3131 TypeBoundsReturn ,
4747from folium .vector_layers import Circle , CircleMarker , PolyLine , path_options
4848
4949
50- class RegularPolygonMarker (JSCSSMixin , Marker ):
50+ class RegularPolygonMarker (JSCSSMixin , folium . map . Marker ):
5151 """
5252 Custom markers using the Leaflet Data Vis Framework.
5353
@@ -96,8 +96,8 @@ def __init__(
9696 number_of_sides : int = 4 ,
9797 rotation : int = 0 ,
9898 radius : int = 15 ,
99- popup : Union [Popup , str , None ] = None ,
100- tooltip : Union [Tooltip , str , None ] = None ,
99+ popup : Union [folium . map . Popup , str , None ] = None ,
100+ tooltip : Union [folium . map . Tooltip , str , None ] = None ,
101101 ** kwargs : TypePathOptions ,
102102 ):
103103 super ().__init__ (location , popup = popup , tooltip = tooltip )
@@ -297,7 +297,7 @@ def __init__(
297297 def render (self , ** kwargs ):
298298 """Renders the HTML representation of the element."""
299299 parent = self ._parent
300- if not isinstance (parent , (Figure , Div , Popup )):
300+ if not isinstance (parent , (Figure , Div , folium . map . Popup )):
301301 raise TypeError (
302302 "VegaLite elements can only be added to a Figure, Div, or Popup"
303303 )
@@ -467,7 +467,7 @@ def _embed_vegalite_v1(self, figure: Figure, parent: TypeContainer) -> None:
467467 )
468468
469469
470- class GeoJson (Layer ):
470+ class GeoJson (folium . map . Layer ):
471471 """
472472 Creates a GeoJson object for plotting into a Map.
473473
@@ -675,11 +675,11 @@ def __init__(
675675 control : bool = True ,
676676 show : bool = True ,
677677 smooth_factor : Optional [float ] = None ,
678- tooltip : Union [str , Tooltip , "GeoJsonTooltip" , None ] = None ,
678+ tooltip : Union [str , folium . map . Tooltip , "GeoJsonTooltip" , None ] = None ,
679679 embed : bool = True ,
680680 popup : Optional ["GeoJsonPopup" ] = None ,
681681 zoom_on_click : bool = False ,
682- marker : Union [Circle , CircleMarker , Marker , None ] = None ,
682+ marker : Union [Circle , CircleMarker , folium . map . Marker , None ] = None ,
683683 ** kwargs : Any ,
684684 ):
685685 super ().__init__ (name = name , overlay = overlay , control = control , show = show )
@@ -693,7 +693,7 @@ def __init__(
693693 self .highlight = highlight_function is not None
694694 self .zoom_on_click = zoom_on_click
695695 if marker :
696- if not isinstance (marker , (Circle , CircleMarker , Marker )):
696+ if not isinstance (marker , (Circle , CircleMarker , folium . map . Marker )):
697697 raise TypeError (
698698 "Only Marker, Circle, and CircleMarker are supported as GeoJson marker types."
699699 )
@@ -721,11 +721,11 @@ def __init__(
721721 self .highlight_map : dict = {}
722722 self .feature_identifier = self .find_identifier ()
723723
724- if isinstance (tooltip , (GeoJsonTooltip , Tooltip )):
724+ if isinstance (tooltip , (GeoJsonTooltip , folium . map . Tooltip )):
725725 self .add_child (tooltip )
726726 elif tooltip is not None :
727- self .add_child (Tooltip (tooltip ))
728- if isinstance (popup , (GeoJsonPopup , Popup )):
727+ self .add_child (folium . map . Tooltip (tooltip ))
728+ if isinstance (popup , (GeoJsonPopup , folium . map . Popup )):
729729 self .add_child (popup )
730730
731731 def process_data (self , data : Any ) -> dict :
@@ -916,7 +916,7 @@ def _set_default_key(mapping: TypeStyleMapping) -> None:
916916 del mapping [key_longest ]
917917
918918
919- class TopoJson (JSCSSMixin , Layer ):
919+ class TopoJson (JSCSSMixin , folium . map . Layer ):
920920 """
921921 Creates a TopoJson object for plotting into a Map.
922922
@@ -1011,7 +1011,7 @@ def __init__(
10111011 control : bool = True ,
10121012 show : bool = True ,
10131013 smooth_factor : Optional [float ] = None ,
1014- tooltip : Union [str , Tooltip , None ] = None ,
1014+ tooltip : Union [str , folium . map . Tooltip , None ] = None ,
10151015 ):
10161016 super ().__init__ (name = name , overlay = overlay , control = control , show = show )
10171017 self ._name = "TopoJson"
@@ -1035,10 +1035,10 @@ def __init__(
10351035
10361036 self .smooth_factor = smooth_factor
10371037
1038- if isinstance (tooltip , (GeoJsonTooltip , Tooltip )):
1038+ if isinstance (tooltip , (GeoJsonTooltip , folium . map . Tooltip )):
10391039 self .add_child (tooltip )
10401040 elif tooltip is not None :
1041- self .add_child (Tooltip (tooltip ))
1041+ self .add_child (folium . map . Tooltip (tooltip ))
10421042
10431043 def style_data (self ) -> None :
10441044 """Applies self.style_function to each feature of self.data."""
@@ -1377,7 +1377,7 @@ def __init__(
13771377 self .popup_options = kwargs
13781378
13791379
1380- class Choropleth (FeatureGroup ):
1380+ class Choropleth (folium . map . FeatureGroup ):
13811381 """Apply a GeoJSON overlay to the map.
13821382
13831383 Plot a GeoJSON overlay on the base map. There is no requirement
@@ -1855,7 +1855,7 @@ def __init__(self, format_str: Optional[str] = None, alert: bool = True):
18551855 self .alert = alert
18561856
18571857
1858- class CustomIcon (Icon ):
1858+ class CustomIcon (folium . map . Icon ):
18591859 """
18601860 Create a custom icon, based on an image.
18611861
@@ -1908,7 +1908,7 @@ def __init__(
19081908 shadow_anchor : Optional [Tuple [int , int ]] = None ,
19091909 popup_anchor : Optional [Tuple [int , int ]] = None ,
19101910 ):
1911- super (Icon , self ).__init__ ()
1911+ super (folium . map . Icon , self ).__init__ ()
19121912 self ._name = "CustomIcon"
19131913 self .options = remove_empty (
19141914 icon_url = image_to_url (icon_image ),
@@ -1921,7 +1921,7 @@ def __init__(
19211921 )
19221922
19231923
1924- class ColorLine (FeatureGroup ):
1924+ class ColorLine (folium . map . FeatureGroup ):
19251925 """
19261926 Draw data on a map with specified colors.
19271927
0 commit comments