diff --git a/darwin/future/meta/queries/item.py b/darwin/future/meta/queries/item.py index cc93fb82f..b48a18928 100644 --- a/darwin/future/meta/queries/item.py +++ b/darwin/future/meta/queries/item.py @@ -96,7 +96,7 @@ def delete(self) -> None: filters = {"item_ids": [str(item) for item in ids]} delete_list_of_items(self.client, team_slug, dataset_ids, filters) - def move_to_folder(self, path) -> None: + def move_to_folder(self, path: str) -> None: if "team_slug" not in self.meta_params: raise ValueError("Must specify team_slug to query items") diff --git a/darwin/future/tests/core/fixtures.py b/darwin/future/tests/core/fixtures.py index 025851c37..882f0d411 100644 --- a/darwin/future/tests/core/fixtures.py +++ b/darwin/future/tests/core/fixtures.py @@ -135,7 +135,7 @@ def base_item_json_response() -> dict: @pytest.fixture -def base_items_json_response(base_item_json_response) -> dict: +def base_items_json_response(base_item_json_response: dict) -> dict: return {"items": [base_item_json_response]} diff --git a/darwin/future/tests/core/items/test_set_stage_to_items.py b/darwin/future/tests/core/items/test_set_stage_to_items.py index 204b63f94..a1c2954b5 100644 --- a/darwin/future/tests/core/items/test_set_stage_to_items.py +++ b/darwin/future/tests/core/items/test_set_stage_to_items.py @@ -1,8 +1,11 @@ +from typing import Dict + import pytest import responses from darwin.future.core.client import ClientCore from darwin.future.core.items.set_stage_to_items import set_stage_to_items +from darwin.future.data_objects.typing import UnknownType from darwin.future.exceptions import BadRequest from darwin.future.tests.core.fixtures import * @@ -44,7 +47,7 @@ def test_set_stage_to_items_filters_error(base_client: ClientCore) -> None: dataset_ids = [1, 2, 3] stage_id = "123456" workflow_id = "123456" - filters = {} + filters: Dict[str, UnknownType] = {} responses.add( responses.POST, diff --git a/darwin/future/tests/core/items/test_tag_items.py b/darwin/future/tests/core/items/test_tag_items.py index d673c0c48..d3eebe70e 100644 --- a/darwin/future/tests/core/items/test_tag_items.py +++ b/darwin/future/tests/core/items/test_tag_items.py @@ -1,8 +1,11 @@ +from typing import Dict + import pytest import responses from darwin.future.core.client import ClientCore from darwin.future.core.items.tag_items import tag_items +from darwin.future.data_objects.typing import UnknownType from darwin.future.exceptions import BadRequest from darwin.future.tests.core.fixtures import * @@ -42,7 +45,7 @@ def test_tag_items_empty_filters_error(base_client: ClientCore) -> None: dataset_ids = [1, 2, 3] tag_id = 123456 # this should raise an error as no filters are provided - filters = {} + filters: Dict[str, UnknownType] = {} responses.add( responses.POST, @@ -89,6 +92,6 @@ def test_tag_items_bad_request_error(base_client: ClientCore) -> None: client=base_client, team_slug=team_slug, dataset_ids=dataset_ids, - tag_id=tag_id, + tag_id=tag_id, # type: ignore filters=filters, ) diff --git a/darwin/future/tests/core/items/test_untag_items.py b/darwin/future/tests/core/items/test_untag_items.py index 9933ea302..7d1e0da4e 100644 --- a/darwin/future/tests/core/items/test_untag_items.py +++ b/darwin/future/tests/core/items/test_untag_items.py @@ -1,8 +1,11 @@ +from typing import Dict + import pytest import responses from darwin.future.core.client import ClientCore from darwin.future.core.items.untag_items import untag_items +from darwin.future.data_objects.typing import UnknownType from darwin.future.exceptions import BadRequest from darwin.future.tests.core.fixtures import * @@ -42,7 +45,7 @@ def test_untag_items_empty_filters_error(base_client: ClientCore) -> None: dataset_ids = [1, 2, 3] tag_id = 123456 # this should raise an error as no filters are provided - filters = {} + filters: Dict[str, UnknownType] = {} responses.add( responses.DELETE, @@ -89,6 +92,6 @@ def test_untag_items_bad_request_error(base_client: ClientCore) -> None: client=base_client, team_slug=team_slug, dataset_ids=dataset_ids, - tag_id=tag_id, + tag_id=tag_id, # type: ignore filters=filters, ) diff --git a/darwin/future/tests/data_objects/test_darwin.py b/darwin/future/tests/data_objects/test_darwin.py index 23482f5f1..ff22ce563 100644 --- a/darwin/future/tests/data_objects/test_darwin.py +++ b/darwin/future/tests/data_objects/test_darwin.py @@ -17,7 +17,7 @@ def raw_json() -> dict: return raw_json -def test_loads_base_darwin_v2(raw_json: dict): +def test_loads_base_darwin_v2(raw_json: dict) -> None: test = DarwinV2.model_validate(raw_json) assert len(test.annotations) == 3 assert isinstance(test.annotations[0], BoundingBoxAnnotation) @@ -25,22 +25,22 @@ def test_loads_base_darwin_v2(raw_json: dict): assert isinstance(test.annotations[2], PolygonAnnotation) -def test_bbox_annotation(raw_json: dict): +def test_bbox_annotation(raw_json: dict) -> None: bounds_annotation = raw_json["annotations"][0] BoundingBoxAnnotation.model_validate(bounds_annotation) -def test_ellipse_annotation(raw_json: dict): +def test_ellipse_annotation(raw_json: dict) -> None: ellipse_annotation = raw_json["annotations"][1] EllipseAnnotation.model_validate(ellipse_annotation) -def test_polygon_annotation(raw_json: dict): +def test_polygon_annotation(raw_json: dict) -> None: polygon_annotation = raw_json["annotations"][2] PolygonAnnotation.model_validate(polygon_annotation) -def test_polygon_bbx_validator(raw_json: dict): +def test_polygon_bbx_validator(raw_json: dict) -> None: polygon_annotation = raw_json["annotations"][2] without_bbx = polygon_annotation.copy() del without_bbx["bounding_box"] diff --git a/darwin/future/tests/meta/objects/test_itemmeta.py b/darwin/future/tests/meta/objects/test_itemmeta.py index 946b13c16..4475087ab 100644 --- a/darwin/future/tests/meta/objects/test_itemmeta.py +++ b/darwin/future/tests/meta/objects/test_itemmeta.py @@ -102,7 +102,7 @@ def test_move_to_folder_raises_on_incorrect_parameters(item: Item) -> None: json={}, ) with pytest.raises(BadRequest): - item.move_to_folder(path) + item.move_to_folder(path) # type: ignore def test_move_to_folder_with_bad_team_slug(item: Item) -> None: @@ -160,7 +160,7 @@ def test_set_priority_raises_on_incorrect_parameters(item: Item) -> None: json={}, ) with pytest.raises(BadRequest): - item.set_priority(priority) + item.set_priority(priority) # type: ignore def test_set_priority_with_bad_team_slug(item: Item) -> None: @@ -259,7 +259,7 @@ def test_set_layout_raises_on_incorrect_parameters(item: Item) -> None: item.meta_params["dataset_id"] layout = "invalid_layout" with pytest.raises(AssertionError): - item.set_layout(layout) + item.set_layout(layout) # type: ignore def test_set_layout_with_bad_team_slug(item: Item) -> None: @@ -298,7 +298,7 @@ def test_tag_bad_input(item: Item) -> None: with responses.RequestsMock(): tag_id = "123456" with pytest.raises(BadRequest) as excinfo: - item.tag(tag_id) + item.tag(tag_id) # type: ignore (msg,) = excinfo.value.args assert msg == "tag_id must be an integer, got " @@ -332,7 +332,7 @@ def test_untag_bad_input(item: Item) -> None: with responses.RequestsMock(): tag_id = "123456" with pytest.raises(BadRequest) as excinfo: - item.untag(tag_id) + item.untag(tag_id) # type: ignore (msg,) = excinfo.value.args assert msg == "tag_id must be an integer, got " diff --git a/darwin/future/tests/meta/objects/test_workflowmeta.py b/darwin/future/tests/meta/objects/test_workflowmeta.py index 6c8e39bb3..950fff2d8 100644 --- a/darwin/future/tests/meta/objects/test_workflowmeta.py +++ b/darwin/future/tests/meta/objects/test_workflowmeta.py @@ -7,7 +7,9 @@ def test_item_set_stage_with_stage_object( - workflow: Workflow, base_single_workflow_object, base_items_json_response + workflow: Workflow, + base_single_workflow_object: list, + base_items_json_response: dict, ) -> None: with responses.RequestsMock() as rsps: rsps.add( diff --git a/darwin/future/tests/meta/queries/test_item.py b/darwin/future/tests/meta/queries/test_item.py index 3144ce040..b307da448 100644 --- a/darwin/future/tests/meta/queries/test_item.py +++ b/darwin/future/tests/meta/queries/test_item.py @@ -146,7 +146,7 @@ def test_move_to_folder_raises_on_incorrect_parameters( json={}, ) with pytest.raises(BadRequest): - item_query.move_to_folder(path) + item_query.move_to_folder(path) # type: ignore def test_set_priority( @@ -223,7 +223,7 @@ def test_set_priority_raises_on_incorrect_parameters( json={}, ) with pytest.raises(BadRequest): - item_query.set_priority(priority) + item_query.set_priority(priority) # type: ignore def test_restore( @@ -341,7 +341,7 @@ def test_set_layout_raises_on_incorrect_parameters( items[0].meta_params["dataset_id"] layout = "invalid_layout" with pytest.raises(AssertionError): - item_query.set_layout(layout) + item_query.set_layout(layout) # type: ignore def test_tag(item_query: ItemQuery, items_json: List[dict], items: List[Item]) -> None: @@ -386,7 +386,7 @@ def test_tag_bad_request( with responses.RequestsMock(): tag_id = "123456" with pytest.raises(BadRequest) as excinfo: - item_query.tag(tag_id) + item_query.tag(tag_id) # type: ignore (msg,) = excinfo.value.args assert msg == "tag_id must be an integer, got " @@ -435,7 +435,7 @@ def test_untag_bad_request( with responses.RequestsMock(): tag_id = "123456" with pytest.raises(BadRequest) as excinfo: - item_query.untag(tag_id) + item_query.untag(tag_id) # type: ignore (msg,) = excinfo.value.args assert msg == "tag_id must be an integer, got "