From 2d274a255309e51d7e61edaeade7d67e2c001e68 Mon Sep 17 00:00:00 2001 From: Eric Engestrom Date: Wed, 3 Nov 2021 20:36:11 +0000 Subject: [PATCH] pick-ui: use more expressive variable names Signed-off-by: Eric Engestrom Cc: mesa-stable Part-of: --- 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 """) - 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 """) - 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 """) - 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 """) - 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: """) - 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: """) - 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: """) - 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: """) - 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 """) - 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: