A live bird collage card for your Home Assistant dashboard.
flake8 fixes
frederik627e150e9720
diff --git a/scripts/plotly_streamlit.py b/scripts/plotly_streamlit.pyindex f9910a81..8232564e 100755--- a/scripts/plotly_streamlit.py+++ b/scripts/plotly_streamlit.py@@ -170,6 +170,7 @@ top_N_species = (df5.value_counts()[:top_N])font_size = 15+def sunrise_sunset_scatter(num_days_to_display):latitude = df['Lat'][0]longitude = df['Lon'][0]@@ -209,12 +210,13 @@ def sunrise_sunset_scatter(num_days_to_display):sunrise_week_list.append(None)sunrise_list.append(None)sunrise_text_list.append(None)- sun_list = sunrise_list.extend(sunset_list)- sun_week_list = sunrise_week_list.extend(sunset_week_list)+ sunrise_list.extend(sunset_list)+ sunrise_week_list.extend(sunset_week_list)sunrise_text_list.extend(sunset_text_list)return sunrise_week_list, sunrise_list, sunrise_text_list+def hms_to_dec(t):# (h, m, s) = t.split(':')h = t.hour@@ -223,6 +225,7 @@ def hms_to_dec(t):result = h + m + sreturn result+def hms_to_str(t):# (h, m, s) = t.split(':')h = t.hour@@ -470,10 +473,10 @@ if daily is False:y_downscale_factor = int(len(saved_time_labels) / number_of_y_ticks)fig.update_layout(yaxis=dict(- tickmode = 'array',- tickvals = day_hour_freq.columns[::y_downscale_factor],- ticktext = saved_time_labels[::y_downscale_factor],- nticks = 6+ tickmode='array',+ tickvals=day_hour_freq.columns[::y_downscale_factor],+ ticktext=saved_time_labels[::y_downscale_factor],+ nticks=6))st.plotly_chart(fig, use_container_width=True) # , config=config)diff --git a/scripts/utils/notifications.py b/scripts/utils/notifications.pyindex 94df122b..be48dba0 100644--- a/scripts/utils/notifications.py+++ b/scripts/utils/notifications.py@@ -54,7 +54,7 @@ def sendAppriseNotifications(species, confidence, confidencepct, path,if APPRISE_ONLY_NOTIFY_SPECIES_NAMES is not None and APPRISE_ONLY_NOTIFY_SPECIES_NAMES.strip() != "":if any(bird.lower().replace(" ", "") in comName.lower().replace(" ", "") for bird in APPRISE_ONLY_NOTIFY_SPECIES_NAMES.split(",")):return-+APPRISE_ONLY_NOTIFY_SPECIES_NAMES_2 = settings_dict.get('APPRISE_ONLY_NOTIFY_SPECIES_NAMES_2')if APPRISE_ONLY_NOTIFY_SPECIES_NAMES_2 is not None and APPRISE_ONLY_NOTIFY_SPECIES_NAMES_2.strip() != "":if not any(bird.lower().replace(" ", "") in comName.lower().replace(" ", "") for bird in APPRISE_ONLY_NOTIFY_SPECIES_NAMES_2.split(",")):@@ -86,9 +86,10 @@ def sendAppriseNotifications(species, confidence, confidencepct, path,try:# TODO: Make this work with non-english comnames. Implement the "// convert sci name to English name" logic from overview.php hereheaders = {'User-Agent': 'Python_Flickr/1.0'}- url = 'https://www.flickr.com/services/rest/?method=flickr.photos.search&api_key='+str(settings_dict.get('FLICKR_API_KEY'))+'&text='+str(comName)+' bird&sort=relevance&per_page=5&media=photos&format=json&license=2%2C3%2C4%2C5%2C6%2C9&nojsoncallback=1'+ url = ('https://www.flickr.com/services/rest/?method=flickr.photos.search&api_key=' + str(settings_dict.get('FLICKR_API_KEY')) ++ '&text=' + str(comName) + ' bird&sort=relevance&per_page=5&media=photos&format=json&license=2%2C3%2C4%2C5%2C6%2C9&nojsoncallback=1')resp = requests.get(url=url, headers=headers)-+resp.encoding = "utf-8"data = resp.json()["photos"]["photo"][0]