@@ -29,7 +29,7 @@ class Label(pydantic_compat.BaseModel):
2929 """Container for holding data and annotations
3030
3131 >>> Label(
32- >>> data = ImageData(url = "http:// my-img.jpg"),
32+ >>> data = {'global_key': ' my-data-row-key'} # also accepts uid, external_id as keys
3333 >>> annotations = [
3434 >>> ObjectAnnotation(
3535 >>> value = Point(x = 10, y = 10),
@@ -40,7 +40,8 @@ class Label(pydantic_compat.BaseModel):
4040
4141 Args:
4242 uid: Optional Label Id in Labelbox
43- data: Data of Label, Image, Video, Text
43+ data: Data of Label, Image, Video, Text or dict with a single key uid | global_key | external_id.
44+ Note use of classes as data is deprecated. Use GenericDataRowData or dict with a single key instead.
4445 annotations: List of Annotations in the label
4546 extra: additional context
4647 """
@@ -62,6 +63,10 @@ def is_data_type(data: Union[Dict[str, Any], DataType]) -> bool:
6263 def validate_data (cls , label ):
6364 if not Label .is_data_type (label .get ("data" )):
6465 label ["data" ]["class_name" ] = "GenericDataRowData"
66+ else :
67+ warnings .warn (
68+ f"Using { type (label ['data' ]).__name__ } class for label.data is deprecated. "
69+ "Use a dict or an instance of GenericDataRowData instead." )
6570 return label
6671
6772 def object_annotations (self ) -> List [ObjectAnnotation ]:
0 commit comments