Message ID | 20240502171403.20863-1-jkacur@redhat.com |
---|---|
State | New |
Headers | show |
Series | rteval: Use get instead of setdefault for calculating range | expand |
diff --git a/rteval/modules/measurement/cyclictest.py b/rteval/modules/measurement/cyclictest.py index 925065367eaf..3301e1b45e11 100644 --- a/rteval/modules/measurement/cyclictest.py +++ b/rteval/modules/measurement/cyclictest.py @@ -115,7 +115,7 @@ class RunData: low = i break high = keys[-1] - while high and self.__samples.setdefault(high, 0) == 0: + while high and self.__samples.get(high, 0) == 0: high -= 1 self.__range = high - low diff --git a/rteval/modules/measurement/timerlat.py b/rteval/modules/measurement/timerlat.py index 9fa931043e40..e8345fab1ad7 100644 --- a/rteval/modules/measurement/timerlat.py +++ b/rteval/modules/measurement/timerlat.py @@ -106,7 +106,7 @@ class TLRunData: low = i break high = keys[-1] - while high and self.__samples.setdefault(high, 0) == 0: + while high and self.__samples.get(high, 0) == 0: high -= 1 self.__range = high - low
As Crystal Wood <crwood@redhat.com> points out, there is no need to setdefault when calculating the range, just use get if there is no value. Signed-off-by: John Kacur <jkacur@redhat.com> --- rteval/modules/measurement/cyclictest.py | 2 +- rteval/modules/measurement/timerlat.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)