@@ -942,12 +942,10 @@ def run(self, argv=None):
942942 self ._configure_logging (options .loglevel )
943943 if options .list_locales :
944944 identifiers = localedata .locale_identifiers ()
945- longest = max (len (identifier ) for identifier in identifiers )
946- identifiers .sort ()
947- format = '%%-%ds %%s' % (longest + 1 )
948- for identifier in identifiers :
945+ id_width = max (len (identifier ) for identifier in identifiers ) + 1
946+ for identifier in sorted (identifiers ):
949947 locale = Locale .parse (identifier )
950- print (format % ( identifier , locale .english_name ) )
948+ print (f" { identifier :<{ id_width } } { locale .english_name } " )
951949 return 0
952950
953951 if not args :
@@ -979,11 +977,9 @@ def _configure_logging(self, loglevel):
979977 def _help (self ):
980978 print (self .parser .format_help ())
981979 print ("commands:" )
982- longest = max (len (command ) for command in self .commands )
983- format = " %%-%ds %%s" % max (8 , longest + 1 )
984- commands = sorted (self .commands .items ())
985- for name , description in commands :
986- print (format % (name , description ))
980+ cmd_width = max (8 , max (len (command ) for command in self .commands ) + 1 )
981+ for name , description in sorted (self .commands .items ()):
982+ print (f" { name :<{cmd_width }} { description } " )
987983
988984 def _configure_command (self , cmdname , argv ):
989985 """
0 commit comments