157def update_text_select(attr, old, new):
158 """Function that updates the selected plot according to the name text provided."""
159 global current_selection
160 logger.info("Current Selection: {}".format(current_selection))161 input_text = select_input.value
162 # without fuzzy match, the new station is equal to the current station
163 if input_text == current_selection[0]:
199def update_map_select(attr, old, new):
200 """Function that updates the selected plot according to selection on map."""
201 global current_selection
202 logger.info("Current Selection: {}".format(current_selection))203 # if map_select is True and indx != []:
204 if new: # if the selection is not empty
205 indx = new[0]
206 if indx == current_selection[1]:
207 return
208 selected_station_name = source.data["name"][indx]
209 logger.info("Selected on map: {}".format(selected_station_name))210 # update the current selection cache
211 current_selection = [
212 selected_station_name,
325 labels = db.labels_
326 unique_labels = set(labels)
327 num_clusters = len(unique_labels) - (1 if -1 in labels else 0)
328 logger.info("Number of clusters: {}".format(num_clusters))329
330 cluster_pallet = linear_palette(Turbo256, len(unique_labels))
331 # to find the list of stations knowing the cluster label
168 # after fuzzy match, the new station is equal to the current station
169 select_input.value = selected_station_name
170 return
171 logger.info("Input: {}, Matched: {}".format(input_text, selected_station_name))172 indx = name_to_indx[selected_station_name]
173 # update the current selection cache
174 current_selection = [
Formatting the message manually before passing it to a logging
call does unnecessary work if logging in disabled. Consider using the logging
module's built-in formatting features to avoid that.
import logging, inspect
logging.basicConfig(level=logging.INFO)
logging.debug("Entered function {}".format(inspect.stack[0][3]))
import logging, inspect
logging.basicConfig(level=logging.INFO)
logging.debug("Entered function %s", inspect.stack[0][3])