Skip to content

Commit

Permalink
Formatted files
Browse files Browse the repository at this point in the history
  • Loading branch information
Tim-Kerr committed Dec 17, 2024
1 parent 488a02b commit e22265f
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 14 deletions.
3 changes: 2 additions & 1 deletion libs/labelbox/src/labelbox/schema/ontology.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
from labelbox.schema.tool_building.types import FeatureSchemaAttributes



class DeleteFeatureFromOntologyResult:
archived: bool
deleted: bool
Expand All @@ -45,6 +44,7 @@ class FeatureSchema(DbObject):
color = Field.String("name")
normalized = Field.Json("normalized")


@dataclass
class Tool:
"""
Expand Down Expand Up @@ -98,6 +98,7 @@ class Type(Enum):
schema_id: Optional[str] = None
feature_schema_id: Optional[str] = None
attributes: Optional[FeatureSchemaAttributes] = None

@classmethod
def from_dict(cls, dictionary: Dict[str, Any]) -> Dict[str, Any]:
return cls(
Expand Down
13 changes: 10 additions & 3 deletions libs/labelbox/src/labelbox/schema/tool_building/classification.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@

from lbox.exceptions import InconsistentOntologyException

from labelbox.schema.tool_building.types import FeatureSchemaId, FeatureSchemaAttributes
from labelbox.schema.tool_building.types import (
FeatureSchemaId,
FeatureSchemaAttributes,
)


@dataclass
Expand Down Expand Up @@ -91,7 +94,9 @@ def __post_init__(self):
if self.instructions is None:
self.instructions = self.name
if self.attributes is not None:
warnings.warn('Attributes are an experimental feature and may change in the future.')
warnings.warn(
"Attributes are an experimental feature and may change in the future."
)

@classmethod
def from_dict(cls, dictionary: Dict[str, Any]) -> "Classification":
Expand Down Expand Up @@ -123,7 +128,9 @@ def asdict(self, is_subclass: bool = False) -> Dict[str, Any]:
"options": [o.asdict() for o in self.options],
"schemaNodeId": self.schema_id,
"featureSchemaId": self.feature_schema_id,
"attributes": self.attributes if self.attributes is not None else None,
"attributes": self.attributes
if self.attributes is not None
else None,
}
if (
self.class_type == self.Type.RADIO
Expand Down
5 changes: 4 additions & 1 deletion libs/labelbox/src/labelbox/schema/tool_building/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@ class FeatureSchemaAttribute(TypedDict):
attributeName: str
attributeValue: str


FeatureSchemaAttriubte = Annotated[FeatureSchemaAttribute, Field()]

FeatureSchemaId = Annotated[str, Field(min_length=25, max_length=25)]
SchemaId = Annotated[str, Field(min_length=25, max_length=25)]
FeatureSchemaAttributes = Annotated[List[FeatureSchemaAttribute], Field(default_factory=list)]
FeatureSchemaAttributes = Annotated[
List[FeatureSchemaAttribute], Field(default_factory=list)
]
16 changes: 8 additions & 8 deletions libs/labelbox/tests/unit/test_unit_ontology.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"color": "#FF0000",
"tool": "polygon",
"classifications": [],
"attributes": None
"attributes": None,
},
{
"schemaNodeId": None,
Expand All @@ -25,7 +25,7 @@
"color": "#FF0000",
"tool": "superpixel",
"classifications": [],
"attributes": None
"attributes": None,
},
{
"schemaNodeId": None,
Expand Down Expand Up @@ -59,7 +59,7 @@
"name": "nested nested text",
"type": "text",
"options": [],
"attributes": None
"attributes": None,
}
],
},
Expand All @@ -71,7 +71,7 @@
"options": [],
},
],
"attributes": None
"attributes": None,
},
{
"schemaNodeId": None,
Expand All @@ -81,7 +81,7 @@
"name": "nested text",
"type": "text",
"options": [],
"attributes": None
"attributes": None,
},
],
},
Expand All @@ -93,7 +93,7 @@
"color": "#FF0000",
"tool": "point",
"classifications": [],
"attributes": None
"attributes": None,
},
{
"schemaNodeId": None,
Expand All @@ -103,7 +103,7 @@
"color": "#FF0000",
"tool": "line",
"classifications": [],
"attributes": None
"attributes": None,
},
{
"schemaNodeId": None,
Expand All @@ -113,7 +113,7 @@
"color": "#FF0000",
"tool": "named-entity",
"classifications": [],
"attributes": None
"attributes": None,
},
],
"classifications": [
Expand Down
2 changes: 1 addition & 1 deletion libs/labelbox/tests/unit/test_unit_prompt_issue_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def test_as_dict():
"schemaNodeId": None,
"featureSchemaId": None,
"scope": "global",
"attributes": None
"attributes": None,
}
],
"color": None,
Expand Down

0 comments on commit e22265f

Please sign in to comment.