Skip to content

Commit 0d62ddf

Browse files
committed
Add media type override
1 parent 5d05b5c commit 0d62ddf

File tree

4 files changed

+13
-2
lines changed

4 files changed

+13
-2
lines changed

labelbox/schema/export_params.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import sys
22

33
from typing import Optional
4+
5+
from labelbox.schema.media_type import MediaType
46
if sys.version_info >= (3, 8):
57
from typing import TypedDict
68
else:
@@ -11,6 +13,7 @@ class DataRowParams(TypedDict):
1113
data_row_details: Optional[bool]
1214
metadata_fields: Optional[bool]
1315
attachments: Optional[bool]
16+
media_type_override: Optional[MediaType]
1417

1518

1619
class ProjectExportParams(DataRowParams):

labelbox/schema/model_run.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -521,6 +521,8 @@ def export_v2(self,
521521
"modelRunId": self.uid
522522
},
523523
"params": {
524+
"mediaTypeOverride":
525+
_params.get('media_type_override', None),
524526
"includeAttachments":
525527
_params.get('attachments', False),
526528
"includeMetadata":

labelbox/schema/project.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,8 @@ def export_v2(self,
430430
"data_row_details": False,
431431
"project_details": False,
432432
"performance_details": False,
433-
"label_details": False
433+
"label_details": False,
434+
"media_type_override": None
434435
})
435436

436437
_filters = filters or ProjectExportFilters({
@@ -451,6 +452,7 @@ def _get_timezone() -> str:
451452
""" % (mutation_name)
452453

453454
search_query: List[Dict[str, Collection[str]]] = []
455+
media_type_override = _params.get('media_type_override', None)
454456
query_params = {
455457
"input": {
456458
"taskName": task_name,
@@ -462,6 +464,9 @@ def _get_timezone() -> str:
462464
}
463465
},
464466
"params": {
467+
"mediaTypeOverride":
468+
media_type_override.value
469+
if media_type_override is not None else None,
465470
"includeAttachments":
466471
_params.get('attachments', False),
467472
"includeMetadata":

tests/integration/test_project.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@ def test_project_export_v2(configured_project_with_label):
5959
},
6060
params={
6161
"include_performance_details": include_performance_details,
62-
"include_labels": True
62+
"include_labels": True,
63+
"media_type_override": MediaType.Image
6364
})
6465

6566
task_to = project.export_v2(

0 commit comments

Comments
 (0)