@@ -67,7 +67,6 @@ class Project(DbObject, Updateable, Deletable):
67
67
datasets = Relationship .ToMany ("Dataset" , True )
68
68
created_by = Relationship .ToOne ("User" , False , "created_by" )
69
69
organization = Relationship .ToOne ("Organization" , False )
70
- reviews = Relationship .ToMany ("Review" , True )
71
70
labeling_frontend = Relationship .ToOne ("LabelingFrontend" )
72
71
labeling_frontend_options = Relationship .ToMany (
73
72
"LabelingFrontendOptions" , False , "labeling_frontend_options" )
@@ -96,38 +95,6 @@ def members(self):
96
95
{id_param : str (self .uid )},
97
96
["project" , "members" ], ProjectMember )
98
97
99
- def create_label (self , ** kwargs ):
100
- """ Creates a label on a Legacy Editor project. Not supported in the new Editor.
101
- Args:
102
- **kwargs: Label attributes. At minimum, the label `DataRow`.
103
- """
104
- # Copy-paste of Client._create code so we can inject
105
- # a connection to Type. Type objects are on their way to being
106
- # deprecated and we don't want the Py client lib user to know
107
- # about them. At the same time they're connected to a Label at
108
- # label creation in a non-standard way (connect via name).
109
- logger .warning (
110
- "`create_label` is deprecated and is not compatible with the new editor."
111
- )
112
-
113
- Label = Entity .Label
114
-
115
- kwargs [Label .project ] = self
116
- kwargs [Label .seconds_to_label ] = kwargs .get (Label .seconds_to_label .name ,
117
- 0.0 )
118
- data = {
119
- Label .attribute (attr ) if isinstance (attr , str ) else attr :
120
- value .uid if isinstance (value , DbObject ) else value
121
- for attr , value in kwargs .items ()
122
- }
123
-
124
- query_str , params = query .create (Label , data )
125
- # Inject connection to Type
126
- query_str = query_str .replace (
127
- "data: {" , "data: {type: {connect: {name: \" Any\" }} " )
128
- res = self .client .execute (query_str , params )
129
- return Label (self .client , res ["createLabel" ])
130
-
131
98
def labels (self , datasets = None , order_by = None ):
132
99
""" Custom relationship expansion method to support limited filtering.
133
100
@@ -537,77 +504,6 @@ def extend_reservations(self, queue_type):
537
504
res = self .client .execute (query_str , {id_param : self .uid })
538
505
return res ["extendReservations" ]
539
506
540
- def create_prediction_model (self , name , version ):
541
- """ Creates a PredictionModel connected to a Legacy Editor Project.
542
-
543
- Args:
544
- name (str): The new PredictionModel's name.
545
- version (int): The new PredictionModel's version.
546
- Returns:
547
- A newly created PredictionModel.
548
- """
549
-
550
- logger .warning (
551
- "`create_prediction_model` is deprecated and is not compatible with the new editor."
552
- )
553
-
554
- PM = Entity .PredictionModel
555
- model = self .client ._create (PM , {
556
- PM .name .name : name ,
557
- PM .version .name : version
558
- })
559
- self .active_prediction_model .connect (model )
560
- return model
561
-
562
- def create_prediction (self , label , data_row , prediction_model = None ):
563
- """ Creates a Prediction within a Legacy Editor Project. Not supported
564
- in the new Editor.
565
-
566
- Args:
567
- label (str): The `label` field of the new Prediction.
568
- data_row (DataRow): The DataRow for which the Prediction is created.
569
- prediction_model (PredictionModel or None): The PredictionModel
570
- within which the new Prediction is created. If None then this
571
- Project's active_prediction_model is used.
572
- Return:
573
- A newly created Prediction.
574
- Raises:
575
- labelbox.excepions.InvalidQueryError: if given `prediction_model`
576
- is None and this Project's active_prediction_model is also
577
- None.
578
- """
579
- logger .warning (
580
- "`create_prediction` is deprecated and is not compatible with the new editor."
581
- )
582
-
583
- if prediction_model is None :
584
- prediction_model = self .active_prediction_model ()
585
- if prediction_model is None :
586
- raise InvalidQueryError (
587
- "Project '%s' has no active prediction model" % self .name )
588
-
589
- label_param = "label"
590
- model_param = "prediction_model_id"
591
- project_param = "project_id"
592
- data_row_param = "data_row_id"
593
-
594
- Prediction = Entity .Prediction
595
- query_str = """mutation CreatePredictionPyApi(
596
- $%s: String!, $%s: ID!, $%s: ID!, $%s: ID!) {createPrediction(
597
- data: {label: $%s, predictionModelId: $%s, projectId: $%s,
598
- dataRowId: $%s})
599
- {%s}}""" % (label_param , model_param , project_param , data_row_param ,
600
- label_param , model_param , project_param , data_row_param ,
601
- query .results_query_part (Prediction ))
602
- params = {
603
- label_param : label ,
604
- model_param : prediction_model .uid ,
605
- data_row_param : data_row .uid ,
606
- project_param : self .uid
607
- }
608
- res = self .client .execute (query_str , params )
609
- return Prediction (self .client , res ["createPrediction" ])
610
-
611
507
def enable_model_assisted_labeling (self , toggle : bool = True ) -> bool :
612
508
""" Turns model assisted labeling either on or off based on input
613
509
0 commit comments