viff

changeset 1294:cefcb223c892

benchmark: cleanup if-statements
author Martin Geisler <mg@cs.au.dk>
date Fri, 16 Oct 2009 19:12:29 +0200
parents 6952e7a560f8
children beefdf8f16c4
files apps/benchmark.py
diffstat 1 files changed, 5 insertions(+), 5 deletions(-) [+]
line diff
     1.1 --- a/apps/benchmark.py	Fri Oct 16 19:08:46 2009 +0200
     1.2 +++ b/apps/benchmark.py	Fri Oct 16 19:12:29 2009 +0200
     1.3 @@ -153,7 +153,7 @@
     1.4  
     1.5  (options, args) = parser.parse_args()
     1.6  
     1.7 -if len(args) == 0:
     1.8 +if not args:
     1.9      parser.error("you must specify a config file")
    1.10  
    1.11  id, players = load_config(args[0])
    1.12 @@ -181,7 +181,7 @@
    1.13  
    1.14  # Identify the additional mixins.
    1.15  actual_mixins = []
    1.16 -if options.mixins != "":
    1.17 +if options.mixins:
    1.18      actual_mixins = [mixins[mixin] for mixin in options.mixins.split(',')]
    1.19  
    1.20  
    1.21 @@ -203,7 +203,7 @@
    1.22  
    1.23  def update_args(runtime, options):
    1.24      args = {}
    1.25 -    if options.args != "":
    1.26 +    if options.args:
    1.27          for arg in options.args.split(','):
    1.28              id, value = arg.split('=')
    1.29              args[id] = long(value)
    1.30 @@ -219,13 +219,13 @@
    1.31      benchmark = SequentialBenchmark
    1.32  
    1.33  needed_data = ""
    1.34 -if options.needed_data != "":
    1.35 +if options.needed_data:
    1.36      file = open(options.needed_data, 'r')
    1.37      for l in file:
    1.38          needed_data += l
    1.39      needed_data = eval(needed_data)
    1.40  
    1.41 -if options.needed_data != "" and options.pc != "":
    1.42 +if options.needed_data and options.pc:
    1.43      bases = (benchmark, NeededDataBenchmarkStrategy, operation_arity, object)
    1.44      options.pc = eval(options.pc)
    1.45  else: