Skip to content

Commit 769c59f

Browse files
committed
test
1 parent 208210c commit 769c59f

File tree

1 file changed

+18
-15
lines changed

1 file changed

+18
-15
lines changed

labelbox/client.py

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@
3232
class Client:
3333
""" A Labelbox client.
3434
35-
Contains info necessary for connecting to a Labelbox server (URL, authentication key). Provides functions for querying and creating
35+
Contains info necessary for connecting to a Labelbox server (URL,
36+
authentication key). Provides functions for querying and creating
3637
top-level data objects (Projects, Datasets).
3738
"""
38-
3939
def __init__(self,
4040
api_key=None,
4141
endpoint='https://api.labelbox.com/graphql',
@@ -132,7 +132,8 @@ def convert_value(value):
132132
if query is not None:
133133
if params is not None:
134134
params = {
135-
key: convert_value(value) for key, value in params.items()
135+
key: convert_value(value)
136+
for key, value in params.items()
136137
}
137138
data = json.dumps({
138139
'query': query,
@@ -334,18 +335,18 @@ def upload_data(self,
334335

335336
request_data = {
336337
"operations":
337-
json.dumps({
338-
"variables": {
339-
"file": None,
340-
"contentLength": len(content),
341-
"sign": sign
342-
},
343-
"query":
344-
"""mutation UploadFile($file: Upload!, $contentLength: Int!,
338+
json.dumps({
339+
"variables": {
340+
"file": None,
341+
"contentLength": len(content),
342+
"sign": sign
343+
},
344+
"query":
345+
"""mutation UploadFile($file: Upload!, $contentLength: Int!,
345346
$sign: Boolean) {
346347
uploadFile(file: $file, contentLength: $contentLength,
347348
sign: $sign) {url filename} } """,
348-
}),
349+
}),
349350
"map": (None, json.dumps({"1": ["variables.file"]})),
350351
}
351352
response = requests.post(
@@ -354,7 +355,7 @@ def upload_data(self,
354355
data=request_data,
355356
files={
356357
"1": (filename, content, content_type) if
357-
(filename and content_type) else content
358+
(filename and content_type) else content
358359
})
359360

360361
if response.status_code == 502:
@@ -527,7 +528,9 @@ def _create(self, db_object_type, data):
527528
res = res["create%s" % db_object_type.type_name()]
528529
return db_object_type(self, res)
529530

530-
def create_dataset(self, iam_integration=IAMIntegration._DEFAULT, **kwargs):
531+
def create_dataset(self,
532+
iam_integration=IAMIntegration._DEFAULT,
533+
**kwargs):
531534
""" Creates a Dataset object on the server.
532535
533536
Attribute values are passed as keyword arguments.
@@ -703,7 +706,7 @@ def get_data_row_ids_for_external_ids(
703706
for row in self.execute(
704707
query_str,
705708
{'externalId_in': external_ids[i:i + max_ids_per_request]
706-
})['externalIdsToDataRowIds']:
709+
})['externalIdsToDataRowIds']:
707710
result[row['externalId']].append(row['dataRowId'])
708711
return result
709712

0 commit comments

Comments
 (0)