Skip to content

Commit 8ff7907

Browse files
authored
Merge pull request #331 from superannotateai/friday
Clone project logs
2 parents 0a00b6c + 9f4e5e5 commit 8ff7907

File tree

16 files changed

+192
-76
lines changed

16 files changed

+192
-76
lines changed

src/superannotate/__init__.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
from superannotate.lib.app.input_converters.conversion import convert_json_version
1212
from superannotate.lib.app.input_converters.conversion import convert_project_type
1313
from superannotate.lib.app.input_converters.conversion import export_annotation
14+
from superannotate.lib.app.input_converters.conversion import import_annotation
1415
from superannotate.lib.app.interface.sdk_interface import add_annotation_bbox_to_image
1516
from superannotate.lib.app.interface.sdk_interface import (
1617
add_annotation_comment_to_image,
@@ -233,7 +234,7 @@
233234
},
234235
"fileFormatter": {
235236
"format": "SA-PYTHON-SDK - %(levelname)s - %(asctime)s - %(message)s"
236-
}
237+
},
237238
},
238239
"root": { # root logger
239240
"level": "DEBUG",
@@ -257,7 +258,9 @@ def log_version_info():
257258
pip_version = max(pip_version, ver)
258259
if pip_version.major > local_version.major:
259260
logging.warning(
260-
constances.PACKAGE_VERSION_MAJOR_UPGRADE.format(local_version, pip_version)
261+
constances.PACKAGE_VERSION_MAJOR_UPGRADE.format(
262+
local_version, pip_version
263+
)
261264
)
262265
elif pip_version > local_version:
263266
logging.warning(

src/superannotate/lib/app/analytics/aggregators.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import copy
22
import json
33
import logging
4+
from dataclasses import dataclass
45
from pathlib import Path
56
from typing import List
67
from typing import Optional
78
from typing import Union
89

910
import lib.core as constances
1011
import pandas as pd
11-
from dataclasses import dataclass
1212
from lib.app.exceptions import AppException
1313
from lib.core import ATTACHED_VIDEO_ANNOTATION_POSTFIX
1414
from lib.core import PIXEL_ANNOTATION_POSTFIX

src/superannotate/lib/app/annotation_helpers.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,12 @@ def _postprocess_annotation_json(annotation_json, path):
3434

3535

3636
def add_annotation_comment_to_json(
37-
annotation_json, comment_text, comment_coords, comment_author, resolved=False, image_name=""
37+
annotation_json,
38+
comment_text,
39+
comment_coords,
40+
comment_author,
41+
resolved=False,
42+
image_name="",
3843
):
3944
"""Add a comment to SuperAnnotate format annotation JSON
4045
@@ -54,7 +59,9 @@ def add_annotation_comment_to_json(
5459
if len(comment_coords) != 2:
5560
raise AppException("Comment should have two values")
5661

57-
annotation_json, path = _preprocess_annotation_json(annotation_json, image_name=image_name)
62+
annotation_json, path = _preprocess_annotation_json(
63+
annotation_json, image_name=image_name
64+
)
5865

5966
annotation = {
6067
"type": "comment",

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

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2475,7 +2475,9 @@ def add_annotation_bbox_to_image(
24752475
image_name,
24762476
)
24772477

2478-
controller.upload_image_annotations(*extract_project_folder(project), image_name, annotations)
2478+
controller.upload_image_annotations(
2479+
*extract_project_folder(project), image_name, annotations
2480+
)
24792481

24802482

24812483
@Trackable
@@ -2509,10 +2511,13 @@ def add_annotation_point_to_image(
25092511
annotations = add_annotation_point_to_json(
25102512
annotations, point, annotation_class_name, annotation_class_attributes, error
25112513
)
2512-
controller.upload_image_annotations(*extract_project_folder(project), image_name, annotations)
2514+
controller.upload_image_annotations(
2515+
*extract_project_folder(project), image_name, annotations
2516+
)
25132517

25142518

25152519
@Trackable
2520+
@validate_arguments
25162521
def add_annotation_comment_to_image(
25172522
project: NotEmptyStr,
25182523
image_name: NotEmptyStr,
@@ -2538,11 +2543,19 @@ def add_annotation_comment_to_image(
25382543
"""
25392544
annotations = get_image_annotations(project, image_name)["annotation_json"]
25402545
annotations = add_annotation_comment_to_json(
2541-
annotations, comment_text, comment_coords, comment_author, resolved=resolved, image_name=image_name
2546+
annotations,
2547+
comment_text,
2548+
comment_coords,
2549+
comment_author,
2550+
resolved=resolved,
2551+
image_name=image_name,
2552+
)
2553+
controller.upload_image_annotations(
2554+
*extract_project_folder(project), image_name, annotations
25422555
)
2543-
controller.upload_image_annotations(*extract_project_folder(project), image_name, annotations)
25442556

25452557

2558+
@Trackable
25462559
@validate_arguments
25472560
def search_images_all_folders(
25482561
project: NotEmptyStr,

src/superannotate/lib/app/mixp/utils/parsers.py

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,11 +97,12 @@ def clone_project(*args, **kwargs):
9797
project_metadata = result.data["project"]
9898
project_type = ProjectType.get_name(project_metadata.project_type)
9999

100-
101100
return {
102101
"event_name": "clone_project",
103102
"properties": {
104-
"External": bool(project_metadata.upload_state == constances.UploadState.EXTERNAL.value),
103+
"External": bool(
104+
project_metadata.upload_state == constances.UploadState.EXTERNAL.value
105+
),
105106
"Project Type": project_type,
106107
"Copy Classes": bool(
107108
args[3:4] or kwargs.get("copy_annotation_classes", None)
@@ -418,6 +419,22 @@ def get_project_and_folder_metadata(*args, **kwargs):
418419
}
419420

420421

422+
def search_images_all_folders(*args, **kwargs):
423+
project = kwargs.get("project", None)
424+
if not project:
425+
project = args[0]
426+
return {
427+
"event_name": "search_images_all_folders",
428+
"properties": {
429+
"Annotation Status": bool(
430+
args[2:3] or kwargs.get("annotation_status", None)
431+
),
432+
"Metadata": bool(args[3:4] or kwargs.get("return_metadata", None)),
433+
"project_name": get_project_name(project),
434+
},
435+
}
436+
437+
421438
def download_model(*args, **kwargs):
422439
project = kwargs.get("project", None)
423440
if not project:

src/superannotate/lib/core/entities/project_entities.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ def __init__(
7676
folder_id: int = None,
7777
upload_state: int = None,
7878
users: Iterable = (),
79+
unverified_users: Iterable = (),
7980
contributors: List = None,
8081
settings: List = None,
8182
annotation_classes: List = None,
@@ -97,6 +98,7 @@ def __init__(
9798
self.folder_id = folder_id
9899
self.upload_state = upload_state
99100
self.users = users
101+
self.unverified_users = unverified_users
100102
self.contributors = contributors
101103
self.settings = settings
102104
self.annotation_classes = annotation_classes

src/superannotate/lib/core/entities/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ class StringA(BaseModel):
199199

200200

201201
class PointLabels(BaseModel):
202-
__root__: Dict[constr(regex=r"^[0-9]+$"), StrictStr] # noqa F722
202+
__root__: Dict[constr(regex=r"^[0-9]+$"), StrictStr] # noqa F722
203203

204204
@classmethod
205205
def __get_validators__(cls):

src/superannotate/lib/core/entities/video.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,9 @@ class BaseVideoInstance(BaseInstance):
4747

4848

4949
class BboxInstance(BaseVideoInstance):
50-
point_labels: Optional[Dict[constr(regex=r"^[0-9]+$"), NotEmptyStr]] = Field( # noqa F722
50+
point_labels: Optional[
51+
Dict[constr(regex=r"^[0-9]+$"), NotEmptyStr]
52+
] = Field( # noqa F722
5153
None, alias="pointLabels"
5254
)
5355
timeline: Dict[float, BboxTimeStamp]

src/superannotate/lib/core/reporter.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,16 @@ def __init__(
1111
log_info: bool = True,
1212
log_warning: bool = True,
1313
disable_progress_bar: bool = False,
14+
log_debug: bool = True,
1415
):
1516
self.logger = logging.getLogger("root")
1617
self._log_info = log_info
1718
self._log_warning = log_warning
19+
self._log_debug = log_debug
1820
self._disable_progress_bar = disable_progress_bar
1921
self.info_messages = []
2022
self.warning_messages = []
23+
self.debug_messages = []
2124
self.custom_messages = defaultdict(set)
2225
self.progress_bar = None
2326

@@ -31,6 +34,11 @@ def log_warning(self, value: str):
3134
self.logger.warning(value)
3235
self.warning_messages.append(value)
3336

37+
def log_debug(self, value: str):
38+
if self._log_debug:
39+
self.logger.debug(value)
40+
self.debug_messages.append(value)
41+
3442
def start_progress(
3543
self, iterations: Union[int, range], description: str = "Processing"
3644
):

src/superannotate/lib/core/serviceproviders.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,7 @@ def get_annotation_classes(
4242
raise NotImplementedError
4343

4444
@abstractmethod
45-
def share_project(
46-
self, project_id: int, team_id: int, user_id: str, user_role: int
47-
):
45+
def share_project_bulk(self, project_id: int, team_id: int, users: list):
4846
raise NotImplementedError
4947

5048
@abstractmethod

0 commit comments

Comments
 (0)