Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Make test work with python < 3.9.
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Mon, 14 Mar 2022 15:52:32 +0000 (16:52 +0100)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Mon, 14 Mar 2022 15:54:18 +0000 (16:54 +0100)
See https://stackoverflow.com/questions/39458193/using-list-tuple-etc-from-typing-vs-directly-referring-type-as-list-tuple-etc

Thanks @tocornebize and @bruno.donassolo for the hint

examples/python/comm-waitallfor/comm-waitallfor.py

index d7af786..207b327 100644 (file)
@@ -16,6 +16,7 @@ from argparse import ArgumentParser
 from dataclasses import dataclass
 from uuid import uuid4
 import sys
+import typing
 
 from simgrid import Actor, Comm, Engine, Host, Mailbox, PyGetAsync, this_actor
 
@@ -24,7 +25,7 @@ SIMULATED_JOB_SIZE_BYTES = 1024
 SIMULATED_RESULT_SIZE_BYTES = 1024 * 1024
 
 
-def parse_requests(requests_str: str) -> list[float]:
+def parse_requests(requests_str: str) -> typing.List[float]:
     return [float(item.strip()) for item in requests_str.split(",")]
 
 
@@ -88,7 +89,7 @@ class AsyncJobResult:
         return "complete" if self.complete else "pending"
 
 
-def client(client_id: str, jobs: list[float], wait_timeout: float):
+def client(client_id: str, jobs: typing.List[float], wait_timeout: float):
     worker_mailbox: Mailbox = Mailbox.by_name("worker")
     this_actor.info(f"{client_id} started")
     async_job_results: list[AsyncJobResult] = []