File tree Expand file tree Collapse file tree 2 files changed +9
-1
lines changed
src/labelbox/schema/internal Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change 5
5
from labelbox .pydantic_compat import BaseModel
6
6
from labelbox .schema .identifiable import UniqueId , GlobalKey
7
7
from labelbox import pydantic_compat
8
+ from labelbox .schema .data_row import DataRow
8
9
9
10
10
11
class DataRowItemBase (ABC , pydantic_compat .BaseModel ):
@@ -78,7 +79,8 @@ def is_empty(self) -> bool:
78
79
or the only key is `dataset_id`.
79
80
:return: bool
80
81
"""
81
- row_data = self .payload .get ("row_data" , None )
82
+ row_data = self .payload .get ("row_data" , None ) or self .payload .get (
83
+ DataRow .row_data , None )
82
84
return (not self .payload or len (self .payload .keys ()) == 1 and
83
85
"dataset_id" in self .payload or row_data is None or
84
86
len (row_data ) == 0 )
Original file line number Diff line number Diff line change 7
7
from labelbox .schema .asset_attachment import AttachmentType
8
8
from labelbox .schema .dataset import Dataset
9
9
from labelbox .schema .internal .descriptor_file_creator import DescriptorFileCreator
10
+ from labelbox .schema .data_row import DataRow
10
11
11
12
12
13
@pytest .fixture
@@ -119,6 +120,11 @@ def test_create_is_empty():
119
120
id = {}, payload = {"row_data" : "http://my_site.com/photos/img_01.jpg" })
120
121
assert not item .is_empty ()
121
122
123
+ item = DataRowCreateItem (
124
+ id = {},
125
+ payload = {DataRow .row_data : "http://my_site.com/photos/img_01.jpg" })
126
+ assert not item .is_empty ()
127
+
122
128
123
129
def test_create_row_data_none ():
124
130
items = [
You can’t perform that action at this time.
0 commit comments