Skip to content

Commit f653fbb

Browse files
committed
flake
1 parent 9c02c51 commit f653fbb

File tree

2 files changed

+6
-19
lines changed

2 files changed

+6
-19
lines changed

deepomatic/api/exceptions.py

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -26,35 +26,26 @@
2626
from tenacity import RetryError
2727
from requests import Response
2828

29-
###############################################################################
3029

3130
class DeepomaticException(Exception):
3231
def __init__(self, msg):
3332
super(DeepomaticException, self).__init__(msg)
3433

35-
###############################################################################
36-
3734

3835
class CredentialsNotFound(DeepomaticException):
3936
pass
4037

4138

42-
###############################################################################
43-
4439
class UnimplementedException(DeepomaticException):
4540
def __init__(self, msg):
4641
super(UnimplementedException, self).__init__(msg)
4742

4843

49-
###############################################################################
50-
5144
class NoData(DeepomaticException):
5245
def __init__(self):
5346
super(NoData, self).__init__("No data !! You may need to call '.retrieve()' ?")
5447

5548

56-
###############################################################################
57-
5849
class BadStatus(DeepomaticException):
5950
"""
6051
Thrown when HTTP response status_code < 200 or status_code >= 300.
@@ -93,8 +84,6 @@ class ServerError(BadStatus):
9384
pass
9485

9586

96-
###############################################################################
97-
9887
class TaskError(DeepomaticException):
9988
def __init__(self, task):
10089
self.task = task
@@ -106,8 +95,6 @@ def get_task_id(self):
10695
return self.task['id']
10796

10897

109-
###############################################################################
110-
11198
class TaskTimeout(DeepomaticException):
11299
def __init__(self, task, retry_error=None):
113100
self.task = task
@@ -120,9 +107,6 @@ def get_task_id(self):
120107
return self.task['id']
121108

122109

123-
###############################################################################
124-
125-
126110
class HTTPRetryError(RetryError):
127111
def __str__(self):
128112
last_exception = self.last_attempt.exception(timeout=0)

tests/test_client.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -352,9 +352,12 @@ def test_retry_network_failure(self):
352352
with pytest.raises(HTTPRetryError) as exc:
353353
print(spec.data()) # does make a http call
354354

355-
assert str(exc.value).startswith("""
356-
Last attempt was an exception <class 'requests.exceptions.ConnectionError'> "HTTPConnectionPool(host='invalid-domain.deepomatic.com', port=80): Max retries exceeded with url: /v0.7/recognition/public/imagenet-inception-v3/ (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at
357-
""".strip())
355+
assert str(exc.value).startswith(
356+
"""Last attempt was an exception <class 'requests.exceptions.ConnectionError'> \""""
357+
"""HTTPConnectionPool(host='invalid-domain.deepomatic.com', port=80): Max retries exceeded with url: """
358+
"""/v0.7/recognition/public/imagenet-inception-v3/ (Caused by NewConnectionError"""
359+
"""('<urllib3.connection.HTTPConnection object at"""
360+
)
358361
assert str(exc.value).endswith("""
359362
>: Failed to establish a new connection: [Errno -2] Name or service not known',))"
360363
""".strip())

0 commit comments

Comments
 (0)