|
5 | 5 | https://developer.vuforia.com/library/web-api/cloud-targets-web-services-api |
6 | 6 | """ |
7 | 7 |
|
8 | | -from __future__ import annotations |
9 | | - |
10 | 8 | import base64 |
11 | 9 | import dataclasses |
12 | 10 | import datetime |
13 | 11 | import email.utils |
14 | 12 | import uuid |
| 13 | +from collections.abc import Callable |
15 | 14 | from http import HTTPMethod, HTTPStatus |
16 | 15 | from typing import TYPE_CHECKING |
17 | 16 | from zoneinfo import ZoneInfo |
|
26 | 25 | TargetStatusProcessingError, |
27 | 26 | ValidatorError, |
28 | 27 | ) |
| 28 | +from mock_vws.image_matchers import ImageMatcher |
29 | 29 | from mock_vws.target import Target |
| 30 | +from mock_vws.target_manager import TargetManager |
| 31 | +from mock_vws.target_raters import TargetTrackingRater |
30 | 32 |
|
31 | 33 | if TYPE_CHECKING: |
32 | | - from collections.abc import Callable |
33 | | - |
34 | 34 | from requests_mock.request import Request |
35 | 35 | from requests_mock.response import Context |
36 | 36 |
|
37 | | - from mock_vws.image_matchers import ImageMatcher |
38 | | - from mock_vws.target_manager import TargetManager |
39 | | - from mock_vws.target_raters import TargetTrackingRater |
40 | 37 |
|
41 | 38 | _TARGET_ID_PATTERN = "[A-Za-z0-9]+" |
42 | 39 |
|
@@ -81,7 +78,7 @@ def decorator(method: Callable[..., str]) -> Callable[..., str]: |
81 | 78 | return decorator |
82 | 79 |
|
83 | 80 |
|
84 | | -def _body_bytes(request: Request) -> bytes: |
| 81 | +def _body_bytes(request: "Request") -> bytes: |
85 | 82 | """ |
86 | 83 | Return the body of a request as bytes. |
87 | 84 | """ |
@@ -133,7 +130,7 @@ def __init__( |
133 | 130 | path_pattern="/targets", |
134 | 131 | http_methods={HTTPMethod.POST}, |
135 | 132 | ) |
136 | | - def add_target(self, request: Request, context: Context) -> str: |
| 133 | + def add_target(self, request: "Request", context: "Context") -> str: |
137 | 134 | """ |
138 | 135 | Add a target. |
139 | 136 |
|
@@ -210,7 +207,7 @@ def add_target(self, request: Request, context: Context) -> str: |
210 | 207 | path_pattern=f"/targets/{_TARGET_ID_PATTERN}", |
211 | 208 | http_methods={HTTPMethod.DELETE}, |
212 | 209 | ) |
213 | | - def delete_target(self, request: Request, context: Context) -> str: |
| 210 | + def delete_target(self, request: "Request", context: "Context") -> str: |
214 | 211 | """ |
215 | 212 | Delete a target. |
216 | 213 |
|
@@ -277,7 +274,7 @@ def delete_target(self, request: Request, context: Context) -> str: |
277 | 274 | return body_json |
278 | 275 |
|
279 | 276 | @route(path_pattern="/summary", http_methods={HTTPMethod.GET}) |
280 | | - def database_summary(self, request: Request, context: Context) -> str: |
| 277 | + def database_summary(self, request: "Request", context: "Context") -> str: |
281 | 278 | """ |
282 | 279 | Get a database summary report. |
283 | 280 |
|
@@ -343,7 +340,7 @@ def database_summary(self, request: Request, context: Context) -> str: |
343 | 340 | return body_json |
344 | 341 |
|
345 | 342 | @route(path_pattern="/targets", http_methods={HTTPMethod.GET}) |
346 | | - def target_list(self, request: Request, context: Context) -> str: |
| 343 | + def target_list(self, request: "Request", context: "Context") -> str: |
347 | 344 | """ |
348 | 345 | Get a list of all targets. |
349 | 346 |
|
@@ -403,7 +400,7 @@ def target_list(self, request: Request, context: Context) -> str: |
403 | 400 | path_pattern=f"/targets/{_TARGET_ID_PATTERN}", |
404 | 401 | http_methods={HTTPMethod.GET}, |
405 | 402 | ) |
406 | | - def get_target(self, request: Request, context: Context) -> str: |
| 403 | + def get_target(self, request: "Request", context: "Context") -> str: |
407 | 404 | """ |
408 | 405 | Get details of a target. |
409 | 406 |
|
@@ -471,7 +468,7 @@ def get_target(self, request: Request, context: Context) -> str: |
471 | 468 | path_pattern=f"/duplicates/{_TARGET_ID_PATTERN}", |
472 | 469 | http_methods={HTTPMethod.GET}, |
473 | 470 | ) |
474 | | - def get_duplicates(self, request: Request, context: Context) -> str: |
| 471 | + def get_duplicates(self, request: "Request", context: "Context") -> str: |
475 | 472 | """ |
476 | 473 | Get targets which may be considered duplicates of a given target. |
477 | 474 |
|
@@ -545,7 +542,7 @@ def get_duplicates(self, request: Request, context: Context) -> str: |
545 | 542 | path_pattern=f"/targets/{_TARGET_ID_PATTERN}", |
546 | 543 | http_methods={HTTPMethod.PUT}, |
547 | 544 | ) |
548 | | - def update_target(self, request: Request, context: Context) -> str: |
| 545 | + def update_target(self, request: "Request", context: "Context") -> str: |
549 | 546 | """ |
550 | 547 | Update a target. |
551 | 548 |
|
@@ -654,7 +651,7 @@ def update_target(self, request: Request, context: Context) -> str: |
654 | 651 | path_pattern=f"/summary/{_TARGET_ID_PATTERN}", |
655 | 652 | http_methods={HTTPMethod.GET}, |
656 | 653 | ) |
657 | | - def target_summary(self, request: Request, context: Context) -> str: |
| 654 | + def target_summary(self, request: "Request", context: "Context") -> str: |
658 | 655 | """ |
659 | 656 | Get a summary report for a target. |
660 | 657 |
|
|
0 commit comments