1- from attr import dataclass , Factory
21from pathlib import Path
32from typing import List
3+
4+ from attr import Factory , dataclass
45from PIL import Image , ImageDraw , ImageFont
56
67# TODO: this only works for MacOS
@@ -17,12 +18,12 @@ def create(self):
1718 suffix = Path (name ).suffix
1819 if suffix == ".ttf" :
1920 if not self .size :
20- raise ValueError (f "Size must be set for Truetype fonts" )
21+ raise ValueError ("Size must be set for Truetype fonts" )
2122 return ImageFont .truetype (name , self .size )
2223
2324 if suffix == ".pil" :
2425 if self .size :
25- raise ValueError (f "Size cannot be set for Bitmap fonts" )
26+ raise ValueError ("Size cannot be set for Bitmap fonts" )
2627 return ImageFont .load (name )
2728
2829 raise ValueError (f"Do not understand font { name } " )
@@ -33,8 +34,8 @@ class Cover:
3334 title : str = ""
3435 image : str = ""
3536 font : Font = Factory (Font )
36- margin : List [int ] = Factory (lambda : [75 , 50 ])
37- size : List [int ] = Factory (lambda : [1600 , 2560 ])
37+ margin : list [int ] = Factory (lambda : [75 , 50 ])
38+ size : list [int ] = Factory (lambda : [1600 , 2560 ])
3839
3940 def render (self ):
4041 image = Image .new ("RGB" , self .size , "white" )
0 commit comments