2323from contextlib import contextmanager
2424from pathlib import Path
2525from queue import Empty , Queue
26- from typing import Optional
2726
2827import psutil
2928from twisterlib .environment import ZEPHYR_BASE , strip_ansi_sequences
@@ -71,7 +70,7 @@ def terminate_process(proc):
7170
7271class Handler :
7372 def __init__ (self , instance , type_str : str , options : argparse .Namespace ,
74- generator_cmd : Optional [ str ] = None , suite_name_check : bool = True ):
73+ generator_cmd : str | None = None , suite_name_check : bool = True ):
7574 """Constructor
7675
7776 """
@@ -175,7 +174,7 @@ def get_default_domain_build_dir(self):
175174
176175
177176class BinaryHandler (Handler ):
178- def __init__ (self , instance , type_str : str , options : argparse .Namespace , generator_cmd : Optional [ str ] = None ,
177+ def __init__ (self , instance , type_str : str , options : argparse .Namespace , generator_cmd : str | None = None ,
179178 suite_name_check : bool = True ):
180179 """Constructor
181180
@@ -186,7 +185,7 @@ def __init__(self, instance, type_str: str, options: argparse.Namespace, generat
186185 self .seed = None
187186 self .extra_test_args = None
188187 self .line = b""
189- self .binary : Optional [ str ] = None
188+ self .binary : str | None = None
190189
191190 def try_kill_process_by_pid (self ):
192191 if self .pid_fn :
@@ -374,7 +373,7 @@ def handle(self, harness):
374373
375374
376375class SimulationHandler (BinaryHandler ):
377- def __init__ (self , instance , type_str : str , options : argparse .Namespace , generator_cmd : Optional [ str ] = None ,
376+ def __init__ (self , instance , type_str : str , options : argparse .Namespace , generator_cmd : str | None = None ,
378377 suite_name_check : bool = True ):
379378 """Constructor
380379
@@ -827,7 +826,7 @@ class QEMUHandler(Handler):
827826 for these to collect whether the test passed or failed.
828827 """
829828
830- def __init__ (self , instance , type_str : str , options : argparse .Namespace , generator_cmd : Optional [ str ] = None ,
829+ def __init__ (self , instance , type_str : str , options : argparse .Namespace , generator_cmd : str | None = None ,
831830 suite_name_check : bool = True ):
832831 """Constructor
833832
@@ -1117,7 +1116,7 @@ class QEMUWinHandler(Handler):
11171116 for these to collect whether the test passed or failed.
11181117 """
11191118
1120- def __init__ (self , instance , type_str : str , options : argparse .Namespace , generator_cmd : Optional [ str ] = None ,
1119+ def __init__ (self , instance , type_str : str , options : argparse .Namespace , generator_cmd : str | None = None ,
11211120 suite_name_check : bool = True ):
11221121 """Constructor
11231122
0 commit comments