Skip to content

Commit 2517312

Browse files
committed
Code cleanup
1 parent 8ed5b22 commit 2517312

File tree

3 files changed

+11
-10
lines changed

3 files changed

+11
-10
lines changed

.pylintrc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ disable=
2323
no-else-return,
2424
too-many-lines,
2525
too-many-arguments,
26-
too-many-instance-attributes
26+
too-many-instance-attributes,
27+
broad-except
2728

2829
[SPELLING]
2930

superannotate/db/project_images.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ def upload_image_to_project(
120120
)
121121
key = upload_image_array_to_s3(bucket, *images_info_and_array, prefix)
122122
except Exception as e:
123-
raise SABaseException(0, "Couldn't upload to data server. " + str(e))
123+
raise SABaseException(0, "Couldn't upload to data server.") from e
124124

125125
if project_folder is not None:
126126
project_folder_id = project_folder["id"]

superannotate/db/projects.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,8 @@ def upload_video_to_project(
265265
if "ffprobe" in str(e):
266266
warning_str = "This could be because ffmpeg package is not installed. To install it, run: sudo apt install ffmpeg"
267267
logger.warning(
268-
"Couldn't read video metadata to determine rotation. " + warning_str
268+
"Couldn't read video metadata to determine rotation. %s",
269+
warning_str
269270
)
270271

271272
video = cv2.VideoCapture(str(video_path), cv2.CAP_FFMPEG)
@@ -1082,7 +1083,7 @@ def __attach_image_urls_to_project_thread(
10821083
for i in range(start_index, end_index):
10831084
if i >= len_img_paths:
10841085
break
1085-
name, url = img_names_urls[i]
1086+
name, _ = img_names_urls[i]
10861087
tried_upload[thread_id].append(name)
10871088
img_name_hash = str(uuid.uuid4()) + Path(name).suffix
10881089
key = prefix + img_name_hash
@@ -1186,7 +1187,7 @@ def upload_images_from_public_urls_to_project(
11861187
),
11871188
daemon=True
11881189
)
1189-
logger.info('Downloading %s images' % len(img_urls))
1190+
logger.info('Downloading %s images', len(img_urls))
11901191
tqdm_thread.start()
11911192
with tempfile.TemporaryDirectory() as save_dir_name:
11921193
save_dir = Path(save_dir_name)
@@ -2225,11 +2226,10 @@ def get_project_default_image_quality_in_editor(project):
22252226
for setting in get_project_settings(project):
22262227
if "attribute" in setting and setting["attribute"] == "ImageQuality":
22272228
return setting["value"]
2228-
else:
2229-
raise SABaseException(
2230-
0,
2231-
"Image quality in editor should be 'compressed', 'original' or None for project settings value"
2232-
)
2229+
raise SABaseException(
2230+
0,
2231+
"Image quality in editor should be 'compressed', 'original' or None for project settings value"
2232+
)
22332233

22342234

22352235
def get_project_metadata(

0 commit comments

Comments
 (0)