Skip to content

Commit 5381672

Browse files
committed
Type check urllib3
1 parent 999dddf commit 5381672

File tree

3 files changed

+10
-13
lines changed

3 files changed

+10
-13
lines changed

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,7 @@ dev = [
258258
"sphinxcontrib-spelling==8.0.0",
259259
"sybil==5.0.0",
260260
"types-requests==2.28.11.16",
261+
"types-urllib3==1.26.25.9",
261262
"vulture==2.7",
262263
]
263264

src/vws/include_target_data.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,16 @@
22
Tools for managing ``CloudRecoService.query``'s ``include_target_data``.
33
"""
44

5-
from enum import Enum
65

6+
from enum import StrEnum, auto
77

8-
class CloudRecoIncludeTargetData(Enum):
8+
9+
class CloudRecoIncludeTargetData(StrEnum):
910
"""
1011
Options for the ``include_target_data`` parameter of
1112
``CloudRecoService.query``.
1213
"""
1314

14-
TOP = "top"
15-
NONE = "none"
16-
ALL = "all"
15+
TOP = auto()
16+
NONE = auto()
17+
ALL = auto()

src/vws/query.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
import datetime
88
from http import HTTPStatus
9-
from typing import BinaryIO
9+
from typing import Any, BinaryIO
1010
from urllib.parse import urljoin
1111

1212
import requests
@@ -102,7 +102,7 @@ def query(
102102
An ordered list of target details of matching targets.
103103
"""
104104
image_content = _get_image_data(image=image)
105-
body = {
105+
body: dict[str, Any] = {
106106
"image": ("image.jpeg", image_content, "image/jpeg"),
107107
"max_num_results": (None, int(max_num_results), "text/plain"),
108108
"include_target_data": (
@@ -113,12 +113,7 @@ def query(
113113
}
114114
date = rfc_1123_date()
115115
request_path = "/v1/query"
116-
(
117-
content,
118-
content_type_header,
119-
) = encode_multipart_formdata( # type:ignore[no-untyped-call]
120-
fields=body,
121-
)
116+
content, content_type_header = encode_multipart_formdata(fields=body)
122117
method = "POST"
123118

124119
authorization_string = authorization_header(

0 commit comments

Comments
 (0)