@@ -60,15 +60,15 @@ def create_parser():
6060 dest = 'keyword_case' ,
6161 choices = _CASE_CHOICES ,
6262 help = 'change case of keywords, CHOICE is one of {}' .format (
63- ', ' .join ('"{}"' . format ( x ) for x in _CASE_CHOICES )))
63+ ', ' .join (f '"{ x } "' for x in _CASE_CHOICES )))
6464
6565 group .add_argument (
6666 '-i' , '--identifiers' ,
6767 metavar = 'CHOICE' ,
6868 dest = 'identifier_case' ,
6969 choices = _CASE_CHOICES ,
7070 help = 'change case of identifiers, CHOICE is one of {}' .format (
71- ', ' .join ('"{}"' . format ( x ) for x in _CASE_CHOICES )))
71+ ', ' .join (f '"{ x } "' for x in _CASE_CHOICES )))
7272
7373 group .add_argument (
7474 '-l' , '--language' ,
@@ -157,7 +157,7 @@ def create_parser():
157157
158158def _error (msg ):
159159 """Print msg and optionally exit with return code exit_."""
160- sys .stderr .write ('[ERROR] {}\n ' . format ( msg ) )
160+ sys .stderr .write (f '[ERROR] { msg } \n ' )
161161 return 1
162162
163163
@@ -177,23 +177,23 @@ def main(args=None):
177177 data = '' .join (f .readlines ())
178178 except OSError as e :
179179 return _error (
180- 'Failed to read {}: {}' . format ( args . filename , e ) )
180+ f 'Failed to read { args . filename } : { e } ' )
181181
182182 close_stream = False
183183 if args .outfile :
184184 try :
185185 stream = open (args .outfile , 'w' , encoding = args .encoding )
186186 close_stream = True
187187 except OSError as e :
188- return _error ('Failed to open {}: {}' . format ( args . outfile , e ) )
188+ return _error (f 'Failed to open { args . outfile } : { e } ' )
189189 else :
190190 stream = sys .stdout
191191
192192 formatter_opts = vars (args )
193193 try :
194194 formatter_opts = sqlparse .formatter .validate_options (formatter_opts )
195195 except SQLParseError as e :
196- return _error ('Invalid options: {}' . format ( e ) )
196+ return _error (f 'Invalid options: { e } ' )
197197
198198 s = sqlparse .format (data , ** formatter_opts )
199199 stream .write (s )
0 commit comments