|
| 1 | +from typing import Optional |
| 2 | +from typing import List |
| 3 | + |
| 4 | +from superannotate_schemas.schemas.base import BaseModel |
| 5 | +from superannotate_schemas.schemas.base import TrackableModel |
| 6 | +from superannotate_schemas.schemas.base import TimedBaseModel |
| 7 | +from superannotate_schemas.schemas.base import StrictInt |
| 8 | +from superannotate_schemas.schemas.base import StrictStr |
| 9 | +from superannotate_schemas.schemas.base import HexColor |
| 10 | +from superannotate_schemas.schemas.enums import ClassTypeEnum |
| 11 | + |
| 12 | + |
| 13 | +class Attribute(TimedBaseModel): |
| 14 | + id: Optional[StrictInt] |
| 15 | + group_id: Optional[StrictInt] |
| 16 | + project_id: Optional[StrictInt] |
| 17 | + name: StrictStr |
| 18 | + count: Optional[StrictInt] |
| 19 | + |
| 20 | + def __hash__(self): |
| 21 | + return hash(f"{self.id}{self.group_id}{self.name}") |
| 22 | + |
| 23 | + |
| 24 | +class AttributeGroup(TimedBaseModel): |
| 25 | + id: Optional[StrictInt] |
| 26 | + class_id: Optional[StrictInt] |
| 27 | + name: StrictStr |
| 28 | + is_multiselect: Optional[bool] |
| 29 | + attributes: List[Attribute] |
| 30 | + |
| 31 | + def __hash__(self): |
| 32 | + return hash(f"{self.id}{self.class_id}{self.name}") |
| 33 | + |
| 34 | + |
| 35 | +class AnnotationClass(TimedBaseModel): |
| 36 | + id: Optional[StrictInt] |
| 37 | + project_id: Optional[StrictInt] |
| 38 | + type: ClassTypeEnum = ClassTypeEnum.OBJECT |
| 39 | + name: StrictStr |
| 40 | + color: HexColor |
| 41 | + count: Optional[StrictInt] |
| 42 | + attribute_groups: List[AttributeGroup] |
| 43 | + |
| 44 | + def __hash__(self): |
| 45 | + return hash(f"{self.id}{self.type}{self.name}") |
| 46 | + |
| 47 | + |
| 48 | +class AnnotationClasses(BaseModel): |
| 49 | + __root__: List[AnnotationClass] |
0 commit comments