@@ -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 (
100- Label . seconds_to_label . name , 0.0 )
99+ kwargs [Label .seconds_to_label ] = kwargs .get (Label . seconds_to_label . name ,
100+ 0.0 )
101101 data = {
102102 Label .attribute (attr ) if isinstance (attr , str ) else attr :
103103 value .uid if isinstance (value , DbObject ) else value
@@ -142,9 +142,8 @@ 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 ,
146- {id_param : self .uid }, ["project" , "labels" ],
147- Label )
145+ return PaginatedCollection (self .client , query_str , {id_param : self .uid },
146+ ["project" , "labels" ], Label )
148147
149148 def export_labels (self , timeout_seconds = 60 ):
150149 """ Calls the server-side Label exporting that generates a JSON
@@ -305,13 +304,11 @@ def create_labeler_performance(client, result):
305304 # python isoformat doesn't accept Z as utc timezone
306305 result ["lastActivityTime" ] = datetime .fromisoformat (
307306 result ["lastActivityTime" ].replace ('Z' , '+00:00' ))
308- return LabelerPerformance (** {
309- utils .snake_case (key ): value
310- for key , value in result .items ()
311- })
307+ return LabelerPerformance (
308+ **
309+ {utils .snake_case (key ): value for key , value in result .items ()})
312310
313- return PaginatedCollection (self .client , query_str ,
314- {id_param : self .uid },
311+ return PaginatedCollection (self .client , query_str , {id_param : self .uid },
315312 ["project" , "labelerPerformance" ],
316313 create_labeler_performance )
317314
@@ -323,7 +320,7 @@ def review_metrics(self, net_score):
323320 Returns:
324321 int, aggregation count of reviews for given `net_score`.
325322 """
326- if net_score not in (None , ) + tuple (Entity .Review .NetScore ):
323+ if net_score not in (None ,) + tuple (Entity .Review .NetScore ):
327324 raise InvalidQueryError (
328325 "Review metrics net score must be either None "
329326 "or one of Review.NetScore values" )
@@ -449,8 +446,8 @@ def unset_labeling_parameter_overrides(self, data_rows):
449446 query_str = """mutation UnsetLabelingParameterOverridesPyApi($%s: ID!){
450447 project(where: { id: $%s}) {
451448 unsetLabelingParameterOverrides(data: [%s]) { success }}}""" % (
452- id_param , id_param , ",\n " .join ("{dataRowId: \" %s \" }" % row . uid
453- for row in data_rows ))
449+ id_param , id_param , ",\n " .join (
450+ "{dataRowId: \" %s \" }" % row . uid for row in data_rows ))
454451 res = self .client .execute (query_str , {id_param : self .uid })
455452 return res ["project" ]["unsetLabelingParameterOverrides" ]["success" ]
456453
@@ -556,9 +553,8 @@ def create_prediction(self, label, data_row, prediction_model=None):
556553 $%s: String!, $%s: ID!, $%s: ID!, $%s: ID!) {createPrediction(
557554 data: {label: $%s, predictionModelId: $%s, projectId: $%s,
558555 dataRowId: $%s})
559- {%s}}""" % (label_param , model_param , project_param ,
560- data_row_param , label_param , model_param ,
561- project_param , data_row_param ,
556+ {%s}}""" % (label_param , model_param , project_param , data_row_param ,
557+ label_param , model_param , project_param , data_row_param ,
562558 query .results_query_part (Prediction ))
563559 params = {
564560 label_param : label ,
0 commit comments