Skip to content

Commit 193c57a

Browse files
authored
Merge pull request #319 from superannotateai/friday
Friday
2 parents 0200479 + d0886d9 commit 193c57a

File tree

5 files changed

+7
-7
lines changed

5 files changed

+7
-7
lines changed

src/superannotate/lib/core/entities/utils.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def enum_error_handling(self) -> str:
3434
"does not match expected format YYYY-MM-DDTHH:MM:SS.fffZ"
3535
)
3636

37-
POINT_LABEL_KEY_FORMAT_ERROR_MESSAGE = "does not match expected format ^[0-9]*$"
37+
POINT_LABEL_KEY_FORMAT_ERROR_MESSAGE = "does not match expected format ^[0-9]+$"
3838

3939
POINT_LABEL_VALUE_FORMAT_ERROR_MESSAGE = "str type expected"
4040

@@ -199,7 +199,7 @@ class StringA(BaseModel):
199199

200200

201201
class PointLabels(BaseModel):
202-
__root__: Dict[constr(regex=r"^[0-9]*$"), StrictStr]
202+
__root__: Dict[constr(regex=r"^[0-9]+$"), StrictStr]
203203

204204
@classmethod
205205
def __get_validators__(cls):
@@ -214,7 +214,7 @@ def validate_value(cls, values):
214214
validate_value = None
215215
for key, value in values.items():
216216
try:
217-
validate_key = constr(regex=r"^[0-9]*$", min_length=1).validate(key)
217+
validate_key = constr(regex=r"^[0-9]+$", min_length=1).validate(key)
218218
except ValueError:
219219
errors.append(
220220
ErrorWrapper(

src/superannotate/lib/core/entities/video.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class BaseVideoInstance(BaseInstance):
4747

4848

4949
class BboxInstance(BaseVideoInstance):
50-
point_labels: Optional[Dict[constr(regex=r"^[0-9]*$"), NotEmptyStr]] = Field(
50+
point_labels: Optional[Dict[constr(regex=r"^[0-9]+$"), NotEmptyStr]] = Field(
5151
None, alias="pointLabels"
5252
)
5353
timeline: Dict[float, BboxTimeStamp]

src/superannotate/lib/core/entities/video_export.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class MetaData(MetadataBase):
3333

3434
class BaseTimeStamp(BaseModel):
3535
timestamp: StrictInt
36-
attributes: List[Attribute]
36+
attributes: Optional[List[Attribute]] = Field(list())
3737

3838

3939
class BboxTimeStamp(BaseTimeStamp):

src/superannotate/lib/core/types.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class Metadata(BaseModel):
4848

4949

5050
class PointLabels(BaseModel):
51-
__root__: Dict[constr(regex=r"^[0-9]*$"), str] # noqa: F722
51+
__root__: Dict[constr(regex=r"^[0-9]+$"), str] # noqa: F722
5252

5353

5454
class BaseInstance(BaseModel):

tests/unit/test_validators.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2027,5 +2027,5 @@ def test_validate_video_point_labels_bad_keys(self):
20272027
sa.validate_annotations("Video", os.path.join(self.vector_folder_path,
20282028
f"{tmpdir_name}/test_validate_video_point_labels_bad_keys.json"))
20292029
self.assertEqual(
2030-
"instances[0].meta.pointLabels.bad_key_1doesnotmatchexpectedformat^[0-9]*$\ninstances[0].meta.pointLabels.bad_key_2doesnotmatchexpectedformat^[0-9]*$\ninstances[0].meta.pointLabels.doesnotmatchexpectedformat^[0-9]*$\ninstances[0].meta.pointLabels.1strtypeexpected\ninstances[2].meta.pointLabelsextrafieldsnotpermitted\ninstances[2].parameters[0].timestamps[2].timestampintegertypeexpected\ninstances[3].metafieldrequired\ninstances[4].metavalueisnotavaliddict\ninstances[5].metavalueisnotavaliddict\ntags[0]strtypeexpected",
2030+
"instances[0].meta.pointLabels.bad_key_1doesnotmatchexpectedformat^[0-9]+$\ninstances[0].meta.pointLabels.bad_key_2doesnotmatchexpectedformat^[0-9]+$\ninstances[0].meta.pointLabels.doesnotmatchexpectedformat^[0-9]+$\ninstances[0].meta.pointLabels.1strtypeexpected\ninstances[2].meta.pointLabelsextrafieldsnotpermitted\ninstances[2].parameters[0].timestamps[2].timestampintegertypeexpected\ninstances[3].metafieldrequired\ninstances[4].metavalueisnotavaliddict\ninstances[5].metavalueisnotavaliddict\ntags[0]strtypeexpected",
20312031
out.getvalue().strip().replace(" ", ""))

0 commit comments

Comments
 (0)