Skip to content

Commit 83ba485

Browse files
committed
Merge branch 're-design-sdk' of https://github.com/superannotateai/superannotate-python-sdk into re-design-sdk
2 parents a171478 + 4b241aa commit 83ba485

File tree

8 files changed

+44
-14
lines changed

8 files changed

+44
-14
lines changed

pytest.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
minversion = 3.0
33
log_cli=true
44
python_files = test_*.py
5-
;addopts = -n32 --dist=loadscope
5+
addopts = -n32 --dist=loadscope

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
name='superannotate',
2828
version=version,
2929
package_dir={"": "src"},
30-
30+
package_data={"superannotate": ["logging.conf"]},
3131
packages=find_packages(where="src"),
3232
description='Python SDK to SuperAnnotate platform',
3333
license='MIT',

src/superannotate/__init__.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
import logging
2+
import logging.config
3+
14
from superannotate.lib.app.analytics.class_analytics import attribute_distribution
25
from superannotate.lib.app.analytics.class_analytics import class_distribution
36
from superannotate.lib.app.annotation_helpers import add_annotation_bbox_to_json
@@ -243,6 +246,7 @@
243246
"upload_videos_from_folder_to_project",
244247
# Annotation Section
245248
"create_annotation_class",
249+
"delete_annotation_class",
246250
"prepare_export",
247251
"download_export",
248252
"set_images_annotation_statuses",
@@ -284,3 +288,7 @@
284288
]
285289

286290
__author__ = "Superannotate"
291+
import os
292+
file_dir = os.path.split(os.path.realpath(__file__))[0]
293+
294+
logging.config.fileConfig(os.path.join(file_dir, "logging.conf"))

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

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,7 @@
4545
from tqdm import tqdm
4646

4747

48-
logging.basicConfig(level=logging.INFO)
49-
formatter = logging.Formatter(fmt="SA-PYTHON-SDK - %(levelname)s - %(message)s")
50-
51-
handler = logging.StreamHandler()
52-
handler.setFormatter(formatter)
53-
5448
logger = logging.getLogger("superannotate-python-sdk")
55-
logger.setLevel(logging.INFO)
56-
logger.addHandler(handler)
5749

5850
controller = Controller(logger)
5951

src/superannotate/lib/core/usecases.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1940,6 +1940,7 @@ def execute(self):
19401940
project = self._projects.get_one(
19411941
uuid=self._project.uuid, team_id=self._project.team_id
19421942
)
1943+
data["project"] = project
19431944
if self._include_complete_image_count:
19441945
projects = self._projects.get_all(
19451946
condition=(
@@ -1950,8 +1951,6 @@ def execute(self):
19501951
)
19511952
if projects:
19521953
data["project"] = projects[0]
1953-
else:
1954-
data["project"] = project
19551954

19561955
if self._include_annotation_classes:
19571956
self.annotation_classes_use_case.execute()

src/superannotate/lib/infrastructure/services.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,15 @@
66
from typing import Tuple
77
from urllib.parse import urljoin
88

9-
import lib.core as constance
109
import requests
10+
from requests.packages.urllib3.exceptions import InsecureRequestWarning
11+
import lib.core as constance
1112
from lib.core.exceptions import AppException
1213
from lib.core.serviceproviders import SuerannotateServiceProvider
1314
from requests.exceptions import HTTPError
1415

16+
requests.packages.urllib3.disable_warnings()
17+
1518

1619
class BaseBackendService(SuerannotateServiceProvider):
1720
AUTH_TYPE = "sdk"

src/superannotate/logging.conf

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
[loggers]
2+
keys=root,superannotate-python-sdk
3+
4+
[handlers]
5+
keys=consoleHandler
6+
7+
[formatters]
8+
keys=consoleFormatter
9+
10+
[logger_root]
11+
level=DEBUG
12+
handlers=consoleHandler
13+
14+
[logger_superannotate-python-sdk]
15+
level=DEBUG
16+
handlers=consoleHandler
17+
qualname=consoleFormatter
18+
propagate=0
19+
20+
[handler_consoleHandler]
21+
class=StreamHandler
22+
level=INFO
23+
formatter=consoleFormatter
24+
args=(sys.stdout,)
25+
26+
[formatter_consoleFormatter]
27+
format=SA-PYTHON-SDK - %(levelname)s - %(message)s
28+
datefmt=
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@ def test_get_project_default_image_quality_in_editor(self):
1313
self.assertIsNotNone(sa.get_project_default_image_quality_in_editor(self.PROJECT_NAME))
1414

1515
def test_get_project_metadata(self):
16-
metadata = sa.get_team_metadata()
16+
metadata = sa.get_project_metadata(include_complete_image_count=True)
1717
pass

0 commit comments

Comments
 (0)