@@ -54,7 +54,7 @@ def create_label(self, **kwargs):
5454 # about them. At the same time they're connected to a Label at
5555 # label creation in a non-standard way (connect via name).
5656
57- Label = Entity .named ( " Label" )
57+ Label = Entity .Label
5858 kwargs [Label .project ] = self
5959 data = {Label .attribute (attr ) if isinstance (attr , str ) else attr :
6060 value .uid if isinstance (value , DbObject ) else value
@@ -69,7 +69,7 @@ def create_label(self, **kwargs):
6969 return Label (self .client , res )
7070
7171 def labels (self , datasets = None , order_by = None ):
72- Label = Entity .named ( " Label" )
72+ Label = Entity .Label
7373
7474 if datasets is not None :
7575 where = " where:{dataRow: {dataset: {id_in: [%s]}}}" % ", " .join (
@@ -135,10 +135,10 @@ def labeler_performance(self):
135135 count user {%s} secondsPerLabel totalTimeLabeling consensus
136136 averageBenchmarkAgreement lastActivityTime}
137137 }}""" % (project_id_param , project_id_param ,
138- query .results_query_part (Entity .named ( " User" ) ))
138+ query .results_query_part (Entity .User ))
139139
140140 def create_labeler_performance (client , result ):
141- result ["user" ] = Entity .named ( " User" ) (client , result ["user" ])
141+ result ["user" ] = Entity .User (client , result ["user" ])
142142 result ["lastActivityTime" ] = datetime .fromtimestamp (
143143 result ["lastActivityTime" ] / 1000 , timezone .utc )
144144 return LabelerPerformance (** {utils .snake_case (key ): value
@@ -155,7 +155,7 @@ def review_metrics(self, net_score):
155155 Return:
156156 int, aggregation count of reviews for given net_score.
157157 """
158- if net_score not in (None ,) + tuple (Entity .named ( " Review" ) .NetScore ):
158+ if net_score not in (None ,) + tuple (Entity .Review .NetScore ):
159159 raise InvalidQueryError ("Review metrics net score must be either None "
160160 "or one of Review.NetScore values" )
161161 project_id_param = "project_id"
@@ -179,7 +179,7 @@ def setup(self, labeling_frontend, labeling_frontend_options):
179179 if not isinstance (labeling_frontend_options , str ):
180180 labeling_frontend_options = json .dumps (labeling_frontend_options )
181181
182- LFO = Entity .named ( " LabelingFrontendOptions" )
182+ LFO = Entity .LabelingFrontendOptions
183183 labeling_frontend_options = self .client ._create (
184184 LFO , {LFO .project : self , LFO .labeling_frontend : labeling_frontend ,
185185 LFO .customization_options : labeling_frontend_options ,
0 commit comments