Skip to content

Commit dda07c0

Browse files
author
Matt Sokoloff
committed
recommended changes
1 parent 6a71b2a commit dda07c0

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

labelbox/data/serialization/labelbox_v1/converter.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
from requests.exceptions import HTTPError
2-
import labelbox
31
from typing import Any, Dict, Generator, Iterable
42
import logging
53

64
import ndjson
75
import requests
6+
from requests.exceptions import HTTPError
87
from google.api_core import retry
98

9+
import labelbox
1010
from .label import LBV1Label
1111
from ...annotation_types.collection import (LabelCollection, LabelGenerator,
1212
PrefetchGenerator)
@@ -17,12 +17,14 @@
1717
class LBV1Converter:
1818

1919
@staticmethod
20-
def deserialize_video(json_data: Iterable[Dict[str, Any]], client):
20+
def deserialize_video(json_data: Iterable[Dict[str, Any]],
21+
client: labelbox.Client):
2122
"""
2223
Converts a labelbox video export into the common labelbox format.
2324
2425
Args:
2526
json_data: An iterable representing the labelbox video export.
27+
client: The labelbox client for downloading video annotations
2628
Returns:
2729
LabelGenerator containing the video data.
2830
"""
@@ -80,7 +82,7 @@ def _process(self, value):
8082
if 'frames' in value['Label']:
8183
req = self._request(value)
8284
value['Label'] = ndjson.loads(req)
83-
return value
85+
return value
8486

8587
@retry.Retry(predicate=retry.if_exception_type(HTTPError))
8688
def _request(self, value):

labelbox/data/serialization/labelbox_v1/label.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,8 +214,8 @@ def _infer_media_type(self):
214214
# To use this converter on data with this url format
215215
# filter out empty examples from the payload before deserializing.
216216
raise TypeError(
217-
"Can't infer data type from row data. Remove empty examples before trying again"
218-
)
217+
"Can't infer data type from row data. Remove empty examples before trying again. "
218+
f"row_data: {self.row_data[:200]}")
219219

220220
def _has_object_annotations(self):
221221
return len(self.label.objects) > 0

0 commit comments

Comments
 (0)