Skip to content

Commit 87165a9

Browse files
committed
Changed create_annotation_classes funciton argument
1 parent 1f78fce commit 87165a9

File tree

3 files changed

+10
-11
lines changed

3 files changed

+10
-11
lines changed

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

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1540,7 +1540,7 @@ def create_annotation_class(
15401540
name: NotEmptyStr,
15411541
color: NotEmptyStr,
15421542
attribute_groups: Optional[List[AttributeGroup]] = None,
1543-
type: ClassType = "object",
1543+
class_type: ClassType = "object",
15441544
):
15451545
"""Create annotation class in project
15461546
@@ -1554,8 +1554,8 @@ def create_annotation_class(
15541554
[ { "name": "tall", "is_multiselect": 0, "attributes": [ { "name": "yes" }, { "name": "no" } ] },
15551555
{ "name": "age", "is_multiselect": 0, "attributes": [ { "name": "young" }, { "name": "old" } ] } ]
15561556
:type attribute_groups: list of dicts
1557-
:param type: class type
1558-
:type type: str
1557+
:param class_type: class type
1558+
:type class_type: str
15591559
15601560
:return: new class metadata
15611561
:rtype: dict
@@ -1570,7 +1570,7 @@ def create_annotation_class(
15701570
name=name,
15711571
color=color,
15721572
attribute_groups=attribute_groups,
1573-
class_type=type,
1573+
class_type=class_type,
15741574
)
15751575
return BaseSerializers(response.data).serialize()
15761576

@@ -1633,7 +1633,6 @@ def create_annotation_classes_from_classes_json(
16331633
:return: list of created annotation class metadatas
16341634
:rtype: list of dicts
16351635
"""
1636-
classes_json_initial = classes_json
16371636
if isinstance(classes_json, str) or isinstance(classes_json, Path):
16381637
if from_s3_bucket:
16391638
from_session = boto3.Session()
@@ -1650,11 +1649,7 @@ def create_annotation_classes_from_classes_json(
16501649
annotation_classes = parse_obj_as(List[AnnotationClassEntity], classes_json)
16511650
except ValidationError:
16521651
raise AppException("Couldn't validate annotation classes.")
1653-
logger.info(
1654-
"Creating annotation classes in project %s from %s.",
1655-
project,
1656-
classes_json_initial,
1657-
)
1652+
logger.info(f"Creating annotation classes in project {project}.")
16581653
response = Controller.get_default().create_annotation_classes(
16591654
project_name=project, annotation_classes=annotation_classes,
16601655
)

src/superannotate/lib/app/mixp/utils/parsers.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -974,14 +974,17 @@ def add_annotation_point_to_image(*args, **kwargs):
974974

975975
def create_annotation_class(*args, **kwargs):
976976
project = kwargs.get("project", None)
977+
class_type = kwargs.get("class_type")
977978
if not project:
978979
project = args[0]
979-
980+
if not class_type and len(args) == 5:
981+
class_type = args[4]
980982
return {
981983
"event_name": "create_annotation_class",
982984
"properties": {
983985
"project_name": get_project_name(project),
984986
"Attributes": bool(args[3:4] or ("attribute_groups" in kwargs)),
987+
"class_type": class_type if class_type else "object"
985988
},
986989
}
987990

src/superannotate/lib/core/conditions.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,3 +54,4 @@ def build_query(self):
5454
return str(self) + "".join(
5555
[f"{condition[0]}{condition[1]}" for condition in self._condition_set]
5656
)
57+
c

0 commit comments

Comments
 (0)