Skip to content

Commit e4959df

Browse files
committed
addition of warnings
1 parent fce3e5b commit e4959df

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

labelbox/data/annotation_types/classification/classification.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from typing import Any, Dict, List, Union, Optional
2+
import warnings
23

34
try:
45
from typing import Literal
@@ -18,7 +19,6 @@ def dict(self, *args, **kwargs):
1819
res.pop('name')
1920
return res
2021

21-
2222
class ClassificationAnswer(FeatureSchema):
2323
"""
2424
- Represents a classification option.
@@ -74,4 +74,10 @@ class Dropdown(_TempName):
7474
- This is not currently compatible with MAL.
7575
"""
7676
name: Literal["dropdown"] = "dropdown"
77-
answer: List[ClassificationAnswer]
77+
answer: List[ClassificationAnswer]
78+
79+
def __init__(self, **data: Any):
80+
warnings.warn(
81+
"Dropdown classification is deprecated and will be "
82+
"removed in a future release")
83+
super().__init__(**data)

labelbox/schema/ontology.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from dataclasses import dataclass, field
55
from enum import Enum
66
from typing import Any, Dict, List, Optional, Union, Type
7+
import warnings
78

89
from pydantic import constr
910

@@ -127,6 +128,12 @@ class Type(Enum):
127128
schema_id: Optional[str] = None
128129
feature_schema_id: Optional[str] = None
129130

131+
def __post_init__(self):
132+
if self.class_type == Classification.Type.DROPDOWN:
133+
warnings.warn(
134+
"Dropdown classification is deprecated and will be "
135+
"removed in a future release")
136+
130137
@property
131138
def name(self) -> str:
132139
return self.instructions

0 commit comments

Comments
 (0)