Skip to content

Commit 7f4a970

Browse files
Merge pull request #2316 from VWS-Python/common-io-type
Use consistent way of setting image type
2 parents cbc71a9 + 664f150 commit 7f4a970

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/vws/query.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
"""
44

55
import datetime
6+
import io
67
import json
78
from http import HTTPMethod, HTTPStatus
8-
from io import BufferedRandom, BytesIO
99
from typing import Any
1010
from urllib.parse import urljoin
1111

@@ -29,7 +29,7 @@
2929
from vws.reports import QueryResult, TargetData
3030

3131

32-
def _get_image_data(image: BytesIO | BufferedRandom) -> bytes:
32+
def _get_image_data(image: io.BytesIO | io.BufferedRandom) -> bytes:
3333
"""Get the data of an image file."""
3434
original_tell = image.tell()
3535
image.seek(0)
@@ -61,7 +61,7 @@ def __init__(
6161

6262
def query(
6363
self,
64-
image: BytesIO | BufferedRandom,
64+
image: io.BytesIO | io.BufferedRandom,
6565
max_num_results: int = 1,
6666
include_target_data: CloudRecoIncludeTargetData = (
6767
CloudRecoIncludeTargetData.TOP

src/vws/vws.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import time
99
from datetime import date
1010
from http import HTTPMethod, HTTPStatus
11-
from io import BufferedRandom, BytesIO
11+
from io import BufferedRandom
1212
from urllib.parse import urljoin
1313

1414
import requests
@@ -49,7 +49,7 @@
4949
from .exceptions.response import Response
5050

5151

52-
def _get_image_data(image: BytesIO | BufferedRandom) -> bytes:
52+
def _get_image_data(image: io.BytesIO | BufferedRandom) -> bytes:
5353
"""Get the data of an image file."""
5454
original_tell = image.tell()
5555
image.seek(0)
@@ -234,7 +234,7 @@ def add_target(
234234
self,
235235
name: str,
236236
width: float,
237-
image: BytesIO | BufferedRandom,
237+
image: io.BytesIO | io.BufferedRandom,
238238
application_metadata: str | None,
239239
*,
240240
active_flag: bool,

0 commit comments

Comments
 (0)