Skip to content

Commit 2f766b7

Browse files
author
Matt Sokoloff
committed
format
1 parent 12f1007 commit 2f766b7

File tree

2 files changed

+14
-10
lines changed

2 files changed

+14
-10
lines changed

labelbox/schema/dataset.py

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -288,21 +288,25 @@ def validate_conversational_data(conversational_data: list) -> None:
288288
Args:
289289
conversational_data (list): list of dictionaries.
290290
"""
291+
291292
def check_message_keys(message):
292293
accepted_message_keys = set([
293-
"messageId", "timestampUsec", "content", "user", "align", "canLabel"])
294+
"messageId", "timestampUsec", "content", "user", "align",
295+
"canLabel"
296+
])
294297
for key in message.keys():
295298
if not key in accepted_message_keys:
296299
raise KeyError(
297-
f"Invalid {key} key found! Accepted keys in messages list is {accepted_message_keys}")
300+
f"Invalid {key} key found! Accepted keys in messages list is {accepted_message_keys}"
301+
)
298302

299-
if conversational_data and not isinstance(conversational_data, list):
303+
if conversational_data and not isinstance(conversational_data,
304+
list):
300305
raise ValueError(
301306
f"conversationalData must be a list. Found {type(conversational_data)}"
302307
)
303308

304-
[check_message_keys(message)
305-
for message in conversational_data]
309+
[check_message_keys(message) for message in conversational_data]
306310

307311
def parse_metadata_fields(item):
308312
metadata_fields = item.get('metadata_fields')
@@ -360,9 +364,10 @@ def convert_item(item):
360364
"version": version,
361365
"messages": messages
362366
}
363-
conversationUrl = self.client.upload_data(json.dumps(one_conversation),
364-
content_type="application/json",
365-
filename="conversational_data.json")
367+
conversationUrl = self.client.upload_data(
368+
json.dumps(one_conversation),
369+
content_type="application/json",
370+
filename="conversational_data.json")
366371
item["row_data"] = conversationUrl
367372

368373
# Convert all payload variations into the same dict format

tests/integration/conftest.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,6 @@ def sample_bulk_conversation() -> list:
197197
path_to_conversation = 'tests/integration/media/bulk_conversation.json'
198198
assert os.path.exists(path_to_conversation)
199199

200-
201200
with open(path_to_conversation) as json_file:
202201
conversations = json.load(json_file)
203202
return conversations
@@ -302,7 +301,7 @@ def configured_project_with_label(client, rand_gen, image_url, project, dataset,
302301

303302
def create_label():
304303
""" Ad-hoc function to create a LabelImport
305-
304+
306305
Creates a LabelImport task which will create a label
307306
"""
308307
upload_task = LabelImport.create_from_objects(

0 commit comments

Comments
 (0)