Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/superannotate/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

import requests
import superannotate.lib.core as constances
from packaging.version import parse
from superannotate.lib import get_default_controller
from packaging.version import parse
from superannotate.lib.app.analytics.class_analytics import class_distribution
from superannotate.lib.app.exceptions import AppException
from superannotate.lib.app.input_converters.conversion import convert_json_version
Expand Down Expand Up @@ -107,11 +107,13 @@
)
from superannotate.lib.app.interface.sdk_interface import validate_annotations
from superannotate.logger import get_default_logger
from superannotate.lib.infrastructure.controller import Controller
from superannotate.version import __version__


controller = get_default_controller()


__all__ = [
"__version__",
"controller",
Expand Down
6 changes: 1 addition & 5 deletions src/superannotate/lib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,8 @@
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))

controller = None


def get_default_controller():
from lib.infrastructure.controller import Controller
return Controller.get_default()

global controller
controller = Controller()
return controller
8 changes: 3 additions & 5 deletions src/superannotate/lib/app/interface/base_interface.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
from lib.infrastructure.controller import Controller
from lib import get_default_controller
from lib.infrastructure.repositories import ConfigRepository


class BaseInterfaceFacade:
def __init__(self):
self._config_path = None
self._controller = get_default_controller()

@property
def controller(self):
if not ConfigRepository().get_one("token"):
raise Exception("Config does not exists!")
controller = Controller()
if self._config_path:
controller.init(config_path=self._config_path)
return controller
return self._controller
5 changes: 4 additions & 1 deletion src/superannotate/lib/app/interface/cli_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
from lib.app.interface.sdk_interface import attach_document_urls_to_project
from lib.app.interface.sdk_interface import attach_image_urls_to_project
from lib.app.interface.sdk_interface import attach_video_urls_to_project
from lib.app.interface.sdk_interface import controller
from lib.app.interface.sdk_interface import create_folder
from lib.app.interface.sdk_interface import create_project
from lib.app.interface.sdk_interface import upload_annotations_from_folder_to_project
Expand All @@ -21,6 +20,10 @@
from lib.app.interface.sdk_interface import upload_videos_from_folder_to_project
from lib.core.entities import ConfigEntity
from lib.infrastructure.repositories import ConfigRepository
from lib.infrastructure.controller import Controller


controller = Controller.get_default()


class CLIFacade(BaseInterfaceFacade):
Expand Down
Loading