Skip to content

Commit 26c6014

Browse files
committed
update to tests
2 parents eef06d6 + 20fe6b7 commit 26c6014

File tree

7 files changed

+56
-30
lines changed

7 files changed

+56
-30
lines changed

CHANGELOG.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
# Changelog
22

33
# Version 0.0.0 (YYYY-MM-DD) - In Progress
4+
5+
### Added
6+
* Global Keys for data rows
7+
* Assign global keys to a data row with `client.assign_global_keys_to_data_rows`
8+
* Get data rows using global keys with `client.get_data_row_ids_for_global_keys` and `client.get_data_rows_for_global_keys`
9+
# Version 3.26.2 (2022-09-06)
410
### Added
511
* Support for document (pdf) de/serialization from exports
612
* Use the `LBV1Converter.serialize()` and `LBV1Converter.deserialize()` methods
713
* Support for document (pdf) de/serialization for imports
814
* Use the `NDJsonConverter.serialize()` and `NDJsonConverter.deserialize()` methods
9-
* Global Keys for data rows
10-
* Assign global keys to a data row with `client.assign_global_keys_to_data_rows`
11-
* Get data rows using global keys with `client.get_data_row_ids_for_global_keys` and `client.get_data_rows_for_global_keys`
1215

1316
# Version 3.26.1 (2022-08-23)
1417
### Changed

docs/source/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
copyright = '2021, Labelbox'
2222
author = 'Labelbox'
2323

24-
release = '3.26.1'
24+
release = '3.26.2'
2525

2626
# -- General configuration ---------------------------------------------------
2727

examples/annotation_import/pdf_mal.ipynb

Lines changed: 40 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
},
5757
{
5858
"cell_type": "code",
59-
"execution_count": 1,
59+
"execution_count": null,
6060
"id": "8d8d554f",
6161
"metadata": {},
6262
"outputs": [],
@@ -103,7 +103,7 @@
103103
},
104104
{
105105
"cell_type": "code",
106-
"execution_count": 56,
106+
"execution_count": 3,
107107
"id": "6ffec272",
108108
"metadata": {},
109109
"outputs": [],
@@ -243,14 +243,14 @@
243243
},
244244
{
245245
"cell_type": "code",
246-
"execution_count": 38,
246+
"execution_count": 7,
247247
"id": "5cbe5b5a",
248248
"metadata": {},
249249
"outputs": [],
250250
"source": [
251251
"box_annotation = ObjectAnnotation(\n",
252252
" name='box', \n",
253-
" extra={'unit': 'POINTS','page': 1}, \n",
253+
" extra={'unit': 'POINTS','page': 0}, #pages are 0-indexed, 0 indicates page 1 \n",
254254
" value=Rectangle(\n",
255255
" extra={}, \n",
256256
" start=Point(x=557,y=898),\n",
@@ -260,7 +260,7 @@
260260
},
261261
{
262262
"cell_type": "code",
263-
"execution_count": 39,
263+
"execution_count": 8,
264264
"id": "4896ea42",
265265
"metadata": {},
266266
"outputs": [],
@@ -302,23 +302,31 @@
302302
},
303303
{
304304
"cell_type": "code",
305-
"execution_count": 51,
305+
"execution_count": 9,
306306
"id": "64ac1f74",
307307
"metadata": {},
308308
"outputs": [
309+
{
310+
"name": "stderr",
311+
"output_type": "stream",
312+
"text": [
313+
"/Users/jonathantso/opt/anaconda3/lib/python3.8/site-packages/labelbox/data/annotation_types/classification/classification.py:85: UserWarning: Dropdown classification is deprecated and will be removed in a future release\n",
314+
" warnings.warn(\"Dropdown classification is deprecated and will be \"\n"
315+
]
316+
},
309317
{
310318
"data": {
311319
"text/plain": [
312320
"{'uid': None,\n",
313321
" 'data': ImageData(im_bytes=None,file_path=None,url=None,arr=None),\n",
314-
" 'annotations': [ObjectAnnotation(name='box', feature_schema_id=None, extra={'unit': 'POINTS', 'page': 1}, value=Rectangle(extra={}, start=Point(extra={}, x=557.0, y=898.0), end=Point(extra={}, x=852.0, y=1140.0)), classifications=[]),\n",
322+
" 'annotations': [ObjectAnnotation(name='box', feature_schema_id=None, extra={'unit': 'POINTS', 'page': 0}, value=Rectangle(extra={}, start=Point(extra={}, x=557.0, y=898.0), end=Point(extra={}, x=852.0, y=1140.0)), classifications=[]),\n",
315323
" ClassificationAnnotation(name='text', feature_schema_id=None, extra={}, value=Text(answer='the answer to the text question')),\n",
316324
" ClassificationAnnotation(name='checklist', feature_schema_id=None, extra={}, value=Checklist(name='checklist', answer=[ClassificationAnswer(name='first_checklist_answer', feature_schema_id=None, extra={}, keyframe=None), ClassificationAnswer(name='second_checklist_answer', feature_schema_id=None, extra={}, keyframe=None)])),\n",
317325
" ClassificationAnnotation(name='radio', feature_schema_id=None, extra={}, value=Radio(answer=ClassificationAnswer(name='second_radio_answer', feature_schema_id=None, extra={}, keyframe=None)))],\n",
318326
" 'extra': {}}"
319327
]
320328
},
321-
"execution_count": 51,
329+
"execution_count": 9,
322330
"metadata": {},
323331
"output_type": "execute_result"
324332
}
@@ -361,38 +369,38 @@
361369
},
362370
{
363371
"cell_type": "code",
364-
"execution_count": 52,
372+
"execution_count": 10,
365373
"id": "8794d8aa",
366374
"metadata": {
367-
"scrolled": true
375+
"scrolled": false
368376
},
369377
"outputs": [
370378
{
371379
"data": {
372380
"text/plain": [
373-
"[{'uuid': 'fd4475d6-8ece-44d0-ba55-feeac4cfa9e8',\n",
374-
" 'dataRow': {'id': 'cl76eelhd0fm3071n9ropffkr'},\n",
381+
"[{'uuid': '4a1ca900-85d7-4643-883e-277170000f9c',\n",
382+
" 'dataRow': {'id': 'cl7hrmmi90m5c0y6h5nk00u02'},\n",
375383
" 'name': 'box',\n",
376-
" 'classifications': [],\n",
377-
" 'page': 1,\n",
384+
" 'page': 0,\n",
378385
" 'unit': 'POINTS',\n",
386+
" 'classifications': [],\n",
379387
" 'bbox': {'top': 898.0, 'left': 557.0, 'height': 242.0, 'width': 295.0}},\n",
380388
" {'name': 'text',\n",
381389
" 'answer': 'the answer to the text question',\n",
382-
" 'uuid': 'fc1913c6-b735-4dea-bd25-c18152a4715f',\n",
383-
" 'dataRow': {'id': 'cl76eelhd0fm3071n9ropffkr'}},\n",
390+
" 'uuid': '35588dd3-9050-4471-ac13-a8ed6ac1fd4a',\n",
391+
" 'dataRow': {'id': 'cl7hrmmi90m5c0y6h5nk00u02'}},\n",
384392
" {'name': 'checklist',\n",
385-
" 'uuid': '9d7b2e57-d68f-4388-867a-af2a9b233719',\n",
386-
" 'dataRow': {'id': 'cl76eelhd0fm3071n9ropffkr'},\n",
393+
" 'uuid': '38bc716c-d199-4e6e-bd31-0d2128716444',\n",
394+
" 'dataRow': {'id': 'cl7hrmmi90m5c0y6h5nk00u02'},\n",
387395
" 'answer': [{'name': 'first_checklist_answer'},\n",
388396
" {'name': 'second_checklist_answer'}]},\n",
389397
" {'name': 'radio',\n",
390398
" 'answer': {'name': 'second_radio_answer'},\n",
391-
" 'uuid': 'ad60897f-ea1a-47de-b923-459339764921',\n",
392-
" 'dataRow': {'id': 'cl76eelhd0fm3071n9ropffkr'}}]"
399+
" 'uuid': '8a21a248-9669-4465-b0c0-5a8d75903c8f',\n",
400+
" 'dataRow': {'id': 'cl7hrmmi90m5c0y6h5nk00u02'}}]"
393401
]
394402
},
395-
"execution_count": 52,
403+
"execution_count": 10,
396404
"metadata": {},
397405
"output_type": "execute_result"
398406
}
@@ -405,7 +413,7 @@
405413
},
406414
{
407415
"cell_type": "code",
408-
"execution_count": 53,
416+
"execution_count": 11,
409417
"id": "787524ac",
410418
"metadata": {},
411419
"outputs": [],
@@ -420,10 +428,18 @@
420428
},
421429
{
422430
"cell_type": "code",
423-
"execution_count": 57,
431+
"execution_count": 13,
424432
"id": "eb5116f9",
425433
"metadata": {},
426-
"outputs": [],
434+
"outputs": [
435+
{
436+
"name": "stdout",
437+
"output_type": "stream",
438+
"text": [
439+
"Errors: []\n"
440+
]
441+
}
442+
],
427443
"source": [
428444
"# Errors will appear for each annotation that failed.\n",
429445
"# Empty list means that there were no errors\n",

labelbox/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name = "labelbox"
2-
__version__ = "3.26.1"
2+
__version__ = "3.26.2"
33

44
from labelbox.client import Client
55
from labelbox.schema.project import Project

labelbox/data/annotation_types/metrics/scalar.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
from .base import ConfidenceValue, BaseMetric
77

8-
ScalarMetricValue = confloat(ge=0, le=10_000)
8+
ScalarMetricValue = confloat(ge=0, le=100_000_000)
99
ScalarMetricConfidenceValue = Dict[ConfidenceValue, ScalarMetricValue]
1010

1111

labelbox/schema/dataset.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -360,6 +360,9 @@ def convert_item(item):
360360
if "externalId" in item:
361361
external_id = item.pop("externalId")
362362
item["external_id"] = external_id
363+
if "globalKey" in item:
364+
global_key = item.pop("globalKey")
365+
item["globalKey"] = global_key
363366
validate_conversational_data(messages)
364367
one_conversation = \
365368
{

tests/integration/test_data_rows.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -625,6 +625,10 @@ def test_data_row_bulk_creation_with_unique_global_keys(dataset, sample_image):
625625
def test_data_row_bulk_creation_with_same_global_keys(dataset, sample_image):
626626
global_key_1 = str(uuid.uuid4())
627627

628+
629+
def test_create_data_rows_with_global_key(dataset, sample_image):
630+
global_key_1 = str(uuid.uuid4())
631+
global_key_2 = str(uuid.uuid4())
628632
task = dataset.create_data_rows([{
629633
DataRow.row_data: sample_image,
630634
DataRow.global_key: global_key_1

0 commit comments

Comments
 (0)