Skip to content

Commit 832ef39

Browse files
author
Val Brodsky
committed
Fix lint issues
1 parent 0a407e6 commit 832ef39

File tree

4 files changed

+13
-17
lines changed

4 files changed

+13
-17
lines changed

libs/labelbox/src/labelbox/schema/tool_building/classification.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ class UIMode(Enum):
6666
options: List["Option"] = field(default_factory=list)
6767
schema_id: Optional[str] = None
6868
feature_schema_id: Optional[str] = None
69-
scope: Scope = None
69+
scope: Optional[Scope] = None
7070
ui_mode: Optional[UIMode] = (
7171
None # How this classification should be answered (e.g. hotkeys / autocomplete, etc)
7272
)
@@ -203,7 +203,7 @@ def add_option(
203203
f"Duplicate nested classification '{option.name}' "
204204
f"for option '{self.label}'"
205205
)
206-
self.options.append(option)
206+
self.options.append(option) # type: ignore
207207

208208

209209
@dataclass
@@ -305,7 +305,7 @@ def asdict(self, is_subclass: bool = False) -> Dict[str, Any]:
305305
raise InconsistentOntologyException(
306306
f"Response Classification '{self.name}' requires options."
307307
)
308-
classification = {
308+
classification: Dict[str, Any] = {
309309
"type": self.class_type.value,
310310
"instructions": self.instructions,
311311
"name": self.name,
Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
from typing import Annotated, Type
22

3-
from pydantic import StringConstraints
3+
from pydantic import Field
44

5-
FeatureSchemaId: Type[str] = Annotated[
6-
str, StringConstraints(min_length=25, max_length=25)
7-
]
8-
SchemaId: Type[str] = Annotated[
9-
str, StringConstraints(min_length=25, max_length=25)
10-
]
5+
FeatureSchemaId: Type[str] = Annotated[str, Field(min_length=25, max_length=25)]
6+
SchemaId: Type[str] = Annotated[str, Field(min_length=25, max_length=25)]

libs/labelbox/tests/integration/test_chat_evaluation_ontology_project.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def test_create_chat_evaluation_ontology_project(
1515
# here we are essentially testing the ontology creation which is a fixture
1616
assert ontology
1717
assert ontology.name
18-
assert len(ontology.tools()) == 5
18+
assert len(ontology.tools()) == 6
1919
for tool in ontology.tools():
2020
assert tool.schema_id
2121
assert tool.feature_schema_id

libs/labelbox/tests/unit/test_unit_fact_checking_tool.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,8 @@ def test_fact_checking_as_dict_default():
4545

4646
def test_step_reasoning_as_dict_with_actions():
4747
tool = FactCheckingTool(name="Fact Checking Tool")
48-
tool.set_unsupported_step_actions([])
49-
tool.set_cant_confidently_assess_step_actions([])
50-
tool.set_no_factual_information_step_actions([])
48+
for variant in tool.definition.variants:
49+
variant.set_actions([])
5150

5251
# Get the dictionary representation
5352
tool_dict = tool.asdict()
@@ -59,11 +58,12 @@ def test_step_reasoning_as_dict_with_actions():
5958
"required": False,
6059
"schemaNodeId": None,
6160
"featureSchemaId": None,
61+
"color": None,
6262
"definition": {
6363
"variants": [
64-
{"id": 0, "name": "Accurate"},
65-
{"id": 1, "name": "Inaccurate"},
66-
{"id": 2, "name": "Disputed"},
64+
{"id": 0, "name": "Accurate", "actions": []},
65+
{"id": 1, "name": "Inaccurate", "actions": []},
66+
{"id": 2, "name": "Disputed", "actions": []},
6767
{
6868
"id": 3,
6969
"name": "Unsupported",

0 commit comments

Comments
 (0)