]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
python-common: fix variable name reuse to make mypy happy
authorJohn Mulligan <jmulligan@redhat.com>
Thu, 30 Mar 2023 20:48:02 +0000 (16:48 -0400)
committerAdam King <adking@redhat.com>
Tue, 25 Apr 2023 12:36:55 +0000 (08:36 -0400)
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 <jmulligan@redhat.com>
(cherry picked from commit f2646dbaba943baccd2fa7d7860c73fa05e7cd8d)

src/python-common/ceph/deployment/drive_selection/matchers.py

index f423c2f43eea86dd4025a4232fa065276d41cdd5..619797bf56c3249f83406471ad6e739eb35b45e9 100644 (file)
@@ -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: