diff mbox

[PATH,1/2] support/testing: rename variables for readability

Message ID 1495922327-16174-1-git-send-email-luca@lucaceresoli.net
State Accepted
Headers show

Commit Message

Luca Ceresoli May 27, 2017, 9:58 p.m. UTC
The 'lines' variable is overwritten with its own fields. Thus it
contains a line first, and then a list of fields -- it never contains
'lines'.

Use two different variables named 'line' and 'fields' to make the code
more readable.

Signed-off-by: Luca Ceresoli <luca@lucaceresoli.net>
---
 support/testing/tests/fs/test_ext.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Ricardo Martincoski May 28, 2017, 12:45 a.m. UTC | #1
Hello,

On Sat, May 27, 2017 at 06:58 PM, Luca Ceresoli wrote:

> The 'lines' variable is overwritten with its own fields. Thus it
> contains a line first, and then a list of fields -- it never contains
> 'lines'.
> 
> Use two different variables named 'line' and 'fields' to make the code
> more readable.
> 
> Signed-off-by: Luca Ceresoli <luca@lucaceresoli.net>

Acked-by: Ricardo Martincoski <ricardo.martincoski@gmail.com>

Regards,
Ricardo
Thomas Petazzoni May 28, 2017, 12:55 p.m. UTC | #2
Hello,

On Sat, 27 May 2017 23:58:46 +0200, Luca Ceresoli wrote:
> The 'lines' variable is overwritten with its own fields. Thus it
> contains a line first, and then a list of fields -- it never contains
> 'lines'.
> 
> Use two different variables named 'line' and 'fields' to make the code
> more readable.
> 
> Signed-off-by: Luca Ceresoli <luca@lucaceresoli.net>
> ---
>  support/testing/tests/fs/test_ext.py | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)

Both applied to master. Thanks!

For some reason, your first patch had a broken prefix: [PATH] instead
of [PATCH]. I guess you hand-edited the patch, and made a typo?

Thomas
Luca Ceresoli May 28, 2017, 9:07 p.m. UTC | #3
Hi,

On 28/05/2017 14:55, Thomas Petazzoni wrote:
> Hello,
> 
> On Sat, 27 May 2017 23:58:46 +0200, Luca Ceresoli wrote:
>> The 'lines' variable is overwritten with its own fields. Thus it
>> contains a line first, and then a list of fields -- it never contains
>> 'lines'.
>>
>> Use two different variables named 'line' and 'fields' to make the code
>> more readable.
>>
>> Signed-off-by: Luca Ceresoli <luca@lucaceresoli.net>
>> ---
>>  support/testing/tests/fs/test_ext.py | 8 ++++----
>>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> Both applied to master. Thanks!

Thanks.

> For some reason, your first patch had a broken prefix: [PATH] instead
> of [PATCH]. I guess you hand-edited the patch, and made a typo?

That's weird, sorry about that. But at times I open my patches with
emacs just for a last-time check before I do git send-email. Perhaps I
hit a few wrong keystrokes in that moment.

Maybe I should switch to an editor that is not editing files when it is
started... :)
diff mbox

Patch

diff --git a/support/testing/tests/fs/test_ext.py b/support/testing/tests/fs/test_ext.py
index f7e2e85055e1..d35eea8bb5fa 100644
--- a/support/testing/tests/fs/test_ext.py
+++ b/support/testing/tests/fs/test_ext.py
@@ -21,10 +21,10 @@  def dumpe2fs_run(builddir, image):
     return ret.strip().splitlines()
 
 def dumpe2fs_getprop(out, prop):
-    for lines in out:
-        lines = lines.split(": ")
-        if lines[0] == prop:
-            return lines[1].strip()
+    for line in out:
+        fields = line.split(": ")
+        if fields[0] == prop:
+            return fields[1].strip()
 
 def boot_img_and_check_fs_type(emulator, builddir, fs_type):
     img = os.path.join(builddir, "images", "rootfs.{}".format(fs_type))