@@ -96,8 +96,8 @@ def create_label(self, **kwargs):
9696 Label = Entity .Label
9797
9898 kwargs [Label .project ] = self
99- kwargs [Label .seconds_to_label ] = kwargs .get (Label . seconds_to_label . name ,
100- 0.0 )
99+ kwargs [Label .seconds_to_label ] = kwargs .get (
100+ Label . seconds_to_label . name , 0.0 )
101101 data = {
102102 Label .attribute (attr ) if isinstance (attr , str ) else attr :
103103 value .uid if isinstance (value , DbObject ) else value
@@ -142,8 +142,9 @@ def labels(self, datasets=None, order_by=None):
142142 id_param , id_param , where , order_by_str ,
143143 query .results_query_part (Label ))
144144
145- return PaginatedCollection (self .client , query_str , {id_param : self .uid },
146- ["project" , "labels" ], Label )
145+ return PaginatedCollection (self .client , query_str ,
146+ {id_param : self .uid }, ["project" , "labels" ],
147+ Label )
147148
148149 def export_labels (self , timeout_seconds = 60 ):
149150 """ Calls the server-side Label exporting that generates a JSON
@@ -177,7 +178,6 @@ def export_labels(self, timeout_seconds=60):
177178 self .uid )
178179 time .sleep (sleep_time )
179180
180-
181181 def export_issues (self , status = None , timeout_seconds = 60 ):
182182 """ Calls the server-side Issues exporting that generates a JSON
183183 payload, and returns the URL to that payload.
@@ -201,10 +201,14 @@ def export_issues(self, status=None, timeout_seconds=60):
201201 valid_statuses = [None , "Open" , "Resolved" ]
202202
203203 if status not in valid_statuses :
204- raise ValueError ("status must be in {}. Found {}" .format (valid_statuses , status ))
204+ raise ValueError ("status must be in {}. Found {}" .format (
205+ valid_statuses , status ))
205206
206207 while True :
207- res = self .client .execute (query_str , {id_param : self .uid , status_param : status })
208+ res = self .client .execute (query_str , {
209+ id_param : self .uid ,
210+ status_param : status
211+ })
208212 print (res )
209213 res = res .get ('project' ).get ('issueExportUrl' )
210214
@@ -301,11 +305,13 @@ def create_labeler_performance(client, result):
301305 # python isoformat doesn't accept Z as utc timezone
302306 result ["lastActivityTime" ] = datetime .fromisoformat (
303307 result ["lastActivityTime" ].replace ('Z' , '+00:00' ))
304- return LabelerPerformance (
305- **
306- {utils .snake_case (key ): value for key , value in result .items ()})
308+ return LabelerPerformance (** {
309+ utils .snake_case (key ): value
310+ for key , value in result .items ()
311+ })
307312
308- return PaginatedCollection (self .client , query_str , {id_param : self .uid },
313+ return PaginatedCollection (self .client , query_str ,
314+ {id_param : self .uid },
309315 ["project" , "labelerPerformance" ],
310316 create_labeler_performance )
311317
@@ -317,7 +323,7 @@ def review_metrics(self, net_score):
317323 Returns:
318324 int, aggregation count of reviews for given `net_score`.
319325 """
320- if net_score not in (None ,) + tuple (Entity .Review .NetScore ):
326+ if net_score not in (None , ) + tuple (Entity .Review .NetScore ):
321327 raise InvalidQueryError (
322328 "Review metrics net score must be either None "
323329 "or one of Review.NetScore values" )
@@ -443,8 +449,8 @@ def unset_labeling_parameter_overrides(self, data_rows):
443449 query_str = """mutation UnsetLabelingParameterOverridesPyApi($%s: ID!){
444450 project(where: { id: $%s}) {
445451 unsetLabelingParameterOverrides(data: [%s]) { success }}}""" % (
446- id_param , id_param , ",\n " .join (
447- "{dataRowId: \" %s \" }" % row . uid for row in data_rows ))
452+ id_param , id_param , ",\n " .join ("{dataRowId: \" %s \" }" % row . uid
453+ for row in data_rows ))
448454 res = self .client .execute (query_str , {id_param : self .uid })
449455 return res ["project" ]["unsetLabelingParameterOverrides" ]["success" ]
450456
@@ -550,8 +556,9 @@ def create_prediction(self, label, data_row, prediction_model=None):
550556 $%s: String!, $%s: ID!, $%s: ID!, $%s: ID!) {createPrediction(
551557 data: {label: $%s, predictionModelId: $%s, projectId: $%s,
552558 dataRowId: $%s})
553- {%s}}""" % (label_param , model_param , project_param , data_row_param ,
554- label_param , model_param , project_param , data_row_param ,
559+ {%s}}""" % (label_param , model_param , project_param ,
560+ data_row_param , label_param , model_param ,
561+ project_param , data_row_param ,
555562 query .results_query_part (Prediction ))
556563 params = {
557564 label_param : label ,
0 commit comments