@@ -126,8 +126,9 @@ def labels(self, datasets=None, order_by=None):
126
126
id_param , id_param , where , order_by_str ,
127
127
query .results_query_part (Label ))
128
128
129
- return PaginatedCollection (self .client , query_str , {id_param : self .uid },
130
- ["project" , "labels" ], Label )
129
+ return PaginatedCollection (self .client , query_str ,
130
+ {id_param : self .uid }, ["project" , "labels" ],
131
+ Label )
131
132
132
133
def export_queued_data_rows (self , timeout_seconds = 120 ):
133
134
""" Returns all data rows that are currently enqueued for this project.
@@ -368,11 +369,13 @@ def create_labeler_performance(client, result):
368
369
# python isoformat doesn't accept Z as utc timezone
369
370
result ["lastActivityTime" ] = datetime .fromisoformat (
370
371
result ["lastActivityTime" ].replace ('Z' , '+00:00' ))
371
- return LabelerPerformance (
372
- **
373
- {utils .snake_case (key ): value for key , value in result .items ()})
372
+ return LabelerPerformance (** {
373
+ utils .snake_case (key ): value
374
+ for key , value in result .items ()
375
+ })
374
376
375
- return PaginatedCollection (self .client , query_str , {id_param : self .uid },
377
+ return PaginatedCollection (self .client , query_str ,
378
+ {id_param : self .uid },
376
379
["project" , "labelerPerformance" ],
377
380
create_labeler_performance )
378
381
@@ -384,7 +387,7 @@ def review_metrics(self, net_score):
384
387
Returns:
385
388
int, aggregation count of reviews for given `net_score`.
386
389
"""
387
- if net_score not in (None ,) + tuple (Entity .Review .NetScore ):
390
+ if net_score not in (None , ) + tuple (Entity .Review .NetScore ):
388
391
raise InvalidQueryError (
389
392
"Review metrics net score must be either None "
390
393
"or one of Review.NetScore values" )
@@ -509,8 +512,8 @@ def unset_labeling_parameter_overrides(self, data_rows):
509
512
query_str = """mutation UnsetLabelingParameterOverridesPyApi($%s: ID!){
510
513
project(where: { id: $%s}) {
511
514
unsetLabelingParameterOverrides(data: [%s]) { success }}}""" % (
512
- id_param , id_param , ",\n " .join (
513
- "{dataRowId: \" %s \" }" % row . uid for row in data_rows ))
515
+ id_param , id_param , ",\n " .join ("{dataRowId: \" %s \" }" % row . uid
516
+ for row in data_rows ))
514
517
res = self .client .execute (query_str , {id_param : self .uid })
515
518
return res ["project" ]["unsetLabelingParameterOverrides" ]["success" ]
516
519
@@ -582,6 +585,25 @@ def enable_model_assisted_labeling(self, toggle: bool = True) -> bool:
582
585
return res ["project" ]["showPredictionsToLabelers" ][
583
586
"showingPredictionsToLabelers" ]
584
587
588
+ def bulk_import_requests (self ):
589
+ """ passpasspass
590
+ """
591
+
592
+ id_param = "project_id"
593
+ query_str = """query ListAllImportRequestsPyApi($%s: ID!) {
594
+ bulkImportRequests (
595
+ where: { projectId: $%s }
596
+ skip: %%d
597
+ first: %%d
598
+ ) {
599
+ %s
600
+ }
601
+ }""" % (id_param , id_param ,
602
+ query .results_query_part (Entity .BulkImportRequest ))
603
+ return PaginatedCollection (self .client , query_str ,
604
+ {id_param : str (self .uid )},
605
+ ["bulkImportRequests" ], BulkImportRequest )
606
+
585
607
def upload_annotations (
586
608
self ,
587
609
name : str ,
0 commit comments