File tree Expand file tree Collapse file tree 2 files changed +35
-15
lines changed
Expand file tree Collapse file tree 2 files changed +35
-15
lines changed Original file line number Diff line number Diff line change 1+ """
2+ This is tooling for waiting for a target to be processed.
3+
4+ It lives here rather than in ``vws.py`` to support Windows.
5+ """
6+
7+ from typing import Optional
8+
9+ from wrapt_timeout_decorator import timeout
10+
11+ from vws import VWS
12+ from vws .exceptions import TargetProcessingTimeout
13+
14+
15+ def foobar (
16+ vws_client : VWS ,
17+ timeout_seconds : Optional [float ],
18+ seconds_between_requests : float ,
19+ target_id : str ,
20+ ):
21+
22+ @timeout (
23+ dec_timeout = timeout_seconds ,
24+ timeout_exception = TargetProcessingTimeout ,
25+ use_signals = False ,
26+ )
27+ def decorated () -> None :
28+ vws_client ._wait_for_target_processed (
29+ target_id = target_id ,
30+ seconds_between_requests = seconds_between_requests ,
31+ )
32+
33+ decorated ()
Original file line number Diff line number Diff line change 1212
1313import requests
1414from requests import Response
15- from wrapt_timeout_decorator import timeout
1615from vws_auth_tools import authorization_header , rfc_1123_date
1716
1817from vws ._result_codes import raise_for_result_code
19- from vws .exceptions import TargetProcessingTimeout
2018from vws .reports import (
2119 DatabaseSummaryReport ,
2220 TargetRecord ,
@@ -320,19 +318,8 @@ def wait_for_target_processed(
320318 ~vws.exceptions.RequestTimeTooSkewed: There is an error with the
321319 time sent to Vuforia.
322320 """
323-
324- @timeout (
325- dec_timeout = timeout_seconds ,
326- timeout_exception = TargetProcessingTimeout ,
327- use_signals = False ,
328- )
329- def decorated () -> None :
330- self ._wait_for_target_processed (
331- target_id = target_id ,
332- seconds_between_requests = seconds_between_requests ,
333- )
334-
335- decorated ()
321+ from _wait_for_target_processed import foobar
322+ foobar (vws_client = self )
336323
337324 def list_targets (self ) -> List [str ]:
338325 """
You can’t perform that action at this time.
0 commit comments