Skip to content

Commit eb2378a

Browse files
authored
Merge pull request #208 from superannotateai/depricated_functions
Depricated functions
2 parents d660e48 + eb14054 commit eb2378a

File tree

14 files changed

+809
-70
lines changed

14 files changed

+809
-70
lines changed

src/superannotate/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,7 @@
296296

297297
WORKING_DIR = os.path.split(os.path.realpath(__file__))[0]
298298
sys.path.append(WORKING_DIR)
299+
logging.getLogger("botocore").setLevel(logging.CRITICAL)
299300
logging.config.fileConfig(
300301
os.path.join(WORKING_DIR, "logging.conf"), disable_existing_loggers=False
301302
)

src/superannotate/lib/app/analytics/class_analytics.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import plotly.express as px
66
from superannotate.lib.app.exceptions import AppException
77
from superannotate.lib.app.mixp.decorators import Trackable
8+
from superannotate.lib.core import DEPRICATED_DOCUMENT_VIDEO_MESSAGE
89

910
from .common import aggregate_annotations_as_df
1011

@@ -31,9 +32,7 @@ def class_distribution(export_root, project_names, visualize=False):
3132
and "___pixel.json" not in json_paths[0].name
3233
and "___objects.json" not in json_paths[0].name
3334
):
34-
raise AppException(
35-
"The function does not support projects containing videos attached with URLs"
36-
)
35+
raise AppException(DEPRICATED_DOCUMENT_VIDEO_MESSAGE)
3736

3837
logger.info(
3938
"Aggregating class distribution accross projects: {}.".format(

src/superannotate/lib/app/analytics/common.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import pandas as pd
66
import plotly.express as px
77
from lib.app.exceptions import AppException
8+
from lib.core import DEPRICATED_DOCUMENT_VIDEO_MESSAGE
89
from shapely.geometry import box
910
from shapely.geometry import Point
1011
from shapely.geometry import Polygon
@@ -178,9 +179,7 @@ def aggregate_annotations_as_df(
178179
and "___pixel.json" not in json_paths[0].name
179180
and "___objects.json" not in json_paths[0].name
180181
):
181-
raise AppException(
182-
"The function does not support projects containing videos / documents attached with URLs"
183-
)
182+
raise AppException(DEPRICATED_DOCUMENT_VIDEO_MESSAGE)
184183

185184
if verbose:
186185
logger.info("Aggregating annotations from %s as pandas DataFrame", project_root)

src/superannotate/lib/app/input_converters/conversion.py

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66

77
from lib.app.exceptions import AppException
88
from lib.app.mixp.decorators import Trackable
9-
from lib.core.exceptions import AppValidationException
9+
from lib.core import DEPRICATED_DOCUMENT_VIDEO_MESSAGE
10+
from lib.core import LIMITED_FUNCTIONS
11+
from lib.core.enums import ProjectType
1012

1113
from .export_from_sa_conversions import export_from_sa
1214
from .import_to_sa_conversions import import_to_sa
@@ -143,10 +145,13 @@ def export_annotation(
143145
project_type="Vector",
144146
task="object_detection",
145147
):
146-
if project_type == "Video" or project_type == "Text":
147-
raise AppValidationException(
148-
f"The function does not support projects containing {project_type} attached with URLs"
149-
)
148+
149+
if project_type in [
150+
ProjectType.VIDEO.name,
151+
ProjectType.DOCUMENT.name,
152+
]:
153+
raise AppException(LIMITED_FUNCTIONS[ProjectType.get_value(project_type)])
154+
150155
"""Converts SuperAnnotate annotation formate to the other annotation formats. Currently available (project_type, task) combinations for converter
151156
presented below:
152157
@@ -419,6 +424,14 @@ def convert_project_type(input_dir, output_dir):
419424
(output_dir, "output_dir", (str, Path)),
420425
]
421426
_passes_type_sanity(params_info)
427+
json_paths = list(Path(str(input_dir)).glob("*.json"))
428+
if (
429+
json_paths
430+
and "___pixel.json" not in json_paths[0].name
431+
and "___objects.json" not in json_paths[0].name
432+
):
433+
raise AppException(DEPRICATED_DOCUMENT_VIDEO_MESSAGE)
434+
422435
input_dir, output_dir = _change_type(input_dir, output_dir)
423436

424437
sa_convert_project_type(input_dir, output_dir)

src/superannotate/lib/app/input_converters/sa_conversion.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import cv2
99
import numpy as np
1010
from lib.app.exceptions import AppException
11+
from lib.core import DEPRICATED_DOCUMENT_VIDEO_MESSAGE
1112

1213
from ..common import blue_color_generator
1314
from ..common import hex_to_rgb
@@ -181,9 +182,7 @@ def sa_convert_project_type(input_dir, output_dir):
181182
elif "___objects.json" in json_paths[0].name:
182183
img_names = from_vector_to_pixel(json_paths, output_dir)
183184
elif ".json" in json_paths[0].name:
184-
raise AppException(
185-
"The function does not support projects containing videos / document attached with URLs"
186-
)
185+
raise AppException(DEPRICATED_DOCUMENT_VIDEO_MESSAGE)
187186
else:
188187
raise AppException(
189188
"'input_dir' should contain JSON files with '[IMAGE_NAME]___objects.json' or '[IMAGE_NAME]___pixel.json' names structure.",

0 commit comments

Comments
 (0)