@@ -126,8 +126,9 @@ def labels(self, datasets=None, order_by=None):
126126 id_param , id_param , where , order_by_str ,
127127 query .results_query_part (Label ))
128128
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 )
131132
132133 def export_queued_data_rows (self , timeout_seconds = 120 ):
133134 """ Returns all data rows that are currently enqueued for this project.
@@ -368,11 +369,13 @@ def create_labeler_performance(client, result):
368369 # python isoformat doesn't accept Z as utc timezone
369370 result ["lastActivityTime" ] = datetime .fromisoformat (
370371 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+ })
374376
375- return PaginatedCollection (self .client , query_str , {id_param : self .uid },
377+ return PaginatedCollection (self .client , query_str ,
378+ {id_param : self .uid },
376379 ["project" , "labelerPerformance" ],
377380 create_labeler_performance )
378381
@@ -384,7 +387,7 @@ def review_metrics(self, net_score):
384387 Returns:
385388 int, aggregation count of reviews for given `net_score`.
386389 """
387- if net_score not in (None ,) + tuple (Entity .Review .NetScore ):
390+ if net_score not in (None , ) + tuple (Entity .Review .NetScore ):
388391 raise InvalidQueryError (
389392 "Review metrics net score must be either None "
390393 "or one of Review.NetScore values" )
@@ -509,8 +512,8 @@ def unset_labeling_parameter_overrides(self, data_rows):
509512 query_str = """mutation UnsetLabelingParameterOverridesPyApi($%s: ID!){
510513 project(where: { id: $%s}) {
511514 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 ))
514517 res = self .client .execute (query_str , {id_param : self .uid })
515518 return res ["project" ]["unsetLabelingParameterOverrides" ]["success" ]
516519
@@ -582,6 +585,25 @@ def enable_model_assisted_labeling(self, toggle: bool = True) -> bool:
582585 return res ["project" ]["showPredictionsToLabelers" ][
583586 "showingPredictionsToLabelers" ]
584587
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+
585607 def upload_annotations (
586608 self ,
587609 name : str ,
0 commit comments