clean up for linters

This commit is contained in:
2022-06-07 19:50:46 -05:00
parent 42d5c452e7
commit 8093d8288e
9 changed files with 78 additions and 82 deletions

View File

@@ -2,10 +2,8 @@ import os
from dataclasses import dataclass
from datetime import datetime
from pathlib import Path
from typing import List
from zoneinfo import ZoneInfo
from PIL import Image, ImageDraw, ImageFilter, ImageFont
from PIL import Image, ImageDraw, ImageFont
# image_directory = 'input/images/logos-bw/{filename}.{ext}'
@@ -115,19 +113,6 @@ def gen_image(
# transparent color.
tmp = Image.new("RGBA", background_image.size, (0, 0, 0, 0))
# Create a drawing context for it.
draw = ImageDraw.Draw(tmp)
# section margin describes the margin of the section rectangles from the sides of the image
section_margin_pct = 0.05
llx = int(section_margin_pct * background_image.size[0])
urx = int((1 - section_margin_pct) * background_image.size[0])
lly = int((1 - section_margin_pct) * background_image.size[1])
ury = int(0.50 * background_image.size[1])
lly2 = int(0.49 * background_image.size[1])
ury2 = int(0.05 * background_image.size[1])
section_info = Image.open(
Path(
"instagen/static/instagen/graphics/{name}{ext}".format(
@@ -150,7 +135,6 @@ def gen_image(
font = ImageFont.truetype(font_regular_path, 62)
text = f"{date:%a, %B %-d %-I:%M %p}".upper()
# text = date
text_size = draw.textsize(text, font)
loc = (1050, 280)
section_info_draw.text(loc, text, (14, 42, 28), font=font, anchor="ra")
@@ -160,7 +144,6 @@ def gen_image(
text = location.name.upper()
else:
text = location_name.upper()
text_size = section_info_draw.textsize(text, font)
loc = (1050, 355)
section_info_draw.text(loc, text, (14, 42, 28), font=font, anchor="ra")
@@ -169,7 +152,6 @@ def gen_image(
text = "VS"
else:
text = "AT"
text_size = section_title_draw.textsize(text, font)
loc = (540, 120)
color = (255, 255, 255)
section_title_draw.text(loc, text, color, font=font, anchor="mm")
@@ -249,19 +231,6 @@ def gen_results_image(
# transparent color.
tmp = Image.new("RGBA", background_image.size, (0, 0, 0, 0))
# Create a drawing context for it.
draw = ImageDraw.Draw(tmp)
# section margin describes the margin of the section rectangles from the sides of the image
section_margin_pct = 0.05
llx = int(section_margin_pct * background_image.size[0])
urx = int((1 - section_margin_pct) * background_image.size[0])
lly = int((1 - section_margin_pct) * background_image.size[1])
ury = int(0.50 * background_image.size[1])
lly2 = int(0.49 * background_image.size[1])
ury2 = int(0.05 * background_image.size[1])
section_info = Image.open(
Path(
"instagen/static/instagen/graphics/{name}{ext}".format(
@@ -301,7 +270,6 @@ def gen_results_image(
text = f"{date:%a, %B %-d %-I:%M %p}".upper()
# text = date
font = ImageFont.truetype(font_condensed_path, 34)
text_size = section_info_draw.textsize(text, font)
loc = (1050, 355)
section_info_draw.text(loc, text, (14, 42, 28), font=font, anchor="ra")
@@ -310,7 +278,6 @@ def gen_results_image(
text = "VS"
else:
text = "AT"
text_size = section_title_draw.textsize(text, font)
loc = (540, 120)
color = (255, 255, 255)
section_title_draw.text(loc, text, color, font=font, anchor="mm")