<s> """<STR_LIT>""" <EOL> import json <EOL> from jinja2 import Template <EOL> from branca . element import MacroElement , Figure , JavascriptLink , CssLink <EOL> from branca . utilities import none_min , none_max , iter_points <EOL> class TimestampedGeoJson ( MacroElement ) : <EOL> def __init__ ( self , data , transition_time = <NUM_LIT:200> , loop = True , auto_play = True , <EOL> period = "<STR_LIT>" ) : <EOL> """<STR_LIT>""" <EOL> super ( TimestampedGeoJson , self ) . __init__ ( ) <EOL> self . _name = '<STR_LIT>' <EOL> if '<STR_LIT>' in dir ( data ) : <EOL> self . embed = True <EOL> self . data = data . read ( ) <EOL> elif type ( data ) is dict : <EOL> self . embed = True <EOL> self . data = json . dumps ( data ) <EOL> else : <EOL> self . embed = False <EOL> self . data = data <EOL> self . transition_time = int ( transition_time ) <EOL> self . loop = bool ( loop ) <EOL> self . auto_play = bool ( auto_play ) <EOL> self . period = period <EOL> self . _template = Template ( """<STR_LIT>""" ) <EOL> def render ( self , ** kwargs ) : <EOL> super ( TimestampedGeoJson , 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> figure . header . add_children ( <EOL> JavascriptLink ( "<STR_LIT>" ) , <EOL> name = '<STR_LIT>' ) <EOL> figure . header . add_children ( <EOL> JavascriptLink ( "<STR_LIT>" ) , <EOL> name = '<STR_LIT>' ) <EOL> figure . header . add_children ( <EOL> JavascriptLink ( "<STR_LIT>" ) , <EOL> name = '<STR_LIT>' ) <EOL> figure . header . add_children ( <EOL> CssLink ( "<STR_LIT>" ) , <EOL> name = '<STR_LIT>' ) <EOL> figure . header . add_children ( <EOL> CssLink ( "<STR_LIT>" ) , <EOL> name = '<STR_LIT>' ) <EOL> def _get_self_bounds ( self ) : <EOL> """<STR_LIT>""" <EOL> if not self . embed : <EOL> raise ValueError ( '<STR_LIT>' ) <EOL> data = json . loads ( self . data ) <EOL> if '<STR_LIT>' not in data . keys ( ) : <EOL> if not ( isinstance ( data , dict ) and '<STR_LIT>' in data . keys ( ) ) : <EOL> data = { '<STR_LIT:type>' : '<STR_LIT>' , '<STR_LIT>' : data } <EOL> data = { '<STR_LIT:type>' : '<STR_LIT>' , '<STR_LIT>' : [ data ] } <EOL> bounds = [ [ None , None ] , [ None , None ] ] <EOL> for feature in data [ '<STR_LIT>' ] : <EOL> for point in iter_points ( feature . get ( '<STR_LIT>' , { } ) . get ( '<STR_LIT>' , { } ) ) : <EOL> bounds = [ <EOL> [ <EOL> none_min ( bounds [ <NUM_LIT:0> ] [ <NUM_LIT:0> ] , point [ <NUM_LIT:1> ] ) , <EOL> none_min ( bounds [ <NUM_LIT:0> ] [ <NUM_LIT:1> ] , point [ <NUM_LIT:0> ] ) , <EOL> ] , <EOL> [ <EOL> none_max ( bounds [ <NUM_LIT:1> ] [ <NUM_LIT:0> ] , point [ <NUM_LIT:1> ] ) , <EOL> none_max ( bounds [ <NUM_LIT:1> ] [ <NUM_LIT:1> ] , point [ <NUM_LIT:0> ] ) , <EOL> ] , <EOL> ] <EOL> return bounds </s>
