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

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

pick-ui: use assignment expressions

Python 3.8 is 2 years old by now, I think it's time to allow using its
features, especially for a script that's only used by the release
maintainers.

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 | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/bin/pick/core.py b/bin/pick/core.py
index b0db62bdefa..4f956a2d39c 100644
--- a/bin/pick/core.py
+++ b/bin/pick/core.py
@@ -276,9 +276,7 @@ async def resolve_nomination(commit: 'Commit', version: 
str) -> 'Commit':
     out = _out.decode()
 
     # We give precedence to fixes and cc tags over revert tags.
-    # XXX: not having the walrus operator available makes me sad :=
-    m = IS_FIX.search(out)
-    if m:
+    if m := 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:
@@ -291,15 +289,13 @@ async def resolve_nomination(commit: 'Commit', version: 
str) -> 'Commit':
                 commit.nominated = True
                 return commit
 
-    m = IS_CC.search(out)
-    if m:
+    if m := IS_CC.search(out):
         if m.groups() == (None, None) or version in m.groups():
             commit.nominated = True
             commit.nomination_type = NominationType.CC
             return commit
 
-    m = IS_REVERT.search(out)
-    if m:
+    if m := IS_REVERT.search(out):
         # See comment for IS_FIX path
         try:
             commit.because_sha = reverted = await full_sha(m.group(1))

Reply via email to