From d604321f37d33645fb7801411c6b1987d701da64 Mon Sep 17 00:00:00 2001 From: Frederik Gladhorn Date: Wed, 30 Jun 2021 20:36:48 +0200 Subject: [PATCH] Simplify initializing glyph_data (#1970) Make it easier to read the initialization with zeros, no loop required. --- esphome/components/font/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/esphome/components/font/__init__.py b/esphome/components/font/__init__.py index 11bbedd80b..16a7d8a612 100644 --- a/esphome/components/font/__init__.py +++ b/esphome/components/font/__init__.py @@ -110,7 +110,7 @@ async def to_code(config): _, (offset_x, offset_y) = font.font.getsize(glyph) width, height = mask.size width8 = ((width + 7) // 8) * 8 - glyph_data = [0 for _ in range(height * width8 // 8)] # noqa: F812 + glyph_data = [0] * (height * width8 // 8) for y in range(height): for x in range(width): if not mask.getpixel((x, y)):