From 69a9df646b7124739461aa4ef62eec6bd3347eea Mon Sep 17 00:00:00 2001 From: Denis Moyogo Jacquerye Date: Sat, 27 Feb 2021 23:15:59 +0000 Subject: [PATCH] Use f-strings --- Lib/glyphsLib/builder/layers.py | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/Lib/glyphsLib/builder/layers.py b/Lib/glyphsLib/builder/layers.py index 1e919f793..c9bde74df 100644 --- a/Lib/glyphsLib/builder/layers.py +++ b/Lib/glyphsLib/builder/layers.py @@ -27,16 +27,13 @@ def to_ufo_layer(self, glyph, layer): ufo_layer = ufo_font.newLayer(layer.name) elif layer.name in ufo_font.layers and glyph.name in ufo_font.layers[layer.name]: self.logger.warning( - "%s %s: Glyph %s, layer %s: Duplicate glyph layer name", - ufo_font.info.familyName, - ufo_font.info.styleName, - glyph.name, - layer.name, + f"{ufo_font.info.familyName} {ufo_font.info.styleName}: " + f"Glyph {glyph.name}, layer {layer.name}: Duplicate glyph layer name", ) n = 1 new_layer_name = layer.name while new_layer_name in ufo_font.layers: - new_layer_name = layer.name + " #" + repr(n) + new_layer_name = f"{layer.name} #{n!r}" n += 1 ufo_layer = ufo_font.newLayer(new_layer_name) else: @@ -54,22 +51,19 @@ def to_ufo_background_layer(self, glyph, layer): if layer.associatedMasterId == layer.layerId: layer_name = "public.background" else: - layer_name = layer.name + ".background" + layer_name = f"{layer.name}.background" if layer_name not in ufo_font.layers: background_layer = ufo_font.newLayer(layer_name) elif layer_name in ufo_font.layers and glyph.name in ufo_font.layers[layer_name]: self.logger.warning( - "%s %s: Glyph %s, layer %s: Duplicate glyph layer name", - ufo_font.info.familyName, - ufo_font.info.styleName, - glyph.name, - layer_name, + f"{ufo_font.info.familyName} {ufo_font.info.styleName}: " + f"Glyph {glyph.name}, layer {layer_name}: Duplicate glyph layer name", ) n = 1 new_layer_name = layer_name while new_layer_name in ufo_font.layers: - new_layer_name = layer.name + " #" + repr(n) + ".background" + new_layer_name = f"{layer.name} #{n!r}.background" n += 1 background_layer = ufo_font.newLayer(new_layer_name) else: