<s> """<STR_LIT>""" <EOL> import json <EOL> from jinja2 import Template <EOL> from branca . element import JavascriptLink , Figure <EOL> from branca . utilities import none_min , none_max <EOL> from folium . map import TileLayer <EOL> class HeatMap ( TileLayer ) : <EOL> def __init__ ( self , data , name = None , min_opacity = <NUM_LIT:0.5> , max_zoom = <NUM_LIT> , <EOL> max_val = <NUM_LIT:1.0> , radius = <NUM_LIT> , blur = <NUM_LIT:15> , gradient = None , overlay = True ) : <EOL> """<STR_LIT>""" <EOL> super ( TileLayer , self ) . __init__ ( name = name ) <EOL> self . _name = '<STR_LIT>' <EOL> self . tile_name = name if name is not None else self . get_name ( ) <EOL> self . data = [ [ x for x in line ] for line in data ] <EOL> self . min_opacity = min_opacity <EOL> self . max_zoom = max_zoom <EOL> self . max_val = max_val <EOL> self . radius = radius <EOL> self . blur = blur <EOL> self . gradient = ( json . dumps ( gradient , sort_keys = True ) if <EOL> gradient is not None else "<STR_LIT:null>" ) <EOL> self . overlay = overlay <EOL> self . _template = Template ( u"""<STR_LIT>""" ) <EOL> def render ( self , ** kwargs ) : <EOL> super ( TileLayer , self ) . render ( ) <EOL> figure = self . get_root ( ) <EOL> assert isinstance ( figure , Figure ) , ( "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> figure . header . add_children ( <EOL> JavascriptLink ( "<STR_LIT>" ) , <EOL> name = '<STR_LIT>' ) <EOL> def _get_self_bounds ( self ) : <EOL> """<STR_LIT>""" <EOL> bounds = [ [ None , None ] , [ None , None ] ] <EOL> for point in self . data : <EOL> bounds = [ <EOL> [ <EOL> none_min ( bounds [ <NUM_LIT:0> ] [ <NUM_LIT:0> ] , point [ <NUM_LIT:0> ] ) , <EOL> none_min ( bounds [ <NUM_LIT:0> ] [ <NUM_LIT:1> ] , point [ <NUM_LIT:1> ] ) , <EOL> ] , <EOL> [ <EOL> none_max ( bounds [ <NUM_LIT:1> ] [ <NUM_LIT:0> ] , point [ <NUM_LIT:0> ] ) , <EOL> none_max ( bounds [ <NUM_LIT:1> ] [ <NUM_LIT:1> ] , point [ <NUM_LIT:1> ] ) , <EOL> ] , <EOL> ] <EOL> return bounds </s>
