From: John Mulligan Date: Thu, 30 Mar 2023 20:48:02 +0000 (-0400) Subject: python-common: fix variable name reuse to make mypy happy X-Git-Tag: v19.0.0~1447^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=f2646dbaba943baccd2fa7d7860c73fa05e7cd8d;p=ceph.git 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 --- diff --git a/src/python-common/ceph/deployment/drive_selection/matchers.py b/src/python-common/ceph/deployment/drive_selection/matchers.py index f423c2f43eea..619797bf56c3 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: