diff --git a/wsgi.py b/wsgi.py index 2e9834c..2305605 100644 --- a/wsgi.py +++ b/wsgi.py @@ -14,7 +14,12 @@ import pandas as pd from flask import Flask, Markup, abort, render_template, request from flask_caching import Cache -from download_digital import construct_dataframe, get_bez_data, get_landesbezirk, landesbezirk_dict +from download_digital import ( + construct_dataframe, + get_bez_data, + get_landesbezirk, + landesbezirk_dict, +) config = { "CACHE_TYPE": "FileSystemCache", @@ -278,7 +283,12 @@ def convert_fig_to_svg(fig: plt.Figure) -> str: return imgdata.read() -def _print_as_html(df: pd.DataFrame, output_str: list[str], total: int | None = None, dropna: bool = True) -> list[str]: +def _print_as_html( + df: pd.DataFrame, + output_str: list[str], + total: int | None = None, + dropna: bool = True, +) -> list[str]: df = df.astype({"Digitale Befragung": "Int32"}) if dropna: df = df.dropna() @@ -303,11 +313,13 @@ def _print_as_html(df: pd.DataFrame, output_str: list[str], total: int | None = " ", ] ) - if total and (diff := total - df['Digitale Befragung'].sum()): - tfoot.extend([ - " ", - " Weitere Bezirke", - ]) + if total and (diff := total - df["Digitale Befragung"].sum()): + tfoot.extend( + [ + " ", + " Weitere Bezirke", + ] + ) for i in range(len(df.columns) - 2): tfoot.append(" ") tfoot.extend( @@ -353,7 +365,9 @@ def state_dashboard(state: str): output_str = [] output_str = _print_as_html(df_state, output_str, dropna=False) - output_str = _print_as_html(df, output_str, total=df_state['Digitale Befragung'].sum(), dropna=False) + output_str = _print_as_html( + df, output_str, total=df_state["Digitale Befragung"].sum(), dropna=False + ) return render_template( "base.html", @@ -381,7 +395,9 @@ def dashboard(): output_str = [] output_str = _print_as_html(df_state, output_str, dropna=False) - output_str = _print_as_html(df, output_str, total=df_state['Digitale Befragung'].sum()) + output_str = _print_as_html( + df, output_str, total=df_state["Digitale Befragung"].sum() + ) return render_template( "base.html",