Skip to content

Commit a989935

Browse files
author
Matt Sokoloff
committed
cleaned up
1 parent 3696f7f commit a989935

File tree

4 files changed

+2
-67
lines changed

4 files changed

+2
-67
lines changed

labelbox/client.py

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
from datetime import datetime, timezone
22
import json
3-
from labelbox.schema.ontology import Ontology
43
import logging
54
import mimetypes
65
import os
@@ -415,12 +414,6 @@ def get_datasets(self, where=None):
415414
"""
416415
return self._get_all(Dataset, where)
417416

418-
def get_ontologies(self, where=None):
419-
"""
420-
#TODO
421-
"""
422-
return self._get_all(Ontology, where)
423-
424417
def get_labeling_frontends(self, where=None):
425418
""" Fetches all the labeling frontends.
426419
@@ -479,9 +472,7 @@ def create_dataset(self, **kwargs):
479472
"""
480473
return self._create(Dataset, kwargs)
481474

482-
def create_project(self,
483-
ontology=None,
484-
**kwargs): #<<<<< TODO: Do we want that signature
475+
def create_project(self, **kwargs):
485476
""" Creates a Project object on the server.
486477
487478
Attribute values are passed as keyword arguments.

labelbox/schema/labeling_frontend.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ class LabelingFrontendOptions(DbObject):
3535
organization (Relationship): `ToOne` relationship to Organization
3636
"""
3737
customization_options = Field.String("customization_options")
38+
3839
project = Relationship.ToOne("Project")
3940
labeling_frontend = Relationship.ToOne("LabelingFrontend")
4041
organization = Relationship.ToOne("Organization")

labelbox/schema/ontology.py

Lines changed: 0 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -63,55 +63,9 @@ def from_json(cls, json_dict):
6363
return cls(**_dict)
6464

6565

66-
"""
67-
* The reason that an ontology is read only is because it is a second class citizen to labeling front end options.
68-
** This is because it is a more specific implementation of this.
69-
70-
- However, we want to support ontologies as if they were labeling front ends.
71-
- With this special relationship we can override the default behavior to mock the appropriate changes to the labeling front end
72-
73-
74-
###Note: The only problem is that you can't just create a stand alone ontology. right?
75-
# - Since you need to create a project and query the project ontology before one exists.
76-
77-
^^^^^^^ This is the worst. Even with hackery, you can't force a DB entry without create a new proj :(
78-
However, labeling front-ends cannot be created without projects either! So maybe we just copy the use cases of that.
79-
Use this as the simpler interface and make it clear that this is just a limited version
80-
81-
"""
82-
83-
84-
class OntologyRelationship(Relationship):
85-
86-
def __get__(self, parent):
87-
if not self.parent:
88-
self.parent = parent
89-
return self
90-
91-
def __init__(self):
92-
super(OntologyRelationship, self).__init__()
93-
self.parent = None
94-
95-
def __call__(self):
96-
if self.parent.setup_complete is None:
97-
#As it currently stands, it creates a new ontology with no new tools and the ontology cannot be edited.
98-
return None
99-
return super().__call__
100-
101-
def connect(self, other_ontology):
102-
if not isinstance(other_ontology, OntologyRelationship):
103-
raise Exception("only support ")
104-
105-
def disconnect(self):
106-
raise Exception(
107-
"Disconnect is not supported for Onotlogy. Instead connect another ontology to replace the current one."
108-
)
109-
110-
11166
class Ontology(DbObject):
11267
"""An ontology specifies which tools and classifications are available
11368
to a project. This is read only for now.
114-
11569
Attributes:
11670
name (str)
11771
description (str)
@@ -120,7 +74,6 @@ class Ontology(DbObject):
12074
normalized (json)
12175
object_schema_count (int)
12276
classification_schema_count (int)
123-
12477
projects (Relationship): `ToMany` relationship to Project
12578
created_by (Relationship): `ToOne` relationship to User
12679
"""

labelbox/schema/project.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -221,16 +221,6 @@ def review_metrics(self, net_score):
221221
res = self.client.execute(query_str, {id_param: self.uid})
222222
return res["project"]["reviewMetrics"]["labelAggregate"]["count"]
223223

224-
def setup_from_ontology(self, ontology):
225-
"""
226-
* An ontology is a specific kind of a labeling frontend option that is compatible with the Editor.
227-
* Most customers use this interface
228-
"""
229-
frontend = list(
230-
client.get_labeling_frontends(
231-
where=LabelingFrontend.name == "Editor"))[0]
232-
return self.setup(frontend, ontology.normalized)
233-
234224
def setup(self, labeling_frontend, labeling_frontend_options):
235225
""" Finalizes the Project setup.
236226

0 commit comments

Comments
 (0)