btt_plot.py: Fix pylint: len-as-condition
authorVincent Legoll <vincent.legoll@gmail.com>
Fri, 20 Mar 2020 21:44:54 +0000 (22:44 +0100)
committerJens Axboe <axboe@kernel.dk>
Fri, 20 Mar 2020 21:53:50 +0000 (15:53 -0600)
Do not use `len(SEQUENCE)` to determine if a sequence is empty

Signed-off-by: Vincent Legoll <vincent.legoll@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
btt/btt_plot.py

index b135206528b3e67bf3c50e210eaaf8317d7b750b..d6d27aa32f09fea1366fafbe4b72635e31f0f5fd 100755 (executable)
@@ -349,7 +349,7 @@ def generate_output(type, db):
                        legends.append(get_base(file))
                idx += 1
 
-       if add_legend and len(legends) > 0:
+       if add_legend and legends:
                gen_legends(ax, legends)
        plt.savefig(ofile)
 
@@ -450,7 +450,7 @@ if __name__ == '__main__':
                output_file = title_str = type = None
                for t in types:
                        files = get_files(t)
-                       if len(files) == 0:
+                       if files == 0:
                                continue
                        elif t == 'bnos':
                                do_bnos(files)
@@ -460,7 +460,7 @@ if __name__ == '__main__':
                                generate_output(t, get_data(files))
                                continue
 
-       elif len(files) < 1:
+       elif not files:
                fatal('Need data files to process')
        else:
                generate_output(type, get_data(files))