Skip to content

Commit 1d41b9e

Browse files
committed
Progress towards using all new annotations
1 parent 74cd1b8 commit 1d41b9e

File tree

5 files changed

+14
-15
lines changed

5 files changed

+14
-15
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717

1818
strategy:
1919
matrix:
20-
python-version: [3.8]
20+
python-version: [3.9]
2121
platform: [ubuntu-latest]
2222

2323
runs-on: ${{ matrix.platform }}

src/vws/query.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
import datetime
88
import io
9-
from typing import Optional
109
from urllib.parse import urljoin
1110

1211
import requests
@@ -158,7 +157,7 @@ def query(
158157
result = []
159158
result_list = list(response.json()['results'])
160159
for item in result_list:
161-
target_data: Optional[TargetData] = None
160+
target_data: TargetData | None = None
162161
if 'target_data' in item:
163162
target_data_dict = item['target_data']
164163
metadata = target_data_dict['application_metadata']

src/vws/reports.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ class TargetData:
8787
"""
8888

8989
name: str
90-
application_metadata: Optional[str]
90+
application_metadata: str | None
9191
target_timestamp: datetime.datetime
9292

9393

@@ -101,7 +101,7 @@ class QueryResult:
101101
"""
102102

103103
target_id: str
104-
target_data: Optional[TargetData]
104+
target_data: TargetData | None
105105

106106

107107
@dataclass

src/vws/vws.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -199,10 +199,10 @@ def _make_request(
199199
def add_target(
200200
self,
201201
name: str,
202-
width: Union[int, float],
202+
width: int | float,
203203
image: io.BytesIO,
204204
active_flag: bool,
205-
application_metadata: Optional[str],
205+
application_metadata: str | None,
206206
) -> str:
207207
"""
208208
Add a target to a Vuforia Web Services database.
@@ -357,7 +357,7 @@ def wait_for_target_processed(
357357
self,
358358
target_id: str,
359359
seconds_between_requests: float = 0.2,
360-
timeout_seconds: Optional[float] = 60 * 5,
360+
timeout_seconds: float | None = 60 * 5,
361361
) -> None:
362362
"""
363363
Wait up to five minutes (arbitrary) for a target to get past the
@@ -584,11 +584,11 @@ def get_duplicate_targets(self, target_id: str) -> list[str]:
584584
def update_target(
585585
self,
586586
target_id: str,
587-
name: Optional[str] = None,
588-
width: Optional[Union[int, float]] = None,
589-
image: Optional[io.BytesIO] = None,
590-
active_flag: Optional[bool] = None,
591-
application_metadata: Optional[str] = None,
587+
name: str | None = None,
588+
width: int | float | None = None,
589+
image: io.BytesIO | None = None,
590+
active_flag: bool | None = None,
591+
application_metadata: str | None = None,
592592
) -> None:
593593
"""
594594
Add a target to a Vuforia Web Services database.
@@ -631,7 +631,7 @@ def update_target(
631631
~vws.exceptions.vws_exceptions.RequestTimeTooSkewed: There is an
632632
error with the time sent to Vuforia.
633633
"""
634-
data: Dict[str, Union[str, bool, float, int]] = {}
634+
data: Dict[str, str | bool | float| int] = {}
635635

636636
if name is not None:
637637
data['name'] = name

tests/test_vws.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def test_add_target(
3636
vws_client: VWS,
3737
high_quality_image: io.BytesIO,
3838
active_flag: bool,
39-
application_metadata: Optional[bytes],
39+
application_metadata: bytes | None,
4040
cloud_reco_client: CloudRecoService,
4141
) -> None:
4242
"""

0 commit comments

Comments
 (0)