Ignore:
Timestamp:
Sep 21, 2017, 2:52:42 PM (9 years ago)
Author:
Joachim Langenbach <joachim.langenbach@…>
Branches:
0.5, debian/bullseye, debian/jessie, master
Children:
20d6392, 9773514
Parents:
3145648
Message:
  • Changed all % string formattings into string.format
  • Changed all print "" calls into print() calls
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/python/bin/gnuboat-data-generator

    r3145648 re561143  
    4646    global logperiod
    4747
    48     parser = argparse.ArgumentParser(description="Generates test data for gnuboat webservice and fills the rrd database")
     48    parser = argparse.ArgumentParser(description='Generates test data for gnuboat webservice and fills the rrd database')
    4949    parser.add_argument('-f', '--file', dest='rrd_database', metavar='rrd_database', type=str,
    5050                        help='File path of the rrd database to fill', default="/var/lib/gnuboat/gnuboat.rrd")
    … …  
    7878
    7979    if not os.path.exists(os.path.dirname(rrdfile)):
    80         print "rrd database directory not found %s" % os.path.dirname(rrdfile)
    81         print ""
     80        print('rrd database directory not found {}'.format(os.path.dirname(rrdfile)))
    8281        parser.print_help()
    8382        sys.exit(2)
    … …  
    8786       
    8887    if os.path.isfile(rrdfile):
    89         print "Removing old database %s" % rrdfile
     88        print('Removing old database {}'.format(rrdfile))
    9089        os.remove(rrdfile)
    9190
    92     print "Creating %s" % rrdfile
     91    print('Creating {}'.format(rrdfile))
    9392    daemon.rrd_create_database(rrdfile, logperiod, str(start_time))
    9493   
    95     print "Filling database inside [%s, %s] --> [%s,%s]..." % (latitude_min, longitude_min, latitude_max, longitude_max)
     94    print('Filling database inside [{}, {}] --> [{}, {}]...'.format(latitude_min, longitude_min, latitude_max, longitude_max))
    9695    for current_time in xrange(timestamp - duration, timestamp, logperiod):
    9796        latitude = random.uniform(latitude_min, latitude_max)
    … …  
    104103        gpsFix = 3
    105104        # update rrd database for the webservice
    106         daemon.rrd_update(rrdfile, "%s:%s:%s:%s:%s:%s:%s:%s:%s" % (
     105        daemon.rrd_update(rrdfile, '{:s}:{:s}:{:s}:{:s}:{:s}:{:s}:{:s}:{:s}:{:s}'.format(
    107106                       current_time, latitude, longitude, speedThroughWater, speedOverGround, courseOverGround, waterDepth, waterTemperature, gpsFix))
    108107
Note: See TracChangeset for help on using the changeset viewer.