Skip to content

Commit 8486867

Browse files
[pre-commit.ci lite] apply automatic fixes
1 parent 6c82f4a commit 8486867

20 files changed

+100
-280
lines changed

conftest.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
"""
2-
Setup for Sybil.
3-
"""
1+
"""Setup for Sybil."""
42

53
import io
64
import uuid
@@ -21,9 +19,7 @@
2119

2220

2321
def pytest_collection_modifyitems(items: list[pytest.Item]) -> None:
24-
"""
25-
Apply the beartype decorator to all collected test functions.
26-
"""
22+
"""Apply the beartype decorator to all collected test functions."""
2723
for item in items:
2824
if isinstance(item, pytest.Function):
2925
item.obj = beartype(obj=item.obj)

docs/source/__init__.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
1-
"""
2-
Documentation.
3-
"""
1+
"""Documentation."""

docs/source/conf.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
#!/usr/bin/env python3
2-
"""
3-
Configuration for Sphinx.
4-
"""
2+
"""Configuration for Sphinx."""
53

64
import importlib.metadata
75
from pathlib import Path

src/vws/__init__.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
"""
2-
A library for Vuforia Web Services.
3-
"""
1+
"""A library for Vuforia Web Services."""
42

53
from .query import CloudRecoService
64
from .vws import VWS

src/vws/exceptions/__init__.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
1-
"""
2-
Custom exceptions raised by this package.
3-
"""
1+
"""Custom exceptions raised by this package."""

src/vws/exceptions/base_exceptions.py

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,7 @@
1010

1111
@beartype
1212
class CloudRecoError(Exception):
13-
"""
14-
Base class for Vuforia Cloud Recognition Web API exceptions.
15-
"""
13+
"""Base class for Vuforia Cloud Recognition Web API exceptions."""
1614

1715
def __init__(self, response: Response) -> None:
1816
"""
@@ -24,9 +22,7 @@ def __init__(self, response: Response) -> None:
2422

2523
@property
2624
def response(self) -> Response:
27-
"""
28-
The response returned by Vuforia which included this error.
29-
"""
25+
"""The response returned by Vuforia which included this error."""
3026
return self._response
3127

3228

@@ -48,7 +44,5 @@ def __init__(self, response: Response) -> None:
4844

4945
@property
5046
def response(self) -> Response:
51-
"""
52-
The response returned by Vuforia which included this error.
53-
"""
47+
"""The response returned by Vuforia which included this error."""
5448
return self._response
Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
"""
2-
Exceptions which match errors raised by the Vuforia Cloud Recognition Web APIs.
3-
"""
1+
"""Exceptions which match errors raised by the Vuforia Cloud Recognition Web APIs."""
42

53
from beartype import beartype
64

@@ -17,31 +15,27 @@ class MaxNumResultsOutOfRangeError(CloudRecoError):
1715

1816
@beartype
1917
class InactiveProjectError(CloudRecoError):
20-
"""
21-
Exception raised when Vuforia returns a response with a result code
18+
"""Exception raised when Vuforia returns a response with a result code
2219
'InactiveProject'.
2320
"""
2421

2522

2623
@beartype
2724
class BadImageError(CloudRecoError):
28-
"""
29-
Exception raised when Vuforia returns a response with a result code
25+
"""Exception raised when Vuforia returns a response with a result code
3026
'BadImage'.
3127
"""
3228

3329

3430
@beartype
3531
class AuthenticationFailureError(CloudRecoError):
36-
"""
37-
Exception raised when Vuforia returns a response with a result code
32+
"""Exception raised when Vuforia returns a response with a result code
3833
'AuthenticationFailure'.
3934
"""
4035

4136

4237
@beartype
4338
class RequestTimeTooSkewedError(CloudRecoError):
44-
"""
45-
Exception raised when Vuforia returns a response with a result code
39+
"""Exception raised when Vuforia returns a response with a result code
4640
'RequestTimeTooSkewed'.
4741
"""

src/vws/exceptions/custom_exceptions.py

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,7 @@
1111

1212
@beartype
1313
class RequestEntityTooLargeError(Exception):
14-
"""
15-
Exception raised when the given image is too large.
16-
"""
14+
"""Exception raised when the given image is too large."""
1715

1816
def __init__(self, response: Response) -> None:
1917
"""
@@ -25,24 +23,18 @@ def __init__(self, response: Response) -> None:
2523

2624
@property
2725
def response(self) -> Response:
28-
"""
29-
The response returned by Vuforia which included this error.
30-
"""
26+
"""The response returned by Vuforia which included this error."""
3127
return self._response
3228

3329

3430
@beartype
3531
class TargetProcessingTimeoutError(Exception):
36-
"""
37-
Exception raised when waiting for a target to be processed times out.
38-
"""
32+
"""Exception raised when waiting for a target to be processed times out."""
3933

4034

4135
@beartype
4236
class ServerError(Exception): # pragma: no cover
43-
"""
44-
Exception raised when VWS returns a server error.
45-
"""
37+
"""Exception raised when VWS returns a server error."""
4638

4739
def __init__(self, response: Response) -> None:
4840
"""
@@ -54,7 +46,5 @@ def __init__(self, response: Response) -> None:
5446

5547
@property
5648
def response(self) -> Response:
57-
"""
58-
The response returned by Vuforia which included this error.
59-
"""
49+
"""The response returned by Vuforia which included this error."""
6050
return self._response

src/vws/exceptions/vws_exceptions.py

Lines changed: 21 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,13 @@
1414

1515
@beartype
1616
class UnknownTargetError(VWSError):
17-
"""
18-
Exception raised when Vuforia returns a response with a result code
17+
"""Exception raised when Vuforia returns a response with a result code
1918
'UnknownTarget'.
2019
"""
2120

2221
@property
2322
def target_id(self) -> str:
24-
"""
25-
The unknown target ID.
26-
"""
23+
"""The unknown target ID."""
2724
path = urlparse(url=self.response.url).path
2825
# Every HTTP path which can raise this error is in the format
2926
# `/something/{target_id}`.
@@ -32,48 +29,40 @@ def target_id(self) -> str:
3229

3330
@beartype
3431
class FailError(VWSError):
35-
"""
36-
Exception raised when Vuforia returns a response with a result code 'Fail'.
37-
"""
32+
"""Exception raised when Vuforia returns a response with a result code 'Fail'."""
3833

3934

4035
@beartype
4136
class BadImageError(VWSError):
42-
"""
43-
Exception raised when Vuforia returns a response with a result code
37+
"""Exception raised when Vuforia returns a response with a result code
4438
'BadImage'.
4539
"""
4640

4741

4842
@beartype
4943
class AuthenticationFailureError(VWSError):
50-
"""
51-
Exception raised when Vuforia returns a response with a result code
44+
"""Exception raised when Vuforia returns a response with a result code
5245
'AuthenticationFailure'.
5346
"""
5447

5548

5649
# See https://github.com/VWS-Python/vws-python/issues/822.
5750
@beartype
5851
class RequestQuotaReachedError(VWSError): # pragma: no cover
59-
"""
60-
Exception raised when Vuforia returns a response with a result code
52+
"""Exception raised when Vuforia returns a response with a result code
6153
'RequestQuotaReached'.
6254
"""
6355

6456

6557
@beartype
6658
class TargetStatusProcessingError(VWSError):
67-
"""
68-
Exception raised when Vuforia returns a response with a result code
59+
"""Exception raised when Vuforia returns a response with a result code
6960
'TargetStatusProcessing'.
7061
"""
7162

7263
@property
7364
def target_id(self) -> str:
74-
"""
75-
The processing target ID.
76-
"""
65+
"""The processing target ID."""
7766
path = urlparse(url=self.response.url).path
7867
# Every HTTP path which can raise this error is in the format
7968
# `/something/{target_id}`.
@@ -83,100 +72,86 @@ def target_id(self) -> str:
8372
# This is not simulated by the mock.
8473
@beartype
8574
class DateRangeError(VWSError): # pragma: no cover
86-
"""
87-
Exception raised when Vuforia returns a response with a result code
75+
"""Exception raised when Vuforia returns a response with a result code
8876
'DateRangeError'.
8977
"""
9078

9179

9280
# This is not simulated by the mock.
9381
@beartype
9482
class TargetQuotaReachedError(VWSError): # pragma: no cover
95-
"""
96-
Exception raised when Vuforia returns a response with a result code
83+
"""Exception raised when Vuforia returns a response with a result code
9784
'TargetQuotaReached'.
9885
"""
9986

10087

10188
# This is not simulated by the mock.
10289
@beartype
10390
class ProjectSuspendedError(VWSError): # pragma: no cover
104-
"""
105-
Exception raised when Vuforia returns a response with a result code
91+
"""Exception raised when Vuforia returns a response with a result code
10692
'ProjectSuspended'.
10793
"""
10894

10995

11096
# This is not simulated by the mock.
11197
@beartype
11298
class ProjectHasNoAPIAccessError(VWSError): # pragma: no cover
113-
"""
114-
Exception raised when Vuforia returns a response with a result code
99+
"""Exception raised when Vuforia returns a response with a result code
115100
'ProjectHasNoAPIAccess'.
116101
"""
117102

118103

119104
@beartype
120105
class ProjectInactiveError(VWSError):
121-
"""
122-
Exception raised when Vuforia returns a response with a result code
106+
"""Exception raised when Vuforia returns a response with a result code
123107
'ProjectInactive'.
124108
"""
125109

126110

127111
@beartype
128112
class MetadataTooLargeError(VWSError):
129-
"""
130-
Exception raised when Vuforia returns a response with a result code
113+
"""Exception raised when Vuforia returns a response with a result code
131114
'MetadataTooLarge'.
132115
"""
133116

134117

135118
@beartype
136119
class RequestTimeTooSkewedError(VWSError):
137-
"""
138-
Exception raised when Vuforia returns a response with a result code
120+
"""Exception raised when Vuforia returns a response with a result code
139121
'RequestTimeTooSkewed'.
140122
"""
141123

142124

143125
@beartype
144126
class TargetNameExistError(VWSError):
145-
"""
146-
Exception raised when Vuforia returns a response with a result code
127+
"""Exception raised when Vuforia returns a response with a result code
147128
'TargetNameExist'.
148129
"""
149130

150131
@property
151132
def target_name(self) -> str:
152-
"""
153-
The target name which already exists.
154-
"""
133+
"""The target name which already exists."""
155134
response_body = self.response.request_body or b""
156135
request_json = json.loads(s=response_body)
157136
return str(object=request_json["name"])
158137

159138

160139
@beartype
161140
class ImageTooLargeError(VWSError):
162-
"""
163-
Exception raised when Vuforia returns a response with a result code
141+
"""Exception raised when Vuforia returns a response with a result code
164142
'ImageTooLarge'.
165143
"""
166144

167145

168146
@beartype
169147
class TargetStatusNotSuccessError(VWSError):
170-
"""
171-
Exception raised when Vuforia returns a response with a result code
148+
"""Exception raised when Vuforia returns a response with a result code
172149
'TargetStatusNotSuccess'.
173150
"""
174151

175152
@property
176153
def target_id(self) -> str:
177-
"""
178-
The unknown target ID.
179-
"""
154+
"""The unknown target ID."""
180155
path = urlparse(url=self.response.url).path
181156
# Every HTTP path which can raise this error is in the format
182157
# `/something/{target_id}`.
@@ -185,7 +160,6 @@ def target_id(self) -> str:
185160

186161
@beartype
187162
class TooManyRequestsError(VWSError): # pragma: no cover
188-
"""
189-
Exception raised when Vuforia returns a response with a result code
163+
"""Exception raised when Vuforia returns a response with a result code
190164
'TooManyRequests'.
191165
"""

src/vws/include_target_data.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
"""
2-
Tools for managing ``CloudRecoService.query``'s ``include_target_data``.
3-
"""
1+
"""Tools for managing ``CloudRecoService.query``'s ``include_target_data``."""
42

53
from enum import StrEnum, auto, unique
64

0 commit comments

Comments
 (0)