|
5 | 5 | https://library.vuforia.com/articles/Solution/How-To-Use-the-Vuforia-Web-Services-API |
6 | 6 | """ |
7 | 7 |
|
| 8 | +from __future__ import annotations |
| 9 | + |
8 | 10 | import base64 |
9 | 11 | import dataclasses |
10 | 12 | import datetime |
11 | 13 | import email.utils |
12 | 14 | import random |
13 | 15 | import uuid |
14 | 16 | from http import HTTPStatus |
15 | | -from typing import Callable, Dict, List, Set, Union |
| 17 | +from typing import Callable, Dict, Set |
16 | 18 |
|
17 | 19 | from backports.zoneinfo import ZoneInfo |
18 | 20 | from requests_mock import DELETE, GET, POST, PUT |
@@ -86,7 +88,7 @@ class MockVuforiaWebServicesAPI: |
86 | 88 | def __init__( |
87 | 89 | self, |
88 | 90 | target_manager: TargetManager, |
89 | | - processing_time_seconds: Union[int, float], |
| 91 | + processing_time_seconds: int | float, |
90 | 92 | ) -> None: |
91 | 93 | """ |
92 | 94 | Args: |
@@ -268,7 +270,7 @@ def database_summary( |
268 | 270 | context.status_code = exc.status_code |
269 | 271 | return exc.response_text |
270 | 272 |
|
271 | | - body: Dict[str, Union[str, int]] = {} |
| 273 | + body: Dict[str, str | int] = {} |
272 | 274 |
|
273 | 275 | database = get_database_matching_server_keys( |
274 | 276 | request_headers=request.headers, |
@@ -343,7 +345,7 @@ def target_list( |
343 | 345 | date = email.utils.formatdate(None, localtime=False, usegmt=True) |
344 | 346 |
|
345 | 347 | results = [target.target_id for target in database.not_deleted_targets] |
346 | | - body: Dict[str, Union[str, List[str]]] = { |
| 348 | + body: Dict[str, str | list[str]] = { |
347 | 349 | 'transaction_id': uuid.uuid4().hex, |
348 | 350 | 'result_code': ResultCodes.SUCCESS.value, |
349 | 351 | 'results': results, |
@@ -461,7 +463,7 @@ def get_duplicates( |
461 | 463 |
|
462 | 464 | other_targets = set(database.targets) - {target} |
463 | 465 |
|
464 | | - similar_targets: List[str] = [ |
| 466 | + similar_targets: list[str] = [ |
465 | 467 | other.target_id |
466 | 468 | for other in other_targets |
467 | 469 | if other.image_value == target.image_value |
|
0 commit comments