@@ -489,9 +489,9 @@ def create_from_file(cls, client: "labelbox.Client", project_id: str,
489
489
raise ValueError (f"File { path } is not accessible" )
490
490
491
491
@classmethod
492
- def create_from_objects (
493
- cls , client : "labelbox.Client" , project_id : str , name : str ,
494
- labels : List [Dict [str , Any ]]) -> "LabelImport" :
492
+ def create_from_objects (cls , client : "labelbox.Client" , project_id : str ,
493
+ name : str ,
494
+ labels : List [Dict [str , Any ]]) -> "LabelImport" :
495
495
"""
496
496
Create an label import job from an in memory dictionary
497
497
@@ -507,8 +507,8 @@ def create_from_objects(
507
507
if not data_str :
508
508
raise ValueError ('labels cannot be empty' )
509
509
data = data_str .encode ('utf-8' )
510
- return cls ._create_label_import_from_bytes (client , project_id , name , data ,
511
- len (data ))
510
+ return cls ._create_label_import_from_bytes (client , project_id , name ,
511
+ data , len (data ))
512
512
513
513
@classmethod
514
514
def create_from_url (cls , client : "labelbox.Client" , project_id : str ,
@@ -529,13 +529,12 @@ def create_from_url(cls, client: "labelbox.Client", project_id: str,
529
529
query_str = cls ._get_url_mutation ()
530
530
return cls (
531
531
client ,
532
- client .execute (
533
- query_str ,
534
- params = {
535
- "fileUrl" : url ,
536
- "projectId" : project_id ,
537
- 'name' : name
538
- })["createLabelImport" ])
532
+ client .execute (query_str ,
533
+ params = {
534
+ "fileUrl" : url ,
535
+ "projectId" : project_id ,
536
+ 'name' : name
537
+ })["createLabelImport" ])
539
538
else :
540
539
raise ValueError (f"Url { url } is not reachable" )
541
540
@@ -566,8 +565,7 @@ def from_name(cls,
566
565
}
567
566
response = client .execute (query_str , params )
568
567
if response is None :
569
- raise labelbox .exceptions .ResourceNotFoundError (
570
- LabelImport , params )
568
+ raise labelbox .exceptions .ResourceNotFoundError (LabelImport , params )
571
569
response = response ["labelImport" ]
572
570
if as_json :
573
571
return response
@@ -592,9 +590,10 @@ def _get_file_mutation(cls) -> str:
592
590
}""" % query .results_query_part (cls )
593
591
594
592
@classmethod
595
- def _create_label_import_from_bytes (
596
- cls , client : "labelbox.Client" , project_id : str , name : str ,
597
- bytes_data : BinaryIO , content_len : int ) -> "LabelImport" :
593
+ def _create_label_import_from_bytes (cls , client : "labelbox.Client" ,
594
+ project_id : str , name : str ,
595
+ bytes_data : BinaryIO ,
596
+ content_len : int ) -> "LabelImport" :
598
597
file_name = f"{ project_id } __{ name } .ndjson"
599
598
variables = {
600
599
"file" : None ,
0 commit comments