@@ -37,22 +37,20 @@ class FloatOption:
3737 description : Optional [str ]
3838 parser_flags : ParserFlags
3939
40- MemeOption = Union [BooleanOption , StringOption , IntegerOption , FloatOption ]
41-
4240class MemeParams :
4341 min_images : int
4442 max_images : int
4543 min_texts : int
4644 max_texts : int
4745 default_texts : list [str ]
48- options : list [MemeOption ]
46+ options : list [Union [ BooleanOption , StringOption , IntegerOption , FloatOption ] ]
4947
5048class MemeShortcut :
5149 pattern : str
5250 humanized : Optional [str ]
5351 names : list [str ]
5452 texts : list [str ]
55- options : dict [str , OptionValue ]
53+ options : dict [str , Union [ bool , str , int , float ] ]
5654
5755class MemeInfo :
5856 key : str
@@ -94,21 +92,6 @@ class TextOverLength:
9492class MemeFeedback :
9593 feedback : str
9694
97- OptionValue = Union [bool , str , int , float ]
98-
99- MemeError = Union [
100- ImageDecodeError ,
101- ImageEncodeError ,
102- ImageAssetMissing ,
103- DeserializeError ,
104- ImageNumberMismatch ,
105- TextNumberMismatch ,
106- TextOverLength ,
107- MemeFeedback ,
108- ]
109-
110- MemeResult = Union [bytes , MemeError ]
111-
11295class Meme :
11396 @property
11497 def key (self ) -> str : ...
@@ -118,9 +101,31 @@ class Meme:
118101 self ,
119102 images : list [Image ],
120103 text : list [str ],
121- options : dict [str , OptionValue ],
122- ) -> MemeResult : ...
123- def generate_preview (self ) -> MemeResult : ...
104+ options : dict [str , Union [bool , str , int , float ]],
105+ ) -> Union [
106+ bytes ,
107+ ImageDecodeError ,
108+ ImageEncodeError ,
109+ ImageAssetMissing ,
110+ DeserializeError ,
111+ ImageNumberMismatch ,
112+ TextNumberMismatch ,
113+ TextOverLength ,
114+ MemeFeedback ,
115+ ]: ...
116+ def generate_preview (
117+ self ,
118+ ) -> Union [
119+ bytes ,
120+ ImageDecodeError ,
121+ ImageEncodeError ,
122+ ImageAssetMissing ,
123+ DeserializeError ,
124+ ImageNumberMismatch ,
125+ TextNumberMismatch ,
126+ TextOverLength ,
127+ MemeFeedback ,
128+ ]: ...
124129
125130class MemeProperties :
126131 def __new__ (cls , disabled : bool = False , hot : bool = False , new : bool = False ): ...
@@ -150,9 +155,9 @@ def render_meme_list(
150155 sort_reverse : bool = False ,
151156 text_template : str = "{index}. {keywords}" ,
152157 add_category_icon : bool = True ,
153- ) -> MemeResult : ...
158+ ) -> Union [ bytes , ImageEncodeError ] : ...
154159def render_meme_statistics (
155160 title : str ,
156161 statistics_type : MemeStatisticsType ,
157162 data : list [tuple [str , int ]],
158- ) -> MemeResult : ...
163+ ) -> Union [ bytes , ImageEncodeError ] : ...
0 commit comments