1212import tempfile
1313import threading
1414import uuid
15- from typing import Any , Dict , List , Optional , Tuple
15+ from typing import Any , Optional
1616
1717if sys .platform == "win32" :
1818 from namedpipe import NPopen
@@ -63,7 +63,7 @@ def create_symlink(root: pathlib.Path, target_ext: str, destination_ext: str):
6363 print ("destination unlinked" , destination )
6464
6565
66- def process_data_received (data : str ) -> List [ Dict [str , Any ]]:
66+ def process_data_received (data : str ) -> list [ dict [str , Any ]]:
6767 """Process the all JSON data which comes from the server.
6868
6969 After listen is finished, this function will be called.
@@ -87,7 +87,7 @@ def process_data_received(data: str) -> List[Dict[str, Any]]:
8787 return json_messages # return the list of json messages
8888
8989
90- def parse_rpc_message (data : str ) -> Tuple [ Dict [str , str ], str ]:
90+ def parse_rpc_message (data : str ) -> tuple [ dict [str , str ], str ]:
9191 """Process the JSON data which comes from the server.
9292
9393 A single rpc payload is in the format:
@@ -128,7 +128,7 @@ def parse_rpc_message(data: str) -> Tuple[Dict[str, str], str]:
128128 print ("json decode error" )
129129
130130
131- def _listen_on_fifo (pipe_name : str , result : List [str ], completed : threading .Event ):
131+ def _listen_on_fifo (pipe_name : str , result : list [str ], completed : threading .Event ):
132132 # Open the FIFO for reading
133133 fifo_path = pathlib .Path (pipe_name )
134134 with fifo_path .open () as fifo :
@@ -144,7 +144,7 @@ def _listen_on_fifo(pipe_name: str, result: List[str], completed: threading.Even
144144 result .append (data )
145145
146146
147- def _listen_on_pipe_new (listener , result : List [str ], completed : threading .Event ):
147+ def _listen_on_pipe_new (listener , result : list [str ], completed : threading .Event ):
148148 """Listen on the named pipe or Unix domain socket for JSON data from the server.
149149
150150 Created as a separate function for clarity in threading context.
@@ -197,24 +197,24 @@ def _listen_on_pipe_new(listener, result: List[str], completed: threading.Event)
197197 result .append ("" .join (all_data ))
198198
199199
200- def _run_test_code (proc_args : List [str ], proc_env , proc_cwd : str , completed : threading .Event ):
200+ def _run_test_code (proc_args : list [str ], proc_env , proc_cwd : str , completed : threading .Event ):
201201 result = subprocess .run (proc_args , env = proc_env , cwd = proc_cwd )
202202 completed .set ()
203203 return result
204204
205205
206- def runner (args : List [str ]) -> Optional [List [ Dict [str , Any ]]]:
206+ def runner (args : list [str ]) -> Optional [list [ dict [str , Any ]]]:
207207 """Run a subprocess and a named-pipe to listen for messages at the same time with threading."""
208208 print ("\n Running python test subprocess with cwd set to: " , TEST_DATA_PATH )
209209 return runner_with_cwd (args , TEST_DATA_PATH )
210210
211211
212- def runner_with_cwd (args : List [str ], path : pathlib .Path ) -> Optional [List [ Dict [str , Any ]]]:
212+ def runner_with_cwd (args : list [str ], path : pathlib .Path ) -> Optional [list [ dict [str , Any ]]]:
213213 """Run a subprocess and a named-pipe to listen for messages at the same time with threading."""
214214 return runner_with_cwd_env (args , path , {})
215215
216216
217- def split_array_at_item (arr : List [str ], item : str ) -> Tuple [ List [str ], List [str ]]:
217+ def split_array_at_item (arr : list [str ], item : str ) -> tuple [ list [str ], list [str ]]:
218218 """
219219 Splits an array into two subarrays at the specified item.
220220
@@ -235,14 +235,14 @@ def split_array_at_item(arr: List[str], item: str) -> Tuple[List[str], List[str]
235235
236236
237237def runner_with_cwd_env (
238- args : List [str ], path : pathlib .Path , env_add : Dict [str , str ]
239- ) -> Optional [List [ Dict [str , Any ]]]:
238+ args : list [str ], path : pathlib .Path , env_add : dict [str , str ]
239+ ) -> Optional [list [ dict [str , Any ]]]:
240240 """
241241 Run a subprocess and a named-pipe to listen for messages at the same time with threading.
242242
243243 Includes environment variables to add to the test environment.
244244 """
245- process_args : List [str ]
245+ process_args : list [str ]
246246 pipe_name : str
247247 if "MANAGE_PY_PATH" in env_add :
248248 # If we are running Django, generate a unittest-specific pipe name.
0 commit comments