From 2c641488469dd5e35510c1f9a63c047dd4ab6e87 Mon Sep 17 00:00:00 2001 From: John Mulligan Date: Thu, 30 Mar 2023 16:48:02 -0400 Subject: [PATCH] python-common: fix variable name reuse to make mypy happy The variables high and low were being used as both `str`s and regex match objects. Rename the vars in the if block to avoid this problem. This change makes this file pass mypy checking on mypy 0.981. Signed-off-by: John Mulligan (cherry picked from commit f2646dbaba943baccd2fa7d7860c73fa05e7cd8d) --- .../ceph/deployment/drive_selection/matchers.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/python-common/ceph/deployment/drive_selection/matchers.py b/src/python-common/ceph/deployment/drive_selection/matchers.py index f423c2f43eea8..619797bf56c32 100644 --- a/src/python-common/ceph/deployment/drive_selection/matchers.py +++ b/src/python-common/ceph/deployment/drive_selection/matchers.py @@ -313,10 +313,10 @@ class SizeMatcher(Matcher): and raises if none could be found. """ low_high = re.match(r"\d+[A-Z]{1,2}:\d+[A-Z]{1,2}", self.value) - if low_high: - low, high = low_high.group().split(":") - self.low = self._get_k_v(low) - self.high = self._get_k_v(high) + if low_high is not None: + lowpart, highpart = low_high.group().split(":") + self.low = self._get_k_v(lowpart) + self.high = self._get_k_v(highpart) low = re.match(r"\d+[A-Z]{1,2}:$", self.value) if low: -- 2.39.5