Skip to content

Commit eb00c4a

Browse files
authored
Merge pull request #467 from Labelbox/jt/dropdownwarn
[AL-1688] Inclusion of warning messages
2 parents fce3e5b + 5aa5ae5 commit eb00c4a

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

labelbox/data/annotation_types/classification/classification.py

Lines changed: 10 additions & 0 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
@@ -72,6 +73,15 @@ class Dropdown(_TempName):
7273
"""
7374
- A classification with many selected options allowed .
7475
- This is not currently compatible with MAL.
76+
77+
Deprecation Notice: Dropdown classification is deprecated and will be
78+
removed in a future release. Dropdown will also
79+
no longer be able to be created in the Editor on 3/31/2022.
7580
"""
7681
name: Literal["dropdown"] = "dropdown"
7782
answer: List[ClassificationAnswer]
83+
84+
def __init__(self, **data: Any):
85+
warnings.warn("Dropdown classification is deprecated and will be "
86+
"removed in a future release")
87+
super().__init__(**data)

labelbox/schema/ontology.py

Lines changed: 13 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

@@ -82,6 +83,11 @@ def add_option(self, option: 'Classification') -> None:
8283
@dataclass
8384
class Classification:
8485
"""
86+
87+
Deprecation Notice: Dropdown classification is deprecated and will be
88+
removed in a future release. Dropdown will also
89+
no longer be able to be created in the Editor on 3/31/2022.
90+
8591
A classfication to be added to a Project's ontology. The
8692
classification is dependent on the Classification Type.
8793
@@ -127,6 +133,13 @@ class Type(Enum):
127133
schema_id: Optional[str] = None
128134
feature_schema_id: Optional[str] = None
129135

136+
def __post_init__(self):
137+
if self.class_type == Classification.Type.DROPDOWN:
138+
warnings.warn(
139+
"Dropdown classification is deprecated and will be "
140+
"removed in a future release. Dropdown will also "
141+
"no longer be able to be created in the Editor on 3/31/2022.")
142+
130143
@property
131144
def name(self) -> str:
132145
return self.instructions

0 commit comments

Comments
 (0)