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
2 changes: 1 addition & 1 deletion src/superannotate/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import sys


__version__ = "4.4.36dev1"
__version__ = "4.4.35dev2"


os.environ.update({"sa_version": __version__})
Expand Down
5 changes: 2 additions & 3 deletions src/superannotate/lib/core/usecases/annotations.py
Original file line number Diff line number Diff line change
Expand Up @@ -2101,9 +2101,8 @@ def execute(self):
if categorization_enabled:
item_id_category_map = {}
for item_name in uploaded_annotations:
category = (
name_annotation_map[item_name]["metadata"]
.get("item_category", None)
category = name_annotation_map[item_name]["metadata"].get(
"item_category", None
)
if category:
item_id_category_map[name_item_map[item_name].id] = category
Expand Down
11 changes: 8 additions & 3 deletions src/superannotate/lib/core/usecases/projects.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import decimal
import logging
import math
from collections import defaultdict
from typing import List

Expand Down Expand Up @@ -608,10 +609,14 @@ def validate_project_type(self):
def validate_connections(self):
if not self._connections:
return

if len(self._connections) > len(self._steps):
if not all([len(i) == 2 for i in self._connections]):
raise AppException("Invalid connections.")
steps_count = len(self._steps)
if len(self._connections) > max(
math.factorial(steps_count) / (2 * math.factorial(steps_count - 2)), 1
):
raise AppValidationException(
"Invalid connections: more connections than steps."
"Invalid connections: duplicates in a connection group."
)

possible_connections = set(range(1, len(self._steps) + 1))
Expand Down
10 changes: 2 additions & 8 deletions tests/integration/steps/test_steps.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
import json
import os
import tempfile
from pathlib import Path

from numpy.ma.core import arange
from src.superannotate import AppException
from src.superannotate import SAClient
from tests import DATA_SET_PATH
from tests.integration.base import BaseTestCase

sa = SAClient()
Expand Down Expand Up @@ -236,7 +229,8 @@ def test_create_invalid_connection(self):
sa.set_project_steps(
*args,
connections=[
[1, 2, 1],
[1, 2],
[2, 1],
]
)
with self.assertRaisesRegexp(
Expand Down