Skip to content

Commit 25949f4

Browse files
committed
Remove process_api_request
1 parent 4145a6b commit 25949f4

File tree

5 files changed

+16
-26
lines changed

5 files changed

+16
-26
lines changed

superannotate/common.py

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44
import os
55
import sys
66
import time
7-
from tqdm import tqdm
87
from pathlib import Path
9-
from enum import IntEnum
8+
109
import numpy as np
1110
from PIL import Image
11+
from tqdm import tqdm
1212

1313
logger = logging.getLogger("superannotate-python-sdk")
1414

@@ -152,9 +152,6 @@ def rename_kwargs(func_name, kwargs, aliases):
152152
kwargs[new] = kwargs.pop(alias)
153153

154154

155-
logger = logging.getLogger('httplogger')
156-
157-
158155
def hex_to_rgb(hex_string):
159156
"""Converts HEX values to RGB values
160157
"""
@@ -298,14 +295,6 @@ def write_to_json(output_path, json_data):
298295
} # Resolution limit
299296

300297

301-
def process_api_response(data):
302-
logger.info("Maintenance operations are being performed")
303-
if 'metadata' not in data:
304-
return data
305-
306-
return data['data']
307-
308-
309298
def tqdm_converter(
310299
total_num, images_converted, images_not_converted, finish_event
311300
):

superannotate/db/images.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
add_annotation_polyline_to_json, add_annotation_template_to_json
1818
)
1919
from ..api import API
20-
from ..common import process_api_response
2120
from ..exceptions import SABaseException
2221
from ..parameter_decorators import project_metadata
2322
from .annotation_classes import (
@@ -46,7 +45,7 @@ def _get_project_root_folder_id(project):
4645
if not response.ok:
4746
raise SABaseException(response.status_code, response.text)
4847

49-
response = process_api_response(response.json())
48+
response = response.json()
5049

5150
return response['folder_id']
5251

@@ -99,7 +98,7 @@ def search_images(
9998
)
10099
if response.ok:
101100
# print(response.json())
102-
response = process_api_response(response.json())
101+
response = response.json()
103102
results = response["data"]
104103
total_got += len(results)
105104
for r in results:
@@ -219,7 +218,7 @@ def set_image_annotation_status(project, image_name, annotation_status):
219218
if not response.ok:
220219
raise SABaseException(response.status_code, response.text)
221220

222-
response = process_api_response(response.json())
221+
response = response.json()
223222

224223
return response
225224

superannotate/db/search_projects.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import logging
22

33
from ..api import API
4-
from ..exceptions import (SABaseException)
5-
from ..common import process_api_response
4+
from ..exceptions import SABaseException
5+
66
logger = logging.getLogger("superannotate-python-sdk")
7+
78
_api = API.get_instance()
89

910

@@ -34,7 +35,7 @@ def search_projects(
3435
req_type='GET', path='/projects', params=params
3536
)
3637
if response.ok:
37-
new_results = process_api_response(response.json())
38+
new_results = response.json()
3839
result_list += new_results["data"]
3940
if new_results["count"] <= len(result_list):
4041
break

superannotate/ml/ml_funcs.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
from ..api import API
1818
from ..common import (
1919
_AVAILABLE_SEGMENTATION_MODELS, model_training_status_int_to_str,
20-
process_api_response, project_type_str_to_int
20+
project_type_str_to_int
2121
)
2222
from ..db.images import get_image_metadata, search_images
2323
from ..exceptions import SABaseException
@@ -449,7 +449,7 @@ def download_model(model, output_dir):
449449
params=params
450450
)
451451
if response.ok:
452-
response = process_api_response(response.json())
452+
response = response.json()
453453
else:
454454
raise SABaseException(0, "Could not get model info ")
455455

superannotate/ml/ml_models.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
from ..common import process_api_response
2-
from ..exceptions import SABaseException
1+
import logging
2+
33
from ..api import API
44
from ..common import project_type_int_to_str
5-
import logging
5+
from ..exceptions import SABaseException
66

77
logger = logging.getLogger("superannotate-python-sdk")
8+
89
_api = API.get_instance()
910

1011

@@ -30,7 +31,7 @@ def search_models(
3031

3132
if not response.ok:
3233
raise SABaseException(0, "could not search models")
33-
result = process_api_response(response.json())
34+
result = response.json()
3435

3536
for model in result['data']:
3637
model['type'] = project_type_int_to_str(model['type'])

0 commit comments

Comments
 (0)