Skip to content

Commit 32bf03d

Browse files
authored
Drop support for Python 2.7 (#109)
1 parent fea7fcf commit 32bf03d

File tree

16 files changed

+45
-99
lines changed

16 files changed

+45
-99
lines changed

Makefile

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,8 @@ all: release
33
build: clean
44
# lint + unit tests + build egg (available in host ./dist)
55
dmake test build-egg
6-
# + test egg on python 2 and 3 using egg from host
7-
dmake test -s test-egg-py2:2.7
8-
dmake test -s test-egg-py3:3.6
6+
# + test egg on python 3 using egg from host
7+
dmake test -s test-egg-py3:3.8
98

109
clean:
1110
rm -rf dist

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
This client have been made in order to help you integrating our services within your apps in python.
66

7-
Tested on python 2.7, 3.4, 3.5, 3.6.
7+
Tested on python 3.8, 3.9, 3.10, 3.11.
88

99
# API Documentation
1010

deepomatic/api/exceptions.py

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

2828

29-
###############################################################################
30-
3129
class DeepomaticException(Exception):
3230
def __init__(self, msg):
3331
super(DeepomaticException, self).__init__(msg)
3432

35-
###############################################################################
36-
3733

3834
class CredentialsNotFound(DeepomaticException):
3935
pass
4036

4137

42-
###############################################################################
43-
4438
class UnimplementedException(DeepomaticException):
4539
def __init__(self, msg):
4640
super(UnimplementedException, self).__init__(msg)
4741

4842

49-
###############################################################################
50-
5143
class NoData(DeepomaticException):
5244
def __init__(self):
5345
super(NoData, self).__init__("No data !! You may need to call '.retrieve()' ?")
5446

5547

56-
###############################################################################
57-
5848
class BadStatus(DeepomaticException):
5949
"""
6050
Thrown when HTTP response status_code < 200 or status_code >= 300.
@@ -93,8 +83,6 @@ class ServerError(BadStatus):
9383
pass
9484

9585

96-
###############################################################################
97-
9886
class TaskError(DeepomaticException):
9987
def __init__(self, task):
10088
self.task = task
@@ -106,8 +94,6 @@ def get_task_id(self):
10694
return self.task['id']
10795

10896

109-
###############################################################################
110-
11197
class TaskTimeout(DeepomaticException):
11298
def __init__(self, task, retry_error=None):
11399
self.task = task
@@ -120,9 +106,6 @@ def get_task_id(self):
120106
return self.task['id']
121107

122108

123-
###############################################################################
124-
125-
126109
class HTTPRetryError(RetryError):
127110
pass
128111

deepomatic/api/inference.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
class InferenceResource(object):
77
def inference(self, return_task=False, wait_task=True, **kwargs):
8-
assert(self._pk is not None)
8+
assert (self._pk is not None)
99

1010
inputs = kwargs.pop('inputs', None)
1111
if inputs is None:

deepomatic/api/inputs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
###############################################################################
3333

3434
def format_inputs(inputs, data):
35-
assert(isinstance(inputs, list))
35+
assert (isinstance(inputs, list))
3636

3737
data = copy.deepcopy(data)
3838
files = {}

deepomatic/api/mixins.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def __init__(self):
5858

5959
class UpdatableResource(object):
6060
def update(self, replace=False, content_type='application/json', files=None, **kwargs):
61-
assert(self._pk is not None)
61+
assert (self._pk is not None)
6262

6363
if self._helper.check_query_parameters:
6464
for arg_name in kwargs:
@@ -78,7 +78,7 @@ def update(self, replace=False, content_type='application/json', files=None, **k
7878

7979
class DeletableResource(object):
8080
def delete(self):
81-
assert(self._pk is not None)
81+
assert (self._pk is not None)
8282
return self._helper.delete(self._uri(pk=self._pk))
8383

8484

deepomatic/api/resource.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def retrieve(self, pk):
4747
return self.__class__(self._helper, pk=pk)
4848

4949
def refresh(self):
50-
assert(self._pk is not None)
50+
assert (self._pk is not None)
5151
self._data = self._helper.get(self._uri(pk=self._pk))
5252
return self
5353

deepomatic/api/resources/recognition.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def get_base_uri(cls, pk, public=False, **kwargs):
5555
return '/recognition/public/' if public else '/recognition/specs/'
5656

5757
def versions(self, offset=0, limit=100):
58-
assert(self._pk is not None)
58+
assert (self._pk is not None)
5959
return ResourceList(RecognitionVersion, self._helper, self._uri(pk=self._pk, suffix='versions'), offset, limit)
6060

6161

deepomatic/api/resources/task.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ def list(self, task_ids):
7777
"""
7878
Returns a list of tasks
7979
"""
80-
assert(isinstance(task_ids, list))
80+
assert (isinstance(task_ids, list))
8181
return super(Task, self).list(task_ids=task_ids)
8282

8383
def wait(self, **retry_kwargs):

demo.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -343,11 +343,11 @@ def demo(client=None):
343343

344344
# pending_tasks, error_tasks and success_tasks contains the original offset of the input parameter tasks
345345
for pos, pending in pending_tasks:
346-
assert(tasks[pos].pk == pending.pk)
346+
assert (tasks[pos].pk == pending.pk)
347347
for pos, err in error_tasks:
348-
assert(tasks[pos].pk == err.pk)
348+
assert (tasks[pos].pk == err.pk)
349349
for pos, success in success_tasks:
350-
assert(tasks[pos].pk == success.pk)
350+
assert (tasks[pos].pk == success.pk)
351351

352352
###########
353353
# Helpers #

0 commit comments

Comments
 (0)