From 36c3c3d9a4fb3f8c166e9e7f5efdaecb9571bbef Mon Sep 17 00:00:00 2001 From: Eric Engestrom Date: Wed, 3 Nov 2021 20:36:11 +0000 Subject: [PATCH] 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 Cc: mesa-stable Part-of: --- 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 b0db62b..4f956a2 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)) -- 2.7.4