Module: Mesa
Branch: main
Commit: 2d274a255309e51d7e61edaeade7d67e2c001e68
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=2d274a255309e51d7e61edaeade7d67e2c001e68

Author: Eric Engestrom <[email protected]>
Date:   Wed Nov  3 20:36:11 2021 +0000

pick-ui: use more expressive variable names

Signed-off-by: Eric Engestrom <[email protected]>
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13664>

---

 bin/pick/core.py      | 12 +++++------
 bin/pick/core_test.py | 58 +++++++++++++++++++++++++--------------------------
 2 files changed, 35 insertions(+), 35 deletions(-)

diff --git a/bin/pick/core.py b/bin/pick/core.py
index 4f956a2d39c..d7dfb12a117 100644
--- a/bin/pick/core.py
+++ b/bin/pick/core.py
@@ -276,11 +276,11 @@ async def resolve_nomination(commit: 'Commit', version: 
str) -> 'Commit':
     out = _out.decode()
 
     # We give precedence to fixes and cc tags over revert tags.
-    if m := IS_FIX.search(out):
+    if fix_for_commit := IS_FIX.search(out):
         # We set the nomination_type and because_sha here so that we can later
         # check to see if this fixes another staged commit.
         try:
-            commit.because_sha = fixed = await full_sha(m.group(1))
+            commit.because_sha = fixed = await 
full_sha(fix_for_commit.group(1))
         except PickUIException:
             pass
         else:
@@ -289,16 +289,16 @@ async def resolve_nomination(commit: 'Commit', version: 
str) -> 'Commit':
                 commit.nominated = True
                 return commit
 
-    if m := IS_CC.search(out):
-        if m.groups() == (None, None) or version in m.groups():
+    if cc_to := IS_CC.search(out):
+        if cc_to.groups() == (None, None) or version in cc_to.groups():
             commit.nominated = True
             commit.nomination_type = NominationType.CC
             return commit
 
-    if m := IS_REVERT.search(out):
+    if revert_of := IS_REVERT.search(out):
         # See comment for IS_FIX path
         try:
-            commit.because_sha = reverted = await full_sha(m.group(1))
+            commit.because_sha = reverted = await full_sha(revert_of.group(1))
         except PickUIException:
             pass
         else:
diff --git a/bin/pick/core_test.py b/bin/pick/core_test.py
index e178f6483e1..f2ac6ede1ce 100644
--- a/bin/pick/core_test.py
+++ b/bin/pick/core_test.py
@@ -94,9 +94,9 @@ class TestRE:
                 Reviewed-by: Jonathan Marek <[email protected]>
             """)
 
-            m = core.IS_FIX.search(message)
-            assert m is not None
-            assert m.group(1) == '3d09bb390a39'
+            fix_for_commit = core.IS_FIX.search(message)
+            assert fix_for_commit is not None
+            assert fix_for_commit.group(1) == '3d09bb390a39'
 
     class TestCC:
 
@@ -114,9 +114,9 @@ class TestRE:
                 Reviewed-by: Bas Nieuwenhuizen <[email protected]>
             """)
 
-            m = core.IS_CC.search(message)
-            assert m is not None
-            assert m.group(1) == '19.2'
+            cc_to = core.IS_CC.search(message)
+            assert cc_to is not None
+            assert cc_to.group(1) == '19.2'
 
         def test_multiple_branches(self):
             """Tests commit with more than one branch specified"""
@@ -130,10 +130,10 @@ class TestRE:
                 Reviewed-by: Pierre-Eric Pelloux-Prayer 
<[email protected]>
             """)
 
-            m = core.IS_CC.search(message)
-            assert m is not None
-            assert m.group(1) == '19.1'
-            assert m.group(2) == '19.2'
+            cc_to = core.IS_CC.search(message)
+            assert cc_to is not None
+            assert cc_to.group(1) == '19.1'
+            assert cc_to.group(2) == '19.2'
 
         def test_no_branch(self):
             """Tests commit with no branch specification"""
@@ -148,8 +148,8 @@ class TestRE:
                 Reviewed-by: Lionel Landwerlin <[email protected]>
             """)
 
-            m = core.IS_CC.search(message)
-            assert m is not None
+            cc_to = core.IS_CC.search(message)
+            assert cc_to is not None
 
         def test_quotes(self):
             """Tests commit with quotes around the versions"""
@@ -162,9 +162,9 @@ class TestRE:
                  Part-of: 
<https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3454>
             """)
 
-            m = core.IS_CC.search(message)
-            assert m is not None
-            assert m.group(1) == '20.0'
+            cc_to = core.IS_CC.search(message)
+            assert cc_to is not None
+            assert cc_to.group(1) == '20.0'
 
         def test_multiple_quotes(self):
             """Tests commit with quotes around the versions"""
@@ -177,10 +177,10 @@ class TestRE:
                  Part-of: 
<https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3454>
             """)
 
-            m = core.IS_CC.search(message)
-            assert m is not None
-            assert m.group(1) == '20.0'
-            assert m.group(2) == '20.1'
+            cc_to = core.IS_CC.search(message)
+            assert cc_to is not None
+            assert cc_to.group(1) == '20.0'
+            assert cc_to.group(2) == '20.1'
 
         def test_single_quotes(self):
             """Tests commit with quotes around the versions"""
@@ -193,9 +193,9 @@ class TestRE:
                  Part-of: 
<https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3454>
             """)
 
-            m = core.IS_CC.search(message)
-            assert m is not None
-            assert m.group(1) == '20.0'
+            cc_to = core.IS_CC.search(message)
+            assert cc_to is not None
+            assert cc_to.group(1) == '20.0'
 
         def test_multiple_single_quotes(self):
             """Tests commit with quotes around the versions"""
@@ -208,10 +208,10 @@ class TestRE:
                  Part-of: 
<https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3454>
             """)
 
-            m = core.IS_CC.search(message)
-            assert m is not None
-            assert m.group(1) == '20.0'
-            assert m.group(2) == '20.1'
+            cc_to = core.IS_CC.search(message)
+            assert cc_to is not None
+            assert cc_to.group(1) == '20.0'
+            assert cc_to.group(2) == '20.1'
 
     class TestRevert:
 
@@ -232,9 +232,9 @@ class TestRE:
                 Reviewed-by: Bas Nieuwenhuizen <[email protected]>
             """)
 
-            m = core.IS_REVERT.search(message)
-            assert m is not None
-            assert m.group(1) == '2ca8629fa9b303e24783b76a7b3b0c2513e32fbd'
+            revert_of = core.IS_REVERT.search(message)
+            assert revert_of is not None
+            assert revert_of.group(1) == 
'2ca8629fa9b303e24783b76a7b3b0c2513e32fbd'
 
 
 class TestResolveNomination:

Reply via email to