Skip to content

Commit 0da9028

Browse files
author
Val Brodsky
committed
Add accessors for id_type in Identiables
1 parent 06ac04a commit 0da9028

File tree

5 files changed

+11
-7
lines changed

5 files changed

+11
-7
lines changed

labelbox/schema/data_row_metadata.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -656,7 +656,7 @@ def _bulk_export(
656656
query, {
657657
"dataRowIdentifiers": {
658658
"ids": [id for id in _data_row_ids],
659-
"idType": _data_row_ids._id_type
659+
"idType": _data_row_ids.id_type
660660
}
661661
})['dataRowCustomMetadata'])
662662

labelbox/schema/identifiables.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ def __init__(self, iterable, id_type: IdType):
1414
self._iterable = iterable
1515
self._id_type = id_type
1616

17+
@property
18+
def id_type(self):
19+
return self._id_type
20+
1721
def __iter__(self):
1822
return iter(self._iterable)
1923

labelbox/schema/project.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1289,7 +1289,7 @@ def update_data_row_labeling_priority(
12891289
project_param: self.uid,
12901290
data_rows_param: {
12911291
"ids": [id for id in data_rows],
1292-
"idType": data_rows._id_type,
1292+
"idType": data_rows.id_type,
12931293
},
12941294
})["project"][method]
12951295

@@ -1484,7 +1484,7 @@ def move_data_rows_to_task_queue(self, data_row_ids, task_queue_id: str):
14841484
"queueId": task_queue_id,
14851485
"dataRowIdentifiers": {
14861486
"ids": [id for id in data_row_ids],
1487-
"idType": data_row_ids._id_type,
1487+
"idType": data_row_ids.id_type,
14881488
},
14891489
},
14901490
timeout=180.0,

tests/integration/test_data_row_metadata.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,12 +103,12 @@ def test_bulk_export_datarow_metadata(data_row, mdo: DataRowMetadataOntology):
103103
assert exported[0].data_row_id == data_row.uid
104104
assert len([field for field in exported[0].fields]) == 3
105105

106-
exported = mdo.bulk_export(UniqueIds(data_row.uid))
106+
exported = mdo.bulk_export(UniqueIds([data_row.uid]))
107107
assert exported[0].global_key == data_row.global_key
108108
assert exported[0].data_row_id == data_row.uid
109109
assert len([field for field in exported[0].fields]) == 3
110110

111-
exported = mdo.bulk_export(GlobalKeys(data_row.uid))
111+
exported = mdo.bulk_export(GlobalKeys([data_row.global_key]))
112112
assert exported[0].global_key == data_row.global_key
113113
assert exported[0].data_row_id == data_row.uid
114114
assert len([field for field in exported[0].fields]) == 3

tests/unit/test_unit_identifiables.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@ def test_unique_ids():
55
ids = ["a", "b", "c"]
66
identifiables = UniqueIds(ids)
77
assert [i for i in identifiables] == ids
8-
assert identifiables._id_type == "ID"
8+
assert identifiables.id_type == "ID"
99
assert len(identifiables) == 3
1010

1111

1212
def test_global_keys():
1313
ids = ["a", "b", "c"]
1414
identifiables = GlobalKeys(ids)
1515
assert [i for i in identifiables] == ids
16-
assert identifiables._id_type == "GKEY"
16+
assert identifiables.id_type == "GKEY"
1717
assert len(identifiables) == 3
1818

1919

0 commit comments

Comments
 (0)