Skip to content

Commit 76e4aaa

Browse files
committed
Remove from __future__ import annotations
This conflicts with beartype and just isn't necessary.
1 parent dd18f11 commit 76e4aaa

File tree

8 files changed

+16
-45
lines changed

8 files changed

+16
-45
lines changed

docs/source/conf.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,12 @@
6262
"python": ("https://docs.python.org/3.12", None),
6363
}
6464
nitpicky = True
65-
nitpick_ignore = (("py:class", "BytesIO"), ("py:class", "BufferedRandom"))
65+
nitpick_ignore = (
66+
("py:class", "BytesIO"),
67+
("py:class", "BufferedRandom"),
68+
("py:class", "_io.BytesIO"),
69+
("py:class", "_io.BufferedRandom"),
70+
)
6671
warning_is_error = True
6772

6873
autoclass_content = "both"

src/vws/exceptions/base_exceptions.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,7 @@
33
Cloud Recognition Web API.
44
"""
55

6-
from __future__ import annotations
7-
8-
from typing import TYPE_CHECKING
9-
10-
if TYPE_CHECKING:
11-
from .response import Response
6+
from .response import Response
127

138

149
class CloudRecoError(Exception):

src/vws/query.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,11 @@
22
Tools for interacting with the Vuforia Cloud Recognition Web APIs.
33
"""
44

5-
from __future__ import annotations
6-
75
import datetime
86
import json
97
from http import HTTPMethod, HTTPStatus
10-
from typing import TYPE_CHECKING, Any
8+
from io import BufferedRandom, BytesIO
9+
from typing import Any
1110
from urllib.parse import urljoin
1211

1312
import requests
@@ -29,9 +28,6 @@
2928
from vws.include_target_data import CloudRecoIncludeTargetData
3029
from vws.reports import QueryResult, TargetData
3130

32-
if TYPE_CHECKING:
33-
from io import BufferedRandom, BytesIO
34-
3531

3632
def _get_image_data(image: BytesIO | BufferedRandom) -> bytes:
3733
"""Get the data of an image file."""

src/vws/vws.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,13 @@
22
Tools for interacting with Vuforia APIs.
33
"""
44

5-
from __future__ import annotations
6-
75
import base64
6+
import io
87
import json
98
import time
109
from datetime import date
1110
from http import HTTPMethod, HTTPStatus
12-
from typing import TYPE_CHECKING
11+
from io import BufferedRandom, BytesIO
1312
from urllib.parse import urljoin
1413

1514
import requests
@@ -49,10 +48,6 @@
4948

5049
from .exceptions.response import Response
5150

52-
if TYPE_CHECKING:
53-
import io
54-
from io import BufferedRandom, BytesIO
55-
5651

5752
def _get_image_data(image: BytesIO | BufferedRandom) -> bytes:
5853
"""Get the data of an image file."""

tests/conftest.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,16 @@
22
Configuration, plugins and fixtures for `pytest`.
33
"""
44

5-
from __future__ import annotations
6-
75
import io
8-
from typing import TYPE_CHECKING
6+
from collections.abc import Generator
7+
from pathlib import Path
98

109
import pytest
1110
from mock_vws import MockVWS
1211
from mock_vws.database import VuforiaDatabase
1312

1413
from vws import VWS, CloudRecoService
1514

16-
if TYPE_CHECKING:
17-
from collections.abc import Generator
18-
from pathlib import Path
19-
2015

2116
@pytest.fixture(name="_mock_database")
2217
def mock_database() -> Generator[VuforiaDatabase, None, None]:

tests/test_cloud_reco_exceptions.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,9 @@
22
Tests for exceptions raised when using the CloudRecoService.
33
"""
44

5-
from __future__ import annotations
6-
5+
import io
76
import uuid
87
from http import HTTPStatus
9-
from typing import TYPE_CHECKING
108

119
import pytest
1210
from mock_vws import MockVWS
@@ -26,9 +24,6 @@
2624
RequestEntityTooLargeError,
2725
)
2826

29-
if TYPE_CHECKING:
30-
import io
31-
3227

3328
def test_too_many_max_results(
3429
cloud_reco_client: CloudRecoService,

tests/test_query.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,15 @@
22
Tests for the ``CloudRecoService`` querying functionality.
33
"""
44

5-
from __future__ import annotations
6-
5+
import io
76
import uuid
8-
from typing import TYPE_CHECKING
97

108
from mock_vws import MockVWS
119
from mock_vws.database import VuforiaDatabase
1210

1311
from vws import VWS, CloudRecoService
1412
from vws.include_target_data import CloudRecoIncludeTargetData
1513

16-
if TYPE_CHECKING:
17-
import io
18-
1914

2015
class TestQuery:
2116
"""

tests/test_vws.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,11 @@
22
Tests for helper functions for managing a Vuforia database.
33
"""
44

5-
from __future__ import annotations
6-
75
import base64
86
import datetime
7+
import io
98
import secrets
109
import uuid
11-
from typing import TYPE_CHECKING
1210

1311
import pytest
1412
from freezegun import freeze_time
@@ -24,9 +22,6 @@
2422
TargetSummaryReport,
2523
)
2624

27-
if TYPE_CHECKING:
28-
import io
29-
3025

3126
class TestAddTarget:
3227
"""

0 commit comments

Comments
 (0)