@@ -297,7 +297,7 @@ def get_rows(cnx, table="fluview"):
297297 Looking at the fluview table by default, but may pass parameter
298298 to look at public health or clinical lab data instead."""
299299 select = cnx .cursor ()
300- select .execute ("SELECT count(1) num FROM %s" % table )
300+ select .execute (f "SELECT count(1) num FROM { table } " )
301301 for (num ,) in select :
302302 pass
303303 select .close ()
@@ -313,16 +313,16 @@ def update_from_file_clinical(issue, date, filename, test_mode=False):
313313 u , p = secrets .db .epi
314314 cnx = mysql .connector .connect (user = u , password = p , database = "epidata" )
315315 rows1 = get_rows (cnx , CL_TABLE )
316- print ("rows before: %d" % (rows1 ))
316+ print (f "rows before: { int (rows1 )} " )
317317 insert = cnx .cursor ()
318318
319319 # load the data, ignoring empty rows
320- print ("loading data from %s as issued on %d" % ( filename , issue ))
320+ print (f "loading data from { filename } as issued on { int ( issue )} " )
321321 rows = load_zipped_csv (filename , CL_SHEET )
322- print (" loaded %d rows" % len (rows ))
322+ print (f " loaded { len (rows )} rows" )
323323 data = [get_clinical_data (row ) for row in rows ]
324324 entries = [obj for obj in data if obj ]
325- print (" found %d entries" % len (entries ))
325+ print (f " found { len (entries )} entries" )
326326
327327 sql = """
328328 INSERT INTO
@@ -365,7 +365,7 @@ def update_from_file_clinical(issue, date, filename, test_mode=False):
365365 else :
366366 cnx .commit ()
367367 rows2 = get_rows (cnx )
368- print ("rows after: %d (added %d)" % (rows2 , rows2 - rows1 ))
368+ print (f "rows after: { int ( rows2 ) } (added { int (rows2 - rows1 )} )" )
369369 cnx .close ()
370370
371371
@@ -378,16 +378,16 @@ def update_from_file_public(issue, date, filename, test_mode=False):
378378 u , p = secrets .db .epi
379379 cnx = mysql .connector .connect (user = u , password = p , database = "epidata" )
380380 rows1 = get_rows (cnx , PHL_TABLE )
381- print ("rows before: %d" % (rows1 ))
381+ print (f "rows before: { int (rows1 )} " )
382382 insert = cnx .cursor ()
383383
384384 # load the data, ignoring empty rows
385- print ("loading data from %s as issued on %d" % ( filename , issue ))
385+ print (f "loading data from { filename } as issued on { int ( issue )} " )
386386 rows = load_zipped_csv (filename , PHL_SHEET )
387- print (" loaded %d rows" % len (rows ))
387+ print (f " loaded { len (rows )} rows" )
388388 data = [get_public_data (row ) for row in rows ]
389389 entries = [obj for obj in data if obj ]
390- print (" found %d entries" % len (entries ))
390+ print (f " found { len (entries )} entries" )
391391
392392 sql = """
393393 INSERT INTO
@@ -434,7 +434,7 @@ def update_from_file_public(issue, date, filename, test_mode=False):
434434 else :
435435 cnx .commit ()
436436 rows2 = get_rows (cnx )
437- print ("rows after: %d (added %d)" % (rows2 , rows2 - rows1 ))
437+ print (f "rows after: { int ( rows2 ) } (added { int (rows2 - rows1 )} )" )
438438 cnx .close ()
439439
440440
@@ -447,16 +447,16 @@ def update_from_file(issue, date, filename, test_mode=False):
447447 u , p = secrets .db .epi
448448 cnx = mysql .connector .connect (user = u , password = p , database = "epidata" )
449449 rows1 = get_rows (cnx )
450- print ("rows before: %d" % (rows1 ))
450+ print (f "rows before: { int (rows1 )} " )
451451 insert = cnx .cursor ()
452452
453453 # load the data, ignoring empty rows
454- print ("loading data from %s as issued on %d" % ( filename , issue ))
454+ print (f "loading data from { filename } as issued on { int ( issue )} " )
455455 rows = load_zipped_csv (filename )
456- print (" loaded %d rows" % len (rows ))
456+ print (f " loaded { len (rows )} rows" )
457457 data = [get_ilinet_data (row ) for row in rows ]
458458 entries = [obj for obj in data if obj ]
459- print (" found %d entries" % len (entries ))
459+ print (f " found { len (entries )} entries" )
460460
461461 sql = """
462462 INSERT INTO
@@ -509,7 +509,7 @@ def update_from_file(issue, date, filename, test_mode=False):
509509 else :
510510 cnx .commit ()
511511 rows2 = get_rows (cnx )
512- print ("rows after: %d (added %d)" % (rows2 , rows2 - rows1 ))
512+ print (f "rows after: { int ( rows2 ) } (added { int (rows2 - rows1 )} )" )
513513 cnx .close ()
514514
515515
@@ -531,7 +531,7 @@ def main():
531531 raise Exception ("--file and --issue must both be present or absent" )
532532
533533 date = datetime .datetime .now ().strftime ("%Y-%m-%d" )
534- print ("assuming release date is today, %s" % date )
534+ print (f "assuming release date is today, { date } " )
535535
536536 if args .file :
537537 update_from_file (args .issue , date , args .file , test_mode = args .test )
0 commit comments