Skip to content

Commit 29705e5

Browse files
Vaghinak BasentsyanVaghinak Basentsyan
authored andcommitted
CLI fix
1 parent 3f4c007 commit 29705e5

20 files changed

+42
-42
lines changed

pytest.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
minversion = 3.0
33
log_cli=true
44
python_files = test_*.py
5-
addopts = -n32 --dist=loadscope
5+
;addopts = -n32 --dist=loadscope

src/superannotate/lib/app/helpers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ def check_types(obj, **kwargs):
147147
errors.append(f"Argument {attr_name} is not of type {attr_type}")
148148
elif kwargs.get(attr_name) and not isinstance(kwargs[attr_name], attr_type):
149149
errors.append(f"Argument {attr_name} is not of type {attr_type}")
150-
except:
150+
except Exception as _:
151151
pass
152152
return errors
153153

src/superannotate/lib/app/input_converters/conversion.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ def export_annotation(
224224
def import_annotation(
225225
input_dir,
226226
output_dir,
227-
dataset_format = "superannotate",
227+
dataset_format="superannotate",
228228
dataset_name="",
229229
project_type="Vector",
230230
task="object_detection",

src/superannotate/lib/app/interface/cli_interface.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ def _upload_annotations(
276276
task=task,
277277
)
278278
annotations_path = temp_dir
279-
classes_path = f"{folder}/classes/classes.json"
279+
classes_path = f"{annotations_path}/classes/classes.json"
280280
self.controller.create_annotation_classes(
281281
project_name=project_name,
282282
annotation_classes=json.load(open(classes_path)),
@@ -296,7 +296,7 @@ def _upload_annotations(
296296
)
297297
if response.errors:
298298
logger.warning(response.errors)
299-
progress_bar.update()
299+
progress_bar.update(chunk_size)
300300
sys.exit(0)
301301

302302
def attach_image_urls(

src/superannotate/lib/app/interface/sdk_interface.py

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646

4747

4848
logging.basicConfig(level=logging.INFO)
49-
formatter = logging.Formatter(fmt='SA-PYTHON-SDK - %(levelname)s - %(message)s')
49+
formatter = logging.Formatter(fmt="SA-PYTHON-SDK - %(levelname)s - %(message)s")
5050

5151
handler = logging.StreamHandler()
5252
handler.setFormatter(formatter)
@@ -58,8 +58,6 @@
5858
controller = Controller(logger)
5959

6060

61-
62-
6361
@validate_input
6462
def init(path_to_config_json: str):
6563
"""
@@ -478,9 +476,7 @@ def search_folders(
478476
@Trackable
479477
@validate_input
480478
def get_image_bytes(
481-
project: Union[str, dict],
482-
image_name: str,
483-
variant: str = "original",
479+
project: Union[str, dict], image_name: str, variant: str = "original",
484480
):
485481
"""Returns an io.BytesIO() object of the image. Suitable for creating
486482
PIL.Image out of it.
@@ -981,8 +977,7 @@ def get_project_default_image_quality_in_editor(project: Union[str, dict]):
981977
@Trackable
982978
@validate_input
983979
def set_project_default_image_quality_in_editor(
984-
project: Union[str, dict],
985-
image_quality_in_editor: Optional[str],
980+
project: Union[str, dict], image_quality_in_editor: Optional[str],
986981
):
987982
"""Sets project's default image quality in editor setting.
988983
@@ -1075,9 +1070,7 @@ def get_image_metadata(project: Union[str, dict], image_name: str, *_, **__):
10751070
@Trackable
10761071
@validate_input
10771072
def set_images_annotation_statuses(
1078-
project: Union[str, dict],
1079-
image_names: List[str],
1080-
annotation_status: str,
1073+
project: Union[str, dict], image_names: List[str], annotation_status: str,
10811074
):
10821075
"""Sets annotation statuses of images
10831076
@@ -1138,9 +1131,13 @@ def assign_images(project: Union[str, dict], image_names: List[str], user: str):
11381131
project_name, folder_name = extract_project_folder(project)
11391132
if not folder_name:
11401133
folder_name = "root"
1141-
contributors = controller.get_project_metadata(
1142-
project_name=project_name, include_contributors=True
1143-
).data["project"].users
1134+
contributors = (
1135+
controller.get_project_metadata(
1136+
project_name=project_name, include_contributors=True
1137+
)
1138+
.data["project"]
1139+
.users
1140+
)
11441141
contributor = None
11451142
for c in contributors:
11461143
if c["user_id"] == user:

src/superannotate/lib/core/usecases.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4143,20 +4143,21 @@ def validate_project_type(self):
41434143
def auth_data(self):
41444144
if not self._auth_data:
41454145
self._auth_data = self._backend_client.get_s3_upload_auth_token(
4146-
team_id=self._project.team_id,
4147-
folder_id=self._folder.uuid,
4148-
project_id=self._project.uuid, )
4146+
team_id=self._project.team_id,
4147+
folder_id=self._folder.uuid,
4148+
project_id=self._project.uuid,
4149+
)
41494150
return self._auth_data
41504151

41514152
@property
41524153
def s3_repository(self):
41534154
if not self._s3_repo_instance:
4154-
self._s3_repo_instance = self._s3_repo(
4155-
self.auth_data["accessKeyId"],
4156-
self.auth_data["secretAccessKey"],
4157-
self.auth_data["sessionToken"],
4158-
self.auth_data["bucket"],
4159-
)
4155+
self._s3_repo_instance = self._s3_repo(
4156+
self.auth_data["accessKeyId"],
4157+
self.auth_data["secretAccessKey"],
4158+
self.auth_data["sessionToken"],
4159+
self.auth_data["bucket"],
4160+
)
41604161
return self._s3_repo_instance
41614162

41624163
def _upload_image(self, image_path: str):
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
[{"id":779699,"project_id":109861,"name":"car","color":"#b01cb4","count":0,"createdAt":"2021-08-28T09:15:09.000Z","updatedAt":"2021-08-28T09:15:09.000Z","attribute_groups":[{"id":298784,"class_id":779699,"name":"color","is_multiselect":0,"createdAt":"2021-08-28T09:15:09.000Z","updatedAt":"2021-08-28T09:15:09.000Z","attributes":[{"id":1080243,"group_id":298784,"project_id":109861,"name":"red","count":0,"createdAt":"2021-08-28T09:15:09.000Z","updatedAt":"2021-08-28T09:15:09.000Z"},{"id":1080244,"group_id":298784,"project_id":109861,"name":"blue","count":0,"createdAt":"2021-08-28T09:15:09.000Z","updatedAt":"2021-08-28T09:15:09.000Z"},{"id":1080245,"group_id":298784,"project_id":109861,"name":"green","count":0,"createdAt":"2021-08-28T09:15:09.000Z","updatedAt":"2021-08-28T09:15:09.000Z"},{"id":1080246,"group_id":298784,"project_id":109861,"name":"yellow","count":0,"createdAt":"2021-08-28T09:15:09.000Z","updatedAt":"2021-08-28T09:15:09.000Z"}]}]},{"id":779700,"project_id":109861,"name":"person","color":"#96963a","count":0,"createdAt":"2021-08-28T09:15:09.000Z","updatedAt":"2021-08-28T09:15:09.000Z","attribute_groups":[]},{"id":779701,"project_id":109861,"name":"sign","color":"#fed339","count":0,"createdAt":"2021-08-28T09:15:09.000Z","updatedAt":"2021-08-28T09:15:09.000Z","attribute_groups":[]},{"id":779702,"project_id":109861,"name":"tree","color":"#249e9e","count":0,"createdAt":"2021-08-28T09:15:09.000Z","updatedAt":"2021-08-28T09:15:09.000Z","attribute_groups":[]}]
1+
[{"id":781236,"project_id":110511,"name":"person","color":"#96963a","count":0,"createdAt":"2021-08-30T05:57:44.000Z","updatedAt":"2021-08-30T05:57:44.000Z","attribute_groups":[]},{"id":781237,"project_id":110511,"name":"car","color":"#b01cb4","count":0,"createdAt":"2021-08-30T05:57:44.000Z","updatedAt":"2021-08-30T05:57:44.000Z","attribute_groups":[{"id":299348,"class_id":781237,"name":"color","is_multiselect":0,"createdAt":"2021-08-30T05:57:44.000Z","updatedAt":"2021-08-30T05:57:44.000Z","attributes":[{"id":1081393,"group_id":299348,"project_id":110511,"name":"red","count":0,"createdAt":"2021-08-30T05:57:44.000Z","updatedAt":"2021-08-30T05:57:44.000Z"},{"id":1081394,"group_id":299348,"project_id":110511,"name":"blue","count":0,"createdAt":"2021-08-30T05:57:44.000Z","updatedAt":"2021-08-30T05:57:44.000Z"},{"id":1081395,"group_id":299348,"project_id":110511,"name":"green","count":0,"createdAt":"2021-08-30T05:57:44.000Z","updatedAt":"2021-08-30T05:57:44.000Z"},{"id":1081396,"group_id":299348,"project_id":110511,"name":"yellow","count":0,"createdAt":"2021-08-30T05:57:44.000Z","updatedAt":"2021-08-30T05:57:44.000Z"}]}]},{"id":781238,"project_id":110511,"name":"sign","color":"#fed339","count":0,"createdAt":"2021-08-30T05:57:44.000Z","updatedAt":"2021-08-30T05:57:44.000Z","attribute_groups":[]},{"id":781239,"project_id":110511,"name":"tree","color":"#249e9e","count":0,"createdAt":"2021-08-30T05:57:44.000Z","updatedAt":"2021-08-30T05:57:44.000Z","attribute_groups":[]}]

tests/data_set/consensus_benchmark/consensus_test_data/consensus_1/berlin_000000_000019_leftImg8bit.png___objects.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)