Skip to content

Commit 6f4c418

Browse files
authored
Merge branch 'develop' into firday_284
2 parents fffe816 + 1e4f196 commit 6f4c418

File tree

5 files changed

+119
-119
lines changed

5 files changed

+119
-119
lines changed

src/superannotate/lib/app/mixp/decorators.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,7 @@ def track(self, *args, **kwargs):
5454

5555
def __call__(self, *args, **kwargs):
5656
try:
57-
if not self.__class__.TEAM_DATA:
58-
self.__class__.TEAM_DATA = controller.get_team()
57+
self.__class__.TEAM_DATA = controller.get_team()
5958
ret = self.function(*args, **kwargs)
6059
self._success = True
6160
except Exception as e:

src/superannotate/lib/core/__init__.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,15 @@
5959
"The function does not support projects containing videos attached with URLs"
6060
)
6161

62+
DEPRECATED_DOCUMENT_PROJECTS_MESSAGE = (
63+
"The function does not support projects containing documents attached with URLs"
64+
)
65+
66+
LIMITED_FUNCTIONS = {
67+
ProjectType.VIDEO.value: DEPRECATED_VIDEO_PROJECTS_MESSAGE,
68+
ProjectType.DOCUMENT.value: DEPRECATED_DOCUMENT_PROJECTS_MESSAGE,
69+
}
70+
6271
__version__ = "?"
6372

6473
__alL__ = (
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
from abc import ABC
2+
from abc import abstractmethod
3+
4+
from lib.core.exceptions import AppValidationException
5+
from lib.core.response import Response
6+
7+
8+
class BaseUseCase(ABC):
9+
def __init__(self):
10+
self._response = Response()
11+
12+
@abstractmethod
13+
def execute(self) -> Response:
14+
raise NotImplementedError
15+
16+
def _validate(self):
17+
for name in dir(self):
18+
try:
19+
if name.startswith("validate_"):
20+
method = getattr(self, name)
21+
method()
22+
except AppValidationException as e:
23+
self._response.errors = e
24+
25+
def is_valid(self):
26+
self._validate()
27+
return not self._response.errors
28+
29+
30+
class BaseInteractiveUseCase(BaseUseCase):
31+
@property
32+
def response(self):
33+
return self._response
34+
35+
@property
36+
def data(self):
37+
return self.response.data
38+
39+
@abstractmethod
40+
def execute(self):
41+
raise NotImplementedError

0 commit comments

Comments
 (0)