@@ -36,7 +36,6 @@ class Client:
36
36
authentication key). Provides functions for querying and creating
37
37
top-level data objects (Projects, Datasets).
38
38
"""
39
-
40
39
def __init__ (self ,
41
40
api_key = None ,
42
41
endpoint = 'https://api.labelbox.com/graphql' ,
@@ -133,7 +132,8 @@ def convert_value(value):
133
132
if query is not None :
134
133
if params is not None :
135
134
params = {
136
- key : convert_value (value ) for key , value in params .items ()
135
+ key : convert_value (value )
136
+ for key , value in params .items ()
137
137
}
138
138
data = json .dumps ({
139
139
'query' : query ,
@@ -187,7 +187,6 @@ def check_errors(keywords, *path):
187
187
""" Helper that looks for any of the given `keywords` in any of
188
188
current errors on paths (like error[path][component][to][keyword]).
189
189
"""
190
-
191
190
for error in errors :
192
191
obj = error
193
192
for path_elem in path :
@@ -335,18 +334,18 @@ def upload_data(self,
335
334
336
335
request_data = {
337
336
"operations" :
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!,
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!,
346
345
$sign: Boolean) {
347
346
uploadFile(file: $file, contentLength: $contentLength,
348
347
sign: $sign) {url filename} } """ ,
349
- }),
348
+ }),
350
349
"map" : (None , json .dumps ({"1" : ["variables.file" ]})),
351
350
}
352
351
response = requests .post (
@@ -355,7 +354,7 @@ def upload_data(self,
355
354
data = request_data ,
356
355
files = {
357
356
"1" : (filename , content , content_type ) if
358
- (filename and content_type ) else content
357
+ (filename and content_type ) else content
359
358
})
360
359
361
360
if response .status_code == 502 :
@@ -528,7 +527,9 @@ def _create(self, db_object_type, data):
528
527
res = res ["create%s" % db_object_type .type_name ()]
529
528
return db_object_type (self , res )
530
529
531
- def create_dataset (self , iam_integration = IAMIntegration ._DEFAULT , ** kwargs ):
530
+ def create_dataset (self ,
531
+ iam_integration = IAMIntegration ._DEFAULT ,
532
+ ** kwargs ):
532
533
""" Creates a Dataset object on the server.
533
534
534
535
Attribute values are passed as keyword arguments.
@@ -704,7 +705,7 @@ def get_data_row_ids_for_external_ids(
704
705
for row in self .execute (
705
706
query_str ,
706
707
{'externalId_in' : external_ids [i :i + max_ids_per_request ]
707
- })['externalIdsToDataRowIds' ]:
708
+ })['externalIdsToDataRowIds' ]:
708
709
result [row ['externalId' ]].append (row ['dataRowId' ])
709
710
return result
710
711
0 commit comments