5757 text-align: center;
5858 padding: 0px;
5959 border-radius: 1px;
60-
60+
6161 /* Positioning */
6262 position: absolute;
6363 z-index: 1;
6464 bottom: 100%;
6565 left: 50%;
6666 transform: translateX(-50%);
6767 margin-bottom: 8px;
68-
68+
6969 /* Tooltip Arrow */
7070 width: 400px;
7171}
7777
7878
7979class NodeTiming : # noqa: D101
80- def __init__ (self , phase : str , time : float ) -> object : # noqa: D107
80+ def __init__ (self , phase : str , time : float ) -> None : # noqa: D107
8181 self .phase = phase
8282 self .time = time
8383 # percentage is determined later.
@@ -86,7 +86,7 @@ def __init__(self, phase: str, time: float) -> object: # noqa: D107
8686 def calculate_percentage (self , total_time : float ) -> None : # noqa: D102
8787 self .percentage = self .time / total_time
8888
89- def combine_timing (l : object , r : object ) -> object : # noqa: D102
89+ def combine_timing (l : "NodeTiming" , r : "NodeTiming" ) -> "NodeTiming" : # noqa: D102
9090 # TODO: can only add timings for same-phase nodes
9191 total_time = l .time + r .time
9292 return NodeTiming (l .phase , total_time )
@@ -96,25 +96,25 @@ class AllTimings: # noqa: D101
9696 def __init__ (self ) -> None : # noqa: D107
9797 self .phase_to_timings = {}
9898
99- def add_node_timing (self , node_timing : NodeTiming ): # noqa: D102
99+ def add_node_timing (self , node_timing : NodeTiming ) -> None : # noqa: D102
100100 if node_timing .phase in self .phase_to_timings :
101101 self .phase_to_timings [node_timing .phase ].append (node_timing )
102- return
103- self .phase_to_timings [node_timing .phase ] = [node_timing ]
102+ else :
103+ self .phase_to_timings [node_timing .phase ] = [node_timing ]
104104
105- def get_phase_timings (self , phase : str ): # noqa: D102
105+ def get_phase_timings (self , phase : str ) -> list [ NodeTiming ] : # noqa: D102
106106 return self .phase_to_timings [phase ]
107107
108- def get_summary_phase_timings (self , phase : str ): # noqa: D102
108+ def get_summary_phase_timings (self , phase : str ) -> NodeTiming : # noqa: D102
109109 return reduce (NodeTiming .combine_timing , self .phase_to_timings [phase ])
110110
111- def get_phases (self ): # noqa: D102
111+ def get_phases (self ) -> list [ NodeTiming ] : # noqa: D102
112112 phases = list (self .phase_to_timings .keys ())
113113 phases .sort (key = lambda x : (self .get_summary_phase_timings (x )).time )
114114 phases .reverse ()
115115 return phases
116116
117- def get_sum_of_all_timings (self ): # noqa: D102
117+ def get_sum_of_all_timings (self ) -> float : # noqa: D102
118118 total_timing_sum = 0
119119 for phase in self .phase_to_timings .keys ():
120120 total_timing_sum += self .get_summary_phase_timings (phase ).time
@@ -132,7 +132,7 @@ def get_child_timings(top_node: object, query_timings: object) -> str: # noqa:
132132 get_child_timings (child , query_timings )
133133
134134
135- def get_pink_shade_hex (fraction : float ): # noqa: D103
135+ def get_pink_shade_hex (fraction : float ) -> str : # noqa: D103
136136 fraction = max (0 , min (1 , fraction ))
137137
138138 # Define the RGB values for very light pink (almost white) and dark pink
@@ -211,7 +211,7 @@ def generate_timing_html(graph_json: object, query_timings: object) -> object:
211211 gather_timing_information (json_graph , query_timings )
212212 total_time = float (json_graph .get ("operator_timing" ) or json_graph .get ("latency" ))
213213 table_head = """
214- <table class=\" styled-table\" >
214+ <table class=\" styled-table\" >
215215 <thead>
216216 <tr>
217217 <th>Phase</th>
0 commit comments