From 6bb0c7086b5000ce7a7078760204af6f929c0468 Mon Sep 17 00:00:00 2001 From: bd Date: Sun, 30 Nov 2025 22:05:17 -0500 Subject: nemesis: Update html_gen with type annotations Provided by righttyper --- nemesis/html_gen.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'nemesis') diff --git a/nemesis/html_gen.py b/nemesis/html_gen.py index 70d476b..85d2cae 100644 --- a/nemesis/html_gen.py +++ b/nemesis/html_gen.py @@ -1,3 +1,6 @@ +from typing import TYPE_CHECKING +if TYPE_CHECKING: + import collections import plotly.graph_objects as go from plotly.subplots import make_subplots import hashlib @@ -5,12 +8,12 @@ import math TRIM_PERCENT = 0.10 -def get_color(name): +def get_color(name: str) -> str: hash_object = hashlib.md5(name.encode()) color_index = int(hash_object.hexdigest(), 16) % 360 return f'hsl({color_index}, 90%, 30%)' -def plot_results(results, output_file, input_file): +def plot_results(results: "collections.defaultdict[str, collections.defaultdict[float, collections.defaultdict[int, list[tuple[list[tuple[str, float]], float]]]]]", output_file: str, input_file: str) -> None: # determine the number of loops we have data for total_loops = set() for x_values in results.values(): -- cgit v1.2.3