bmpblk: Avoid '{}'.format()

Replace '{}'.format() with either f-strings or % formatting, as
suggested by CrOS python style guide.

BUG=none
TEST=make BOARD=asurada
BRANCH=none

Change-Id: Ie8957ad14a4414eff8877b41f2e990c8ab56fb3a
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/bmpblk/+/2856316
Reviewed-by: Joel Kitching <kitching@chromium.org>
Tested-by: Yu-Ping Wu <yupingso@chromium.org>
Commit-Queue: Yu-Ping Wu <yupingso@chromium.org>
diff --git a/build.py b/build.py
index 65ad8a3..178ac0e 100755
--- a/build.py
+++ b/build.py
@@ -23,7 +23,7 @@
 SCRIPT_BASE = os.path.dirname(os.path.abspath(__file__))
 
 STRINGS_GRD_FILE = 'firmware_strings.grd'
-STRINGS_JSON_FILE_TMPL = '{}.json'
+STRINGS_JSON_FILE_TMPL = '%s.json'
 FORMAT_FILE = 'format.yaml'
 BOARDS_CONFIG_FILE = 'boards.yaml'
 
@@ -177,7 +177,7 @@
         A dictionary for mapping of "name to content" for files to be generated.
     """
     result = {}
-    filename = os.path.join(json_dir, STRINGS_JSON_FILE_TMPL.format(locale))
+    filename = os.path.join(json_dir, STRINGS_JSON_FILE_TMPL % locale)
     with open(filename, encoding='utf-8-sig') as input_file:
         for tag, msgdict in json.load(input_file).items():
             msgtext = msgdict['message']
@@ -669,9 +669,8 @@
                 # Setting max_width causes left/right alignment of the text.
                 # However, generic strings are locale independent, and hence
                 # shouldn't have text alignment within the bitmap.
-                raise BuildImageError(
-                    '{}: {!r} should be null for generic strings'.format(
-                        name, KEY_MAX_WIDTH))
+                raise BuildImageError(f'{name}: {KEY_MAX_WIDTH!r} should be '
+                                      'null for generic strings')
             self.convert_text_to_image(None,
                                        txt_file,
                                        bmp_file,
@@ -926,8 +925,7 @@
         """
         with open(os.path.join(self.output_dir, 'locales'), 'w') as f:
             for locale_info in self.locales:
-                f.write('{},{}\n'.format(locale_info.code,
-                                         int(locale_info.rtl)))
+                f.write(f'{locale_info.code},{locale_info.rtl:d}\n')
 
     def build(self):
         """Builds all images required by a board."""