@@ -139,15 +139,15 @@ def Fire(component=None, command=None, name=None, serialize=None):
139139 _DisplayError (component_trace )
140140 raise FireExit (2 , component_trace )
141141 if component_trace .show_trace and component_trace .show_help :
142- output = ['Fire trace:\n {trace }\n ' . format ( trace = component_trace ) ]
142+ output = [f 'Fire trace:\n { component_trace } \n ' ]
143143 result = component_trace .GetResult ()
144144 help_text = helptext .HelpText (
145145 result , trace = component_trace , verbose = component_trace .verbose )
146146 output .append (help_text )
147147 Display (output , out = sys .stderr )
148148 raise FireExit (0 , component_trace )
149149 if component_trace .show_trace :
150- output = ['Fire trace:\n {trace}' . format ( trace = component_trace ) ]
150+ output = [f 'Fire trace:\n { component_trace } ' ]
151151 Display (output , out = sys .stderr )
152152 raise FireExit (0 , component_trace )
153153 if component_trace .show_help :
@@ -231,9 +231,9 @@ def _IsHelpShortcut(component_trace, remaining_args):
231231
232232 if show_help :
233233 component_trace .show_help = True
234- command = '{cmd } -- --help'. format ( cmd = component_trace . GetCommand ())
235- print ('INFO: Showing help with the command {cmd }.\n ' . format (
236- cmd = shlex . quote ( command )), file = sys .stderr )
234+ command = f' { component_trace . GetCommand () } -- --help'
235+ print (f 'INFO: Showing help with the command { shlex . quote ( command ) } .\n ',
236+ file = sys .stderr )
237237 return show_help
238238
239239
@@ -287,9 +287,9 @@ def _DisplayError(component_trace):
287287 show_help = True
288288
289289 if show_help :
290- command = '{cmd } -- --help'. format ( cmd = component_trace . GetCommand ())
291- print ('INFO: Showing help with the command {cmd }.\n ' . format (
292- cmd = shlex . quote ( command )), file = sys .stderr )
290+ command = f' { component_trace . GetCommand () } -- --help'
291+ print (f 'INFO: Showing help with the command { shlex . quote ( command ) } .\n ',
292+ file = sys .stderr )
293293 help_text = helptext .HelpText (result , trace = component_trace ,
294294 verbose = component_trace .verbose )
295295 output .append (help_text )
@@ -327,14 +327,13 @@ def _DictAsString(result, verbose=False):
327327 return '{}'
328328
329329 longest_key = max (len (str (key )) for key in result_visible .keys ())
330- format_string = '{{key:{padding }s}} {{value}}' . format ( padding = longest_key + 1 )
330+ format_string = f '{{key:{ longest_key + 1 } s}} {{value}}'
331331
332332 lines = []
333333 for key , value in result .items ():
334334 if completion .MemberVisible (result , key , value , class_attrs = class_attrs ,
335335 verbose = verbose ):
336- line = format_string .format (key = str (key ) + ':' ,
337- value = _OneLineResult (value ))
336+ line = format_string .format (key = f'{ key } :' , value = _OneLineResult (value ))
338337 lines .append (line )
339338 return '\n ' .join (lines )
340339
@@ -348,10 +347,10 @@ def _OneLineResult(result):
348347 # TODO(dbieber): Show a small amount of usage information about the function
349348 # or module if it fits cleanly on the line.
350349 if inspect .isfunction (result ):
351- return '<function {name}>' . format ( name = result .__name__ )
350+ return f '<function { result .__name__ } >'
352351
353352 if inspect .ismodule (result ):
354- return '<module {name}>' . format ( name = result .__name__ )
353+ return f '<module { result .__name__ } >'
355354
356355 try :
357356 # Don't force conversion to ascii.
@@ -890,9 +889,10 @@ def _ParseKeywordArgs(args, fn_spec):
890889 if len (matching_fn_args ) == 1 :
891890 keyword = matching_fn_args [0 ]
892891 elif len (matching_fn_args ) > 1 :
893- raise FireError ("The argument '{}' is ambiguous as it could "
894- "refer to any of the following arguments: {}" .format (
895- argument , matching_fn_args ))
892+ raise FireError (
893+ f"The argument '{ argument } ' is ambiguous as it could "
894+ f"refer to any of the following arguments: { matching_fn_args } "
895+ )
896896
897897 # Determine the value.
898898 if not keyword :
0 commit comments