Skip to content

Commit a1addfc

Browse files
author
Xin Li
committed
use Union instead of | for 3.9 compatibility
1 parent c583ef1 commit a1addfc

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/flexible_inference_benchmark/engine/client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,12 @@ def request_func(
4646

4747
async def send_request(
4848
self, idx: int, data: RequestFuncInput, wait_time: float, pbar: Optional[tqdm]
49-
) -> Optional[RequestFuncOutput | Any]:
49+
) -> Optional[Union[RequestFuncOutput, Any]]:
5050
await asyncio.sleep(wait_time)
5151
return await self.request_func(idx, data, pbar, self.verbose, wait_time)
5252

5353
async def benchmark(
54-
self, data: List[Tuple[str, int, int]], request_times: List[float | int]
54+
self, data: List[Tuple[str, int, int]], request_times: List[Union[float, int]]
5555
) -> list[Union[RequestFuncOutput, Any, None]]:
5656
assert len(data) == len(request_times), "Data and request times must have the same length"
5757
pbar = None if self.disable_tqdm else tqdm(total=len(data))

src/flexible_inference_benchmark/main.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def select_distribution(args: List[Any]) -> Union[Distribution, Any]:
2424
return DISTRIBUTION_CLASSES[dist_type](*dist_args)
2525

2626

27-
def generate_request_times(args: argparse.Namespace) -> List[int | float]:
27+
def generate_request_times(args: argparse.Namespace) -> List[Union[int, float]]:
2828
if args.num_of_req:
2929
size = args.num_of_req
3030
dist = select_distribution(args.request_distribution)
@@ -94,7 +94,7 @@ def generate_prompts(args: argparse.Namespace, size: int) -> List[Tuple[str, int
9494

9595

9696
def send_requests(
97-
client: Client, requests_prompts: List[Tuple[str, int, int]], requests_times: List[int | float]
97+
client: Client, requests_prompts: List[Tuple[str, int, int]], requests_times: List[Union[int, float]]
9898
) -> List[Any]:
9999
return asyncio.run(client.benchmark(requests_prompts, requests_times))
100100

0 commit comments

Comments
 (0)