@@ -297,7 +297,7 @@ def get_rows(cnx, table="fluview"):
297
297
Looking at the fluview table by default, but may pass parameter
298
298
to look at public health or clinical lab data instead."""
299
299
select = cnx .cursor ()
300
- select .execute ("SELECT count(1) num FROM %s" % table )
300
+ select .execute (f "SELECT count(1) num FROM { table } " )
301
301
for (num ,) in select :
302
302
pass
303
303
select .close ()
@@ -313,16 +313,16 @@ def update_from_file_clinical(issue, date, filename, test_mode=False):
313
313
u , p = secrets .db .epi
314
314
cnx = mysql .connector .connect (user = u , password = p , database = "epidata" )
315
315
rows1 = get_rows (cnx , CL_TABLE )
316
- print ("rows before: %d" % (rows1 ))
316
+ print (f "rows before: { int (rows1 )} " )
317
317
insert = cnx .cursor ()
318
318
319
319
# 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 )} " )
321
321
rows = load_zipped_csv (filename , CL_SHEET )
322
- print (" loaded %d rows" % len (rows ))
322
+ print (f " loaded { len (rows )} rows" )
323
323
data = [get_clinical_data (row ) for row in rows ]
324
324
entries = [obj for obj in data if obj ]
325
- print (" found %d entries" % len (entries ))
325
+ print (f " found { len (entries )} entries" )
326
326
327
327
sql = """
328
328
INSERT INTO
@@ -365,7 +365,7 @@ def update_from_file_clinical(issue, date, filename, test_mode=False):
365
365
else :
366
366
cnx .commit ()
367
367
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 )} )" )
369
369
cnx .close ()
370
370
371
371
@@ -378,16 +378,16 @@ def update_from_file_public(issue, date, filename, test_mode=False):
378
378
u , p = secrets .db .epi
379
379
cnx = mysql .connector .connect (user = u , password = p , database = "epidata" )
380
380
rows1 = get_rows (cnx , PHL_TABLE )
381
- print ("rows before: %d" % (rows1 ))
381
+ print (f "rows before: { int (rows1 )} " )
382
382
insert = cnx .cursor ()
383
383
384
384
# 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 )} " )
386
386
rows = load_zipped_csv (filename , PHL_SHEET )
387
- print (" loaded %d rows" % len (rows ))
387
+ print (f " loaded { len (rows )} rows" )
388
388
data = [get_public_data (row ) for row in rows ]
389
389
entries = [obj for obj in data if obj ]
390
- print (" found %d entries" % len (entries ))
390
+ print (f " found { len (entries )} entries" )
391
391
392
392
sql = """
393
393
INSERT INTO
@@ -434,7 +434,7 @@ def update_from_file_public(issue, date, filename, test_mode=False):
434
434
else :
435
435
cnx .commit ()
436
436
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 )} )" )
438
438
cnx .close ()
439
439
440
440
@@ -447,16 +447,16 @@ def update_from_file(issue, date, filename, test_mode=False):
447
447
u , p = secrets .db .epi
448
448
cnx = mysql .connector .connect (user = u , password = p , database = "epidata" )
449
449
rows1 = get_rows (cnx )
450
- print ("rows before: %d" % (rows1 ))
450
+ print (f "rows before: { int (rows1 )} " )
451
451
insert = cnx .cursor ()
452
452
453
453
# 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 )} " )
455
455
rows = load_zipped_csv (filename )
456
- print (" loaded %d rows" % len (rows ))
456
+ print (f " loaded { len (rows )} rows" )
457
457
data = [get_ilinet_data (row ) for row in rows ]
458
458
entries = [obj for obj in data if obj ]
459
- print (" found %d entries" % len (entries ))
459
+ print (f " found { len (entries )} entries" )
460
460
461
461
sql = """
462
462
INSERT INTO
@@ -509,7 +509,7 @@ def update_from_file(issue, date, filename, test_mode=False):
509
509
else :
510
510
cnx .commit ()
511
511
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 )} )" )
513
513
cnx .close ()
514
514
515
515
@@ -531,7 +531,7 @@ def main():
531
531
raise Exception ("--file and --issue must both be present or absent" )
532
532
533
533
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 } " )
535
535
536
536
if args .file :
537
537
update_from_file (args .issue , date , args .file , test_mode = args .test )
0 commit comments