Skip to content

Commit f685ae3

Browse files
authored
Merge pull request #392 from superannotateai/friday
Friday
2 parents c16e3fb + 6366372 commit f685ae3

File tree

10 files changed

+207
-227
lines changed

10 files changed

+207
-227
lines changed

src/superannotate/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44

55
import requests
66
import superannotate.lib.core as constances
7-
from packaging.version import parse
87
from superannotate.lib import get_default_controller
8+
from packaging.version import parse
99
from superannotate.lib.app.analytics.class_analytics import class_distribution
1010
from superannotate.lib.app.exceptions import AppException
1111
from superannotate.lib.app.input_converters.conversion import convert_json_version
@@ -107,11 +107,13 @@
107107
)
108108
from superannotate.lib.app.interface.sdk_interface import validate_annotations
109109
from superannotate.logger import get_default_logger
110+
from superannotate.lib.infrastructure.controller import Controller
110111
from superannotate.version import __version__
111112

112113

113114
controller = get_default_controller()
114115

116+
115117
__all__ = [
116118
"__version__",
117119
"controller",

src/superannotate/lib/__init__.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,8 @@
55
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
66
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
77

8-
controller = None
9-
108

119
def get_default_controller():
1210
from lib.infrastructure.controller import Controller
11+
return Controller.get_default()
1312

14-
global controller
15-
controller = Controller()
16-
return controller
Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
1-
from lib.infrastructure.controller import Controller
1+
from lib import get_default_controller
22
from lib.infrastructure.repositories import ConfigRepository
33

44

55
class BaseInterfaceFacade:
66
def __init__(self):
77
self._config_path = None
8+
self._controller = get_default_controller()
89

910
@property
1011
def controller(self):
1112
if not ConfigRepository().get_one("token"):
1213
raise Exception("Config does not exists!")
13-
controller = Controller()
14-
if self._config_path:
15-
controller.init(config_path=self._config_path)
16-
return controller
14+
return self._controller

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
from lib.app.interface.sdk_interface import attach_document_urls_to_project
1313
from lib.app.interface.sdk_interface import attach_image_urls_to_project
1414
from lib.app.interface.sdk_interface import attach_video_urls_to_project
15-
from lib.app.interface.sdk_interface import controller
1615
from lib.app.interface.sdk_interface import create_folder
1716
from lib.app.interface.sdk_interface import create_project
1817
from lib.app.interface.sdk_interface import upload_annotations_from_folder_to_project
@@ -21,6 +20,10 @@
2120
from lib.app.interface.sdk_interface import upload_videos_from_folder_to_project
2221
from lib.core.entities import ConfigEntity
2322
from lib.infrastructure.repositories import ConfigRepository
23+
from lib.infrastructure.controller import Controller
24+
25+
26+
controller = Controller.get_default()
2427

2528

2629
class CLIFacade(BaseInterfaceFacade):

0 commit comments

Comments
 (0)