Skip to content

Commit b55477a

Browse files
authored
[PROTON] Correct misuse of strip (#5716)
The `strip` method removes characters that match the input argument, but it does not remove substrings that match the full input. For example, previously, `"num_samples (inc)".strip("inc")` would result in `um_samples` because the character `n` is part of the input argument. Instead of using `strip`, the `replace` method can be used. However, in this case, we can simply output the original metric name (i.e., "num_samples (inc)") since it’s more useful to know whether the metric is inclusive or exclusive.
1 parent cb845fe commit b55477a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

third_party/proton/proton/viewer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ def parse(metrics, filename, include=None, exclude=None, threshold=None, depth=1
249249
gf = filter_frames(gf, include, exclude, threshold, metrics[0])
250250
print(gf.tree(metric_column=metrics, expand_name=True, depth=depth, render_header=False))
251251
if print_sorted:
252-
print("Sorted kernels by metric " + metrics[0].strip("(inc)"))
252+
print("Sorted kernels by metric " + metrics[0])
253253
sorted_df = gf.dataframe.sort_values(by=[metrics[0]], ascending=False)
254254
for row in range(1, len(sorted_df)):
255255
kernel_name = sorted_df.iloc[row]['name'][:100] + "..." if len(

0 commit comments

Comments
 (0)