diff options
author | Martin Braun <martin.braun@ettus.com> | 2020-05-04 10:50:02 -0700 |
---|---|---|
committer | Aaron Rossetto <aaron.rossetto@ni.com> | 2020-05-12 12:04:11 -0500 |
commit | b9576f9601ffa31ffe38ee44421289a9ce2db575 (patch) | |
tree | 6ce9ae03b925269075f23cd3e55233bad9d764cf /host/utils/converter_benchmark.py | |
parent | 38a7bf50a9c7abbdeb7d445baa8c0ed19f424ff7 (diff) | |
download | uhd-b9576f9601ffa31ffe38ee44421289a9ce2db575.tar.gz uhd-b9576f9601ffa31ffe38ee44421289a9ce2db575.tar.bz2 uhd-b9576f9601ffa31ffe38ee44421289a9ce2db575.zip |
utils: Remove 'six' dependency, fix minor PyLint issues
This removes the 'six' dependency from converter_benchmark, thus making
the utils subdirectory no longer depend on six.
A few Python2-isms and PyLint issues were also fixed.
Diffstat (limited to 'host/utils/converter_benchmark.py')
-rw-r--r-- | host/utils/converter_benchmark.py | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/host/utils/converter_benchmark.py b/host/utils/converter_benchmark.py index 0f7f32937..d34b019b6 100644 --- a/host/utils/converter_benchmark.py +++ b/host/utils/converter_benchmark.py @@ -9,10 +9,10 @@ Wrap the converter_benchmark tool and produce prettier results. """ +import sys import argparse import csv import subprocess -from six import iteritems INTRO_SETUP = { 'n_samples': { @@ -38,7 +38,7 @@ TABLE_SETUP = { def run_benchmark(args): """ Run the tool with the given arguments, return the section in the {{{ }}} brackets """ call_args = ['./converter_benchmark',] - for k, v in iteritems(args.__dict__): + for k, v in args.__dict__.items(): k = k.replace('_', '-') if v is None: continue @@ -48,18 +48,17 @@ def run_benchmark(args): continue call_args.append('--{0}'.format(k)) call_args.append(str(v)) - print(call_args) try: output = subprocess.check_output(call_args).decode('utf-8') except subprocess.CalledProcessError as ex: - print(ex.output) - exit(ex.returncode) + print("Error running converter_benchmark:", ex.output.decode()) + sys.exit(ex.returncode) header_out, csv_output = output.split('{{{', 1) csv_output = csv_output.split('}}}', 1) assert len(csv_output) == 2 and csv_output[1].strip() == '' return header_out, csv_output[0] -def print_stats_table(args, csv_output): +def print_stats_table(_, csv_output): """ Print stats. """ @@ -69,7 +68,7 @@ def print_stats_table(args, csv_output): for idx, row in enumerate(reader): if idx == 0: # Print intro: - for k, v in iteritems(INTRO_SETUP): + for k, v in INTRO_SETUP.items(): print("{title}: {value}".format( title=v['title'], value=row[title_row.index(k)], @@ -159,7 +158,8 @@ def setup_argparse(): ) parser.add_argument( "--debug-converter", action='store_true', - help="Skip benchmark and print conversion results. Implies iterations==1 and will only run on a single converter.", + help="Skip benchmark and print conversion results. Implies iterations==1 " + "and will only run on a single converter.", ) parser.add_argument( "--hex", action='store_true', @@ -180,4 +180,3 @@ def main(): if __name__ == "__main__": main() - |