Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions labelbox/schema/export_params.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import sys

from typing import Optional

from labelbox.schema.media_type import MediaType
if sys.version_info >= (3, 8):
from typing import TypedDict
else:
Expand All @@ -11,6 +13,7 @@ class DataRowParams(TypedDict):
data_row_details: Optional[bool]
metadata_fields: Optional[bool]
attachments: Optional[bool]
media_type_override: Optional[MediaType]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a test case with media_type_override in the exporter?



class ProjectExportParams(DataRowParams):
Expand Down
2 changes: 2 additions & 0 deletions labelbox/schema/model_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -521,6 +521,8 @@ def export_v2(self,
"modelRunId": self.uid
},
"params": {
"mediaTypeOverride":
_params.get('media_type_override', None),
"includeAttachments":
_params.get('attachments', False),
"includeMetadata":
Expand Down
7 changes: 6 additions & 1 deletion labelbox/schema/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,8 @@ def export_v2(self,
"data_row_details": False,
"project_details": False,
"performance_details": False,
"label_details": False
"label_details": False,
"media_type_override": None
})

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

search_query: List[Dict[str, Collection[str]]] = []
media_type_override = _params.get('media_type_override', None)
query_params = {
"input": {
"taskName": task_name,
Expand All @@ -462,6 +464,9 @@ def _get_timezone() -> str:
}
},
"params": {
"mediaTypeOverride":
media_type_override.value
if media_type_override is not None else None,
"includeAttachments":
_params.get('attachments', False),
"includeMetadata":
Expand Down
3 changes: 2 additions & 1 deletion tests/integration/test_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ def test_project_export_v2(configured_project_with_label):
},
params={
"include_performance_details": include_performance_details,
"include_labels": True
"include_labels": True,
"media_type_override": MediaType.Image
})

task_to = project.export_v2(
Expand Down