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 <eric@engestrom.ch>
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13664>
This commit is contained in:
Eric Engestrom
2021-11-03 20:36:11 +00:00
committed by Marge Bot
parent 273feeb643
commit 36c3c3d9a4

View File

@@ -276,9 +276,7 @@ async def resolve_nomination(commit: 'Commit', version: str) -> 'Commit':
out = _out.decode() out = _out.decode()
# We give precedence to fixes and cc tags over revert tags. # We give precedence to fixes and cc tags over revert tags.
# XXX: not having the walrus operator available makes me sad := if m := IS_FIX.search(out):
m = IS_FIX.search(out)
if m:
# We set the nomination_type and because_sha here so that we can later # We set the nomination_type and because_sha here so that we can later
# check to see if this fixes another staged commit. # check to see if this fixes another staged commit.
try: try:
@@ -291,15 +289,13 @@ async def resolve_nomination(commit: 'Commit', version: str) -> 'Commit':
commit.nominated = True commit.nominated = True
return commit return commit
m = IS_CC.search(out) if m := IS_CC.search(out):
if m:
if m.groups() == (None, None) or version in m.groups(): if m.groups() == (None, None) or version in m.groups():
commit.nominated = True commit.nominated = True
commit.nomination_type = NominationType.CC commit.nomination_type = NominationType.CC
return commit return commit
m = IS_REVERT.search(out) if m := IS_REVERT.search(out):
if m:
# See comment for IS_FIX path # See comment for IS_FIX path
try: try:
commit.because_sha = reverted = await full_sha(m.group(1)) commit.because_sha = reverted = await full_sha(m.group(1))