Skip to content

Commit e0a28b5

Browse files
committed
Subsets updates
1 parent 5c8e2ed commit e0a28b5

File tree

5 files changed

+30
-29
lines changed

5 files changed

+30
-29
lines changed

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

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -136,22 +136,25 @@ def _track(self, user_id: str, event_name: str, data: dict):
136136
self.get_mp_instance().track(user_id, event_name, data)
137137

138138
def _track_method(self, args, kwargs, success: bool):
139-
client = self.get_client()
140-
if not client:
141-
return
142-
function_name = self.function.__name__ if self.function else ""
143-
arguments = self.extract_arguments(self.function, *args, **kwargs)
144-
event_name, properties = self.default_parser(function_name, arguments)
145-
user_id = client.controller.team_data.creator_id
146-
team_name = client.controller.team_data.name
147-
148-
properties["Success"] = success
149-
default = self.get_default_payload(team_name=team_name, user_id=user_id)
150-
self._track(
151-
user_id,
152-
event_name,
153-
{**default, **properties, **CONFIG.get_current_session().data},
154-
)
139+
try:
140+
client = self.get_client()
141+
if not client:
142+
return
143+
function_name = self.function.__name__ if self.function else ""
144+
arguments = self.extract_arguments(self.function, *args, **kwargs)
145+
event_name, properties = self.default_parser(function_name, arguments)
146+
user_id = client.controller.team_data.creator_id
147+
team_name = client.controller.team_data.name
148+
149+
properties["Success"] = success
150+
default = self.get_default_payload(team_name=team_name, user_id=user_id)
151+
self._track(
152+
user_id,
153+
event_name,
154+
{**default, **properties, **CONFIG.get_current_session().data},
155+
)
156+
except BaseException:
157+
pass
155158

156159
def __get__(self, obj, owner=None):
157160
if obj is not None:

src/superannotate/lib/core/usecases/items.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,7 @@ def __init__(
133133
self._query = query
134134
self._subset = subset
135135

136-
def validate_query(self):
137-
if self._project.sync_status != constants.ProjectState.SYNCED.value:
138-
raise AppException("Project data is not synced.")
136+
def validate_arguments(self):
139137
if self._query:
140138
response = self._backend_client.validate_saqul_query(
141139
self._project.team_id, self._project.id, self._query
@@ -153,13 +151,16 @@ def validate_query(self):
153151
if response.get("error"):
154152
raise AppException(response["error"])
155153

156-
def execute(self) -> Response:
157154
if not any([self._query, self._subset]):
158-
self._response.errors = AppException(
159-
"AppException: The query and subset params cannot have the value None at the same time."
155+
raise AppException(
156+
"The query and subset params cannot have the value None at the same time."
157+
)
158+
if all([self._query, self._subset]) and not self._folder.is_root:
159+
raise AppException(
160+
"The folder name should be specified in the query string."
160161
)
161-
return self._response
162162

163+
def execute(self) -> Response:
163164
if self.is_valid():
164165
query_kwargs = {}
165166
if self._subset:

src/superannotate/lib/core/usecases/projects.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1093,10 +1093,7 @@ def __init__(
10931093
self._project = project
10941094
self._backend_client = backend_client
10951095

1096-
def validate_project(self):
1097-
if self._project.sync_status != constances.ProjectState.SYNCED.value:
1098-
raise AppException("Project data is not synced.")
1099-
1096+
def validate_arguments(self):
11001097
response = self._backend_client.validate_saqul_query(
11011098
self._project.team_id, self._project.id, "_"
11021099
)

src/superannotate/lib/core/video_convertor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ def pairwise(data: list):
110110
def get_median(self, annotations: List[dict]) -> dict:
111111
if len(annotations) >= 1:
112112
return annotations[0]
113-
## Let's just leave the code for reference.
113+
# Let's just leave the code for reference.
114114
# first_annotations = annotations[:1][0]
115115
# median = (
116116
# first_annotations["timestamp"] // self.ratio

src/superannotate/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "4.3.5dev16"
1+
__version__ = "4.3.5dev17"

0 commit comments

Comments
 (0)