@@ -55,7 +55,7 @@ def __init__(self,
5555 api_key = None ,
5656 endpoint = 'https://api.labelbox.com/graphql' ,
5757 enable_experimental = False ,
58- app_url = "https://app.labelbox.com" ,
58+ app_url = "https://app.labelbox.com" ,
5959 rest_endpoint = "https://api.labelbox.com/api/v1" ):
6060 """ Creates and initializes a Labelbox Client.
6161
@@ -156,7 +156,8 @@ def convert_value(value):
156156 if query is not None :
157157 if params is not None :
158158 params = {
159- key : convert_value (value ) for key , value in params .items ()
159+ key : convert_value (value )
160+ for key , value in params .items ()
160161 }
161162 data = json .dumps ({
162163 'query' : query ,
@@ -357,18 +358,18 @@ def upload_data(self,
357358
358359 request_data = {
359360 "operations" :
360- json .dumps ({
361- "variables" : {
362- "file" : None ,
363- "contentLength" : len (content ),
364- "sign" : sign
365- },
366- "query" :
367- """mutation UploadFile($file: Upload!, $contentLength: Int!,
361+ json .dumps ({
362+ "variables" : {
363+ "file" : None ,
364+ "contentLength" : len (content ),
365+ "sign" : sign
366+ },
367+ "query" :
368+ """mutation UploadFile($file: Upload!, $contentLength: Int!,
368369 $sign: Boolean) {
369370 uploadFile(file: $file, contentLength: $contentLength,
370371 sign: $sign) {url filename} } """ ,
371- }),
372+ }),
372373 "map" : (None , json .dumps ({"1" : ["variables.file" ]})),
373374 }
374375 response = requests .post (
@@ -377,7 +378,7 @@ def upload_data(self,
377378 data = request_data ,
378379 files = {
379380 "1" : (filename , content , content_type ) if
380- (filename and content_type ) else content
381+ (filename and content_type ) else content
381382 })
382383
383384 if response .status_code == 502 :
@@ -665,7 +666,8 @@ def create_project(self, **kwargs) -> Project:
665666 elif queue_mode == QueueMode .Dataset :
666667 logger .warning (
667668 "QueueMode.Dataset will eventually be deprecated, and is no longer "
668- "recommended for new projects. Prefer QueueMode.Batch instead." )
669+ "recommended for new projects. Prefer QueueMode.Batch instead."
670+ )
669671
670672 return self ._create (Entity .Project , {
671673 ** kwargs ,
@@ -777,7 +779,7 @@ def get_data_row_ids_for_external_ids(
777779 for row in self .execute (
778780 query_str ,
779781 {'externalId_in' : external_ids [i :i + max_ids_per_request ]
780- })['externalIdsToDataRowIds' ]:
782+ })['externalIdsToDataRowIds' ]:
781783 result [row ['externalId' ]].append (row ['dataRowId' ])
782784 return result
783785
@@ -1069,9 +1071,10 @@ def _format_failed_rows(rows: Dict[str, str],
10691071 }
10701072 """
10711073 params = {
1072- 'globalKeyDataRowLinks' : [{
1073- utils .camel_case (key ): value for key , value in input .items ()
1074- } for input in global_key_to_data_row_inputs ]
1074+ 'globalKeyDataRowLinks' :
1075+ [{utils .camel_case (key ): value
1076+ for key , value in input .items ()}
1077+ for input in global_key_to_data_row_inputs ]
10751078 }
10761079 assign_global_keys_to_data_rows_job = self .execute (query_str , params )
10771080
@@ -1100,8 +1103,8 @@ def _format_failed_rows(rows: Dict[str, str],
11001103 """
11011104 result_params = {
11021105 "jobId" :
1103- assign_global_keys_to_data_rows_job ["assignGlobalKeysToDataRows"
1104- ] ["jobId" ]
1106+ assign_global_keys_to_data_rows_job ["assignGlobalKeysToDataRows" ]
1107+ ["jobId" ]
11051108 }
11061109
11071110 # Poll job status until finished, then retrieve results
@@ -1217,7 +1220,7 @@ def _format_failed_rows(rows: List[str],
12171220 """
12181221 result_params = {
12191222 "jobId" :
1220- data_rows_for_global_keys_job ["dataRowsForGlobalKeys" ]["jobId" ]
1223+ data_rows_for_global_keys_job ["dataRowsForGlobalKeys" ]["jobId" ]
12211224 }
12221225
12231226 # Poll job status until finished, then retrieve results
@@ -1339,7 +1342,8 @@ def _format_failed_rows(rows: List[str],
13391342 errors .extend (
13401343 _format_failed_rows (
13411344 data ['notFoundGlobalKeys' ],
1342- "Failed to find data row matching provided global key" ))
1345+ "Failed to find data row matching provided global key" )
1346+ )
13431347 errors .extend (
13441348 _format_failed_rows (
13451349 data ['accessDeniedGlobalKeys' ],
@@ -1391,8 +1395,9 @@ def get_catalog_slice(self, slice_id) -> CatalogSlice:
13911395 """
13921396 res = self .execute (query_str , {'id' : slice_id })
13931397 return Entity .CatalogSlice (self , res ['getSavedQuery' ])
1394-
1395- def unarchive_root_feature_schema_node (self , ontology_id : str , root_feature_schema_id : str ) -> bool :
1398+
1399+ def unarchive_root_feature_schema_node (
1400+ self , ontology_id : str , root_feature_schema_id : str ) -> bool :
13961401 """
13971402 Returns true if the root feature schema node was successfully unarchived, false otherwise
13981403 Args:
0 commit comments