Lint + update

This commit is contained in:
√(noham)²
2025-12-23 10:46:32 +01:00
parent 9f71bc6073
commit 2534210c91
7 changed files with 151 additions and 91 deletions

View File

@@ -27,6 +27,7 @@ from visualizer.plotter import (
from visualizer.text_output import print_stats, build_overview_text
from visualizer.utils import CHANNELS_DATA
def process_all_channels(start_date, end_date) -> None:
"""Process all channels in the database and generate visualizations."""
output_dir = Path("visualizer_output")
@@ -35,8 +36,8 @@ def process_all_channels(start_date, end_date) -> None:
file.unlink()
channel_ids = list_channels()
all_channels_plot_data = [] # Data for combined weekday plots
all_channels_ranking_data = [] # Data for channel rankings
all_channels_plot_data = [] # Data for combined weekday plots
all_channels_ranking_data = [] # Data for channel rankings
for channel_id in channel_ids:
print(f"Processing channel {channel_id}...")
@@ -46,14 +47,30 @@ def process_all_channels(start_date, end_date) -> None:
hourly_profile = compute_hourly_profile(rows)
heatmap = compute_heatmap(rows)
plot_combined(channel_id, hourly_profile, heatmap, stats=stats, save=True, output_dir=output_dir, channels_data=CHANNELS_DATA, build_overview_text_func=build_overview_text)
plot_combined(
channel_id,
hourly_profile,
heatmap,
stats=stats,
save=True,
output_dir=output_dir,
channels_data=CHANNELS_DATA,
build_overview_text_func=build_overview_text,
)
weekday_profile = compute_weekday_profile(rows)
weekday_heatmap = compute_weekday_hour_heatmap(rows)
weekday_hour_counts = compute_weekday_hour_counts(rows)
plot_weekday_channel(
channel_id, weekday_profile, weekday_hour_counts, stats=stats, save=True, output_dir=output_dir, channels_data=CHANNELS_DATA, build_overview_text_func=build_overview_text
channel_id,
weekday_profile,
weekday_hour_counts,
stats=stats,
save=True,
output_dir=output_dir,
channels_data=CHANNELS_DATA,
build_overview_text_func=build_overview_text,
)
all_channels_plot_data.append(
@@ -71,8 +88,18 @@ def process_all_channels(start_date, end_date) -> None:
}
)
plot_weekday_overview(all_channels_plot_data, save=True, output_dir=output_dir, channels_data=CHANNELS_DATA)
plot_channel_rankings(all_channels_ranking_data, save=True, output_dir=output_dir, channels_data=CHANNELS_DATA)
plot_weekday_overview(
all_channels_plot_data,
save=True,
output_dir=output_dir,
channels_data=CHANNELS_DATA,
)
plot_channel_rankings(
all_channels_ranking_data,
save=True,
output_dir=output_dir,
channels_data=CHANNELS_DATA,
)
def main() -> None:
@@ -110,10 +137,24 @@ def main() -> None:
if not args.no_plot:
hourly_profile = compute_hourly_profile(rows)
plot_hourly_profile(args.channel_id, hourly_profile, stats=stats, output_dir=Path("visualizer_output"), channels_data=CHANNELS_DATA, build_overview_text_func=build_overview_text)
plot_hourly_profile(
args.channel_id,
hourly_profile,
stats=stats,
output_dir=Path("visualizer_output"),
channels_data=CHANNELS_DATA,
build_overview_text_func=build_overview_text,
)
heatmap = compute_heatmap(rows)
plot_heatmap(args.channel_id, heatmap, stats=stats, output_dir=Path("visualizer_output"), channels_data=CHANNELS_DATA, build_overview_text_func=build_overview_text)
plot_heatmap(
args.channel_id,
heatmap,
stats=stats,
output_dir=Path("visualizer_output"),
channels_data=CHANNELS_DATA,
build_overview_text_func=build_overview_text,
)
if __name__ == "__main__":
main()
main()