WeixuanZ / flood-warning-system

Lazy formatting of message string passed to logging module PYL-W1202
Performance
Minor
a year agoa year old
Use lazy % formatting in logging functions
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]:
Use lazy % formatting in logging functions
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]
Use lazy % formatting in logging functions
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,
Use lazy % formatting in logging functions
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
Use lazy % formatting in logging functions
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 = [