88import logging
99import sys
1010from pathlib import Path
11- from typing import Annotated , List , NoReturn , Optional
11+ from typing import Annotated , NoReturn
1212
1313import typer
1414from rich .console import Console
@@ -109,7 +109,7 @@ def list_devices() -> NoReturn:
109109def default (
110110 ctx : typer .Context ,
111111 version : Annotated [
112- Optional [ bool ] ,
112+ bool | None ,
113113 typer .Option (
114114 "--version" ,
115115 callback = version_callback ,
@@ -118,7 +118,7 @@ def default(
118118 ),
119119 ] = None ,
120120 device_pattern : Annotated [
121- Optional [ List [ str ]] ,
121+ list [ str ] | None ,
122122 typer .Option (
123123 "--device" ,
124124 help = (
@@ -129,7 +129,7 @@ def default(
129129 ),
130130 ] = None ,
131131 text : Annotated [
132- Optional [ List [ str ]] ,
132+ list [ str ] | None ,
133133 typer .Argument (
134134 help = "Text, each parameter gives a new line" ,
135135 rich_help_panel = "Elements" ,
@@ -160,25 +160,25 @@ def default(
160160 ),
161161 ] = Direction .LEFT ,
162162 sample_pattern : Annotated [
163- Optional [ int ] ,
163+ int | None ,
164164 typer .Option (help = "Prints test pattern of a desired dot height [px]" ),
165165 ] = None ,
166166 min_length : Annotated [
167- Optional [ float ] ,
167+ float | None ,
168168 typer .Option (
169169 help = "Minimum label length [mm], add whitespace if smaller" ,
170170 rich_help_panel = "Label Dimensions" ,
171171 ),
172172 ] = None ,
173173 max_length : Annotated [
174- Optional [ float ] ,
174+ float | None ,
175175 typer .Option (
176176 help = "Maximum label length [mm], error if the label won't fit" ,
177177 rich_help_panel = "Label Dimensions" ,
178178 ),
179179 ] = None ,
180180 fixed_length : Annotated [
181- Optional [ float ] ,
181+ float | None ,
182182 typer .Option (
183183 help = "Fixed label length [mm], set both minimum and maximum length" ,
184184 rich_help_panel = "Label Dimensions" ,
@@ -189,13 +189,13 @@ def default(
189189 typer .Option (help = "Destination of the label render" ),
190190 ] = Output .PRINTER ,
191191 font : Annotated [
192- Optional [ str ] ,
192+ str | None ,
193193 typer .Option (
194194 help = "User font. Overrides --style parameter" , rich_help_panel = "Design"
195195 ),
196196 ] = None ,
197197 qr_content : Annotated [
198- Optional [ str ] ,
198+ str | None ,
199199 typer .Option (
200200 "--qr" , callback = qr_callback , help = "QR code" , rich_help_panel = "Elements"
201201 ),
@@ -205,7 +205,7 @@ def default(
205205 typer .Option (help = "Read batch commands from stdin" , rich_help_panel = "Elements" ),
206206 ] = False ,
207207 barcode_content : Annotated [
208- Optional [ str ] ,
208+ str | None ,
209209 typer .Option ("--barcode" , help = "Barcode" , rich_help_panel = "Elements" ),
210210 ] = None ,
211211 barcode_type : Annotated [
@@ -216,13 +216,13 @@ def default(
216216 ),
217217 ] = DEFAULT_BARCODE_TYPE ,
218218 barcode_with_text_content : Annotated [
219- Optional [ str ] ,
219+ str | None ,
220220 typer .Option (
221221 "--barcode-with-text" , help = "Barcode with text" , rich_help_panel = "Elements"
222222 ),
223223 ] = None ,
224224 picture : Annotated [
225- Optional [ Path ] , typer .Option (help = "Picture" , rich_help_panel = "Elements" )
225+ Path | None , typer .Option (help = "Picture" , rich_help_panel = "Elements" )
226226 ] = None ,
227227 margin_px : Annotated [
228228 float ,
@@ -235,7 +235,7 @@ def default(
235235 typer .Option (help = "Scaling font factor, [0,100] [%]" , rich_help_panel = "Design" ),
236236 ] = 90 ,
237237 tape_size_mm : Annotated [
238- Optional [ int ] ,
238+ int | None ,
239239 typer .Option (help = "Tape size [mm]" , rich_help_panel = "Device Configuration" ),
240240 ] = None ,
241241 # Old dymoprint arguments
@@ -281,94 +281,94 @@ def default(
281281 ),
282282 ] = False ,
283283 old_style : Annotated [
284- Optional [ str ] ,
284+ str | None ,
285285 typer .Option (
286286 "-s" ,
287287 help = "DEPRECATED" ,
288288 hidden = True ,
289289 ),
290290 ] = None ,
291291 old_align : Annotated [
292- Optional [ str ] ,
292+ str | None ,
293293 typer .Option (
294294 "-a" ,
295295 help = "DEPRECATED" ,
296296 hidden = True ,
297297 ),
298298 ] = None ,
299299 old_font : Annotated [
300- Optional [ str ] ,
300+ str | None ,
301301 typer .Option (
302302 "-u" ,
303303 help = "DEPRECATED" ,
304304 hidden = True ,
305305 ),
306306 ] = None ,
307307 old_barcode : Annotated [
308- Optional [ str ] ,
308+ str | None ,
309309 typer .Option (
310310 "-c" ,
311311 help = "DEPRECATED" ,
312312 hidden = True ,
313313 ),
314314 ] = None ,
315315 barcode_text : Annotated [
316- Optional [ str ] ,
316+ str | None ,
317317 typer .Option (
318318 "--barcode-text" ,
319319 help = "DEPRECATED" ,
320320 hidden = True ,
321321 ),
322322 ] = None ,
323323 old_picture : Annotated [
324- Optional [ str ] ,
324+ str | None ,
325325 typer .Option (
326326 "-p" ,
327327 help = "DEPRECATED" ,
328328 hidden = True ,
329329 ),
330330 ] = None ,
331331 old_margin : Annotated [
332- Optional [ int ] ,
332+ int | None ,
333333 typer .Option (
334334 "-m" ,
335335 help = "DEPRECATED" ,
336336 hidden = True ,
337337 ),
338338 ] = None ,
339339 scale : Annotated [
340- Optional [ float ] ,
340+ float | None ,
341341 typer .Option (
342342 help = "DEPRECATED" ,
343343 hidden = True ,
344344 ),
345345 ] = None ,
346346 old_tape_size : Annotated [
347- Optional [ int ] ,
347+ int | None ,
348348 typer .Option (
349349 "-t" ,
350350 help = "DEPRECATED" ,
351351 hidden = True ,
352352 ),
353353 ] = None ,
354354 old_min_length : Annotated [
355- Optional [ float ] ,
355+ float | None ,
356356 typer .Option (
357357 "-l" ,
358358 help = "DEPRECATED" ,
359359 hidden = True ,
360360 ),
361361 ] = None ,
362362 old_justify : Annotated [
363- Optional [ str ] ,
363+ str | None ,
364364 typer .Option (
365365 "-j" ,
366366 help = "DEPRECATED" ,
367367 hidden = True ,
368368 ),
369369 ] = None ,
370370 test_pattern : Annotated [
371- Optional [ int ] ,
371+ int | None ,
372372 typer .Option (
373373 help = "DEPRECATED" ,
374374 hidden = True ,
@@ -504,9 +504,9 @@ def render_text(lines):
504504 render_engines .append (PictureRenderEngine (picture ))
505505
506506 if batch :
507- accumulator : List [str ] = []
507+ accumulator : list [str ] = []
508508 accumulator_type : str = "empty"
509- accumulator_options : List [str ] = []
509+ accumulator_options : list [str ] = []
510510
511511 def flush_all ():
512512 nonlocal accumulator
0 commit comments