Skip to content

Commit e4be7a3

Browse files
author
Matt Sokoloff
committed
yapf
1 parent f8ef26e commit e4be7a3

File tree

4 files changed

+34
-15
lines changed

4 files changed

+34
-15
lines changed

labelbox/schema/task.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ class Task(DbObject):
4040
created_by = Relationship.ToOne("User", False, "created_by")
4141
organization = Relationship.ToOne("Organization")
4242

43-
4443
def refresh(self) -> None:
4544
""" Refreshes Task data from the server. """
4645
assert self._user is not None
@@ -74,7 +73,7 @@ def wait_till_done(self, timeout_seconds=300) -> None:
7473
def errors(self) -> Optional[Dict[str, Any]]:
7574
""" Downloads the result file from Task
7675
"""
77-
self.wait_till_done(timeout_seconds = 600)
76+
self.wait_till_done(timeout_seconds=600)
7877
if self.status == "FAILED":
7978
data = self._fetch_remote(self.result_url)
8079
if data:
@@ -87,7 +86,7 @@ def errors(self) -> Optional[Dict[str, Any]]:
8786
def result(self) -> Dict[str, Any]:
8887
""" Fetch the result for a task
8988
"""
90-
self.wait_till_done(timeout_seconds = 600)
89+
self.wait_till_done(timeout_seconds=600)
9190
if self.status == "COMPLETE":
9291
return self._fetch_remote(self.result_url)
9392
elif self.status == "FAILED":
@@ -102,4 +101,3 @@ def _fetch_remote(self, result_url) -> Dict[str, Any]:
102101
response = requests.get(result_url)
103102
response.raise_for_status()
104103
return response.json()
105-
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import json
2+
3+
chain = dict()
4+
t = 3
5+
for a0 in range(t):
6+
nn = 4
7+
answer = dict()
8+
for n in range(1, nn + 1):
9+
vals = []
10+
offset = 0
11+
vals.append(n) #[2, 1]
12+
while (not n == 1):
13+
if (n % 2):
14+
n = 3 * n + 1
15+
else:
16+
n //= 2
17+
vals.append(n)
18+
for index, val in enumerate(vals):
19+
chain[val] = len(vals) - index + offset - 1
20+
21+
print(n)
22+
answer[n] = chain[n]
23+
print(json.dumps(answer, sort_keys=True))

tests/integration/test_data_rows.py

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -547,18 +547,17 @@ def test_delete_data_row_attachment(datarow, image_url):
547547

548548
def test_create_data_rows_result(client, dataset, image_url):
549549
task = dataset.create_data_rows([
550-
{
551-
DataRow.row_data: image_url,
552-
DataRow.external_id: "row1",
553-
},
554-
{
555-
DataRow.row_data: image_url,
556-
DataRow.external_id: "row1",
557-
},
558-
])
550+
{
551+
DataRow.row_data: image_url,
552+
DataRow.external_id: "row1",
553+
},
554+
{
555+
DataRow.row_data: image_url,
556+
DataRow.external_id: "row1",
557+
},
558+
])
559559
assert task.errors is None
560560
assert 'createdDataRows' in task.result
561561
results = task.result['createdDataRows']
562562
for result in results:
563563
client.get_data_row(result['id'])
564-

tests/integration/test_task.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,3 @@ def test_task_success(dataset, image_url):
3838
assert task.status == "COMPLETE"
3939
assert task.errors is None
4040
assert task.result is not None
41-

0 commit comments

Comments
 (0)