1818from augur .io .file import PANDAS_READ_CSV_OPTIONS , open_file
1919from augur .io .metadata import InvalidDelimiter , Metadata , read_metadata
2020from augur .io .sequences import read_sequences , write_sequences
21- from augur .io .print import print_err
21+ from augur .io .print import print_err , _n
2222from augur .io .vcf import is_vcf as filename_is_vcf , write_vcf
2323from augur .types import EmptyOutputReportingMethod
2424from . import include_exclude_rules
@@ -432,7 +432,7 @@ def run(args):
432432 total_strains_passed = len (valid_strains )
433433 total_strains_filtered = len (metadata_strains ) + num_excluded_by_lack_of_metadata - total_strains_passed
434434
435- print_err (f"{ total_strains_filtered } { 'strain was' if total_strains_filtered == 1 else 'strains were' } dropped during filtering" )
435+ print_err (f"{ total_strains_filtered } { _n ( 'strain was' , 'strains were' , total_strains_filtered ) } dropped during filtering" )
436436
437437 if num_excluded_by_lack_of_metadata :
438438 print_err (f"\t { num_excluded_by_lack_of_metadata } had no metadata" )
@@ -462,13 +462,13 @@ def run(args):
462462 parameters = {}
463463
464464 parameters ["count" ] = count
465- parameters ["were" ] = "was" if count == 1 else "were"
466- parameters ["they" ] = "it" if count == 1 else "they"
465+ parameters ["were" ] = _n ( "was" , "were" , count )
466+ parameters ["they" ] = _n ( "it" , "they" , count )
467467 print_err ("\t " + report_template_by_filter_name [filter_name ].format (** parameters ))
468468
469469 if (group_by and args .sequences_per_group ) or args .subsample_max_sequences :
470470 seed_txt = ", using seed {}" .format (args .subsample_seed ) if args .subsample_seed else ""
471- print_err (f"\t { num_excluded_subsamp } { 'was' if num_excluded_subsamp == 1 else 'were' } dropped because of subsampling criteria{ seed_txt } " )
471+ print_err (f"\t { num_excluded_subsamp } { _n ( 'was' , 'were' , num_excluded_subsamp ) } dropped because of subsampling criteria{ seed_txt } " )
472472
473473 if total_strains_passed == 0 :
474474 empty_results_message = "All samples have been dropped! Check filter rules and metadata file format."
@@ -481,4 +481,4 @@ def run(args):
481481 else :
482482 raise ValueError (f"Encountered unhandled --empty-output-reporting method { args .empty_output_reporting !r} " )
483483
484- print_err (f"{ total_strains_passed } { 'strain' if total_strains_passed == 1 else 'strains' } passed all filters" )
484+ print_err (f"{ total_strains_passed } { _n ( 'strain' , 'strains' , total_strains_passed ) } passed all filters" )
0 commit comments