Skip to content

Commit 0783924

Browse files
committed
CustomEditor
1 parent 0388802 commit 0783924

File tree

5 files changed

+211
-1
lines changed

5 files changed

+211
-1
lines changed

src/superannotate/lib/core/enums.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ class ProjectType(BaseTitledEnum):
9393
TILED = "Tiled", 5
9494
OTHER = "Other", 6
9595
POINT_CLOUD = "PointCloud", 7
96+
CUSTOM_EDITOR = "CustomEditor", 8
9697

9798
@classproperty
9899
def images(self):

src/superannotate/lib/core/service_types.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,18 @@ class Limit(BaseModel):
1515
max_image_count: Optional[int]
1616
remaining_image_count: int
1717

18+
class Config:
19+
extra = Extra.ignore
20+
1821

1922
class UserLimits(BaseModel):
2023
user_limit: Optional[Limit]
2124
project_limit: Limit
2225
folder_limit: Limit
2326

27+
class Config:
28+
extra = Extra.ignore
29+
2430

2531
class UploadAnnotationAuthData(BaseModel):
2632
access_key: str
@@ -80,12 +86,18 @@ class Resource(BaseModel):
8086
failed_items: List[str] = Field([], alias="failedItems")
8187
missing_resources: Resource = Field({}, alias="missingResources")
8288

89+
class Config:
90+
extra = Extra.ignore
91+
8392

8493
class UploadCustomFieldValues(BaseModel):
8594
succeeded_items: Optional[List[Any]]
8695
failed_items: Optional[List[str]]
8796
error: Optional[Any]
8897

98+
class Config:
99+
extra = Extra.ignore
100+
89101

90102
class ServiceResponse(BaseModel):
91103
status: Optional[int]

src/superannotate/lib/core/usecases/annotations.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,8 @@ def validate_project_type(self):
306306
raise ValidationError("Unsupported project type.")
307307

308308
def _validate_json(self, json_data: dict) -> list:
309+
if self._project.type >= constants.ProjectType.PIXEL.value:
310+
return []
309311
use_case = ValidateAnnotationUseCase(
310312
reporter=self.reporter,
311313
team_id=self._project.team_id,
@@ -571,7 +573,7 @@ def get_annotation_from_s3(bucket, path: str):
571573

572574
def prepare_annotation(self, annotation: dict, size) -> dict:
573575
errors = None
574-
if size < BIG_FILE_THRESHOLD:
576+
if size < BIG_FILE_THRESHOLD and self._project.type < constants.ProjectType.PIXEL.value:
575577
use_case = ValidateAnnotationUseCase(
576578
reporter=self.reporter,
577579
team_id=self._project.team_id,

tests/integration/test_.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import os
2+
from src.superannotate import SAClient
3+
4+
os.environ.update(
5+
{
6+
"SA_URL": "https://api.devsuperannotate.com",
7+
"SA_TOKEN": '200069c36c5e3cc4ed13015796ad36a61db1e9692626d5650af96ca61d0c8ad04bccf4d4320520det=37808'
8+
}
9+
)
10+
11+
sa = SAClient()
12+
13+
14+
def test_():
15+
sa.upload_annotations_from_folder_to_project('CSV testing', '/Users/vaghinak.basentsyan/www/superannotate-python-sdk/tests/integration/tmp')
Lines changed: 180 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,180 @@
1+
{
2+
"metadata": {
3+
"lastAction": {
4+
"email": "davit@superannotate.com",
5+
"timestamp": 1681279853516
6+
},
7+
"name": "item_002",
8+
"projectId": 536528
9+
},
10+
"instances": [
11+
{
12+
"id": "17530de5-1e0b-466b-8404-1e873ae39671",
13+
"type": "paragraph",
14+
"classId": 4994993,
15+
"attributes": [],
16+
"element_path": [
17+
"title"
18+
]
19+
},
20+
{
21+
"id": "5a0c3c9f-57b6-4b51-953e-d8dc6a910db3",
22+
"type": "paragraph",
23+
"classId": 4994994,
24+
"attributes": [],
25+
"element_path": [
26+
"col_1"
27+
]
28+
},
29+
{
30+
"id": "52a4d0dd-d2bf-4133-8be0-b84108a6f25e",
31+
"type": "paragraph",
32+
"classId": 4994995,
33+
"attributes": [],
34+
"element_path": [
35+
"col_2"
36+
]
37+
},
38+
{
39+
"id": "ea600778-0ee9-4da9-9b48-655e63ae2d21",
40+
"type": "paragraph",
41+
"classId": 4994996,
42+
"attributes": [],
43+
"element_path": [
44+
"col_3"
45+
]
46+
},
47+
{
48+
"id": "16bd5f66-b483-4422-b385-23ffc8dfb2bf",
49+
"type": "paragraph",
50+
"classId": 4994997,
51+
"attributes": [],
52+
"element_path": [
53+
"col_class"
54+
]
55+
},
56+
{
57+
"id": "bf2e0984-456c-4355-b334-4efb330355ca",
58+
"type": "textarea",
59+
"classId": 4994998,
60+
"attributes": [
61+
{
62+
"groupId": 4719160,
63+
"name": "Value 1"
64+
}
65+
],
66+
"element_path": [
67+
"csv_row",
68+
0,
69+
"col_1_val"
70+
]
71+
},
72+
{
73+
"id": "b6d7d53f-5325-4947-a537-0084461f020e",
74+
"type": "textarea",
75+
"classId": 4994999,
76+
"attributes": [
77+
{
78+
"groupId": 4719161,
79+
"name": "Value 2"
80+
}
81+
],
82+
"element_path": [
83+
"csv_row",
84+
0,
85+
"col_2_val"
86+
]
87+
},
88+
{
89+
"id": "8cc9f1f2-9e4c-4610-9102-655f7307bf9c",
90+
"type": "textarea",
91+
"classId": 4995000,
92+
"attributes": [
93+
{
94+
"groupId": 4719162,
95+
"name": "Value 3"
96+
}
97+
],
98+
"element_path": [
99+
"csv_row",
100+
0,
101+
"col_3_val"
102+
]
103+
},
104+
{
105+
"id": "a1f6e2cd-6d6c-4196-b21a-99cc3506a9fd",
106+
"type": "select",
107+
"classId": 4995001,
108+
"attributes": [
109+
{
110+
"groupId": 4719163,
111+
"id": 9846744
112+
}
113+
],
114+
"element_path": [
115+
"csv_row",
116+
0,
117+
"row_class"
118+
]
119+
},
120+
{
121+
"id": "bf2e0984-456c-4355-b334-4efb330355ca",
122+
"type": "textarea",
123+
"classId": 4994998,
124+
"attributes": [
125+
{
126+
"groupId": 4719160,
127+
"name": "Row 1 Value 1"
128+
}
129+
],
130+
"element_path": [
131+
"csv_row",
132+
1,
133+
"col_1_val"
134+
]
135+
},
136+
{
137+
"id": "b6d7d53f-5325-4947-a537-0084461f020e",
138+
"type": "textarea",
139+
"classId": 4994999,
140+
"attributes": [
141+
{
142+
"groupId": 4719161,
143+
"name": "Row 1 Value 2"
144+
}
145+
],
146+
"element_path": [
147+
"csv_row",
148+
1,
149+
"col_2_val"
150+
]
151+
},
152+
{
153+
"id": "8cc9f1f2-9e4c-4610-9102-655f7307bf9c",
154+
"type": "textarea",
155+
"classId": 4995000,
156+
"attributes": [
157+
{
158+
"groupId": 4719162,
159+
"name": "Row 1 Value 3"
160+
}
161+
],
162+
"element_path": [
163+
"csv_row",
164+
1,
165+
"col_3_val"
166+
]
167+
},
168+
{
169+
"id": "a1f6e2cd-6d6c-4196-b21a-99cc3506a9fd",
170+
"type": "select",
171+
"classId": 4995001,
172+
"attributes": [],
173+
"element_path": [
174+
"csv_row",
175+
1,
176+
"row_class"
177+
]
178+
}
179+
]
180+
}

0 commit comments

Comments
 (0)