Skip to content

Commit 211507c

Browse files
committed
fix(LAB-4081): remove status_not_in filter on workflow V1 legacy projects
1 parent 69b58df commit 211507c

File tree

6 files changed

+1
-78
lines changed

6 files changed

+1
-78
lines changed

src/kili/adapters/kili_api_gateway/asset/mappers.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ def asset_where_mapper(filters: AssetFilters):
2828
"externalIdStrictlyIn": filters.external_id_strictly_in,
2929
"externalIdIn": filters.external_id_in,
3030
"statusIn": filters.status_in,
31-
"statusNotIn": filters.status_not_in,
3231
"consensusMarkGte": filters.consensus_mark_gte,
3332
"consensusMarkLte": filters.consensus_mark_lte,
3433
"honeypotMarkGte": filters.honeypot_mark_gte,

src/kili/domain/asset/asset.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ class AssetFilters:
6262
issue_status: Optional["IssueStatus"] = None
6363
skipped: Optional[bool] = None
6464
status_in: Optional[ListOrTuple[AssetStatus]] = None
65-
status_not_in: Optional[ListOrTuple[AssetStatus]] = None
6665
step_id_in: Optional[ListOrTuple[str]] = None
6766
step_id_not_in: Optional[ListOrTuple[str]] = None
6867
step_status_in: Optional[ListOrTuple[StatusInStep]] = None
@@ -74,7 +73,6 @@ class AssetWorkflowFilters(TypedDict, total=False):
7473

7574
skipped: Optional[bool]
7675
status_in: Optional[ListOrTuple[AssetStatus]]
77-
status_not_in: Optional[ListOrTuple[AssetStatus]]
7876
step_name_in: Optional[ListOrTuple[str]]
7977
step_name_not_in: Optional[ListOrTuple[str]]
8078
step_status_in: Optional[ListOrTuple[StatusInStep]]

src/kili/domain/asset/helpers.py

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -34,42 +34,24 @@ def check_asset_workflow_arguments(
3434
) -> None:
3535
"""Check asset workflow parameters relative to the project workflow version."""
3636
step_name_in = asset_workflow_filters.get("step_name_in")
37-
step_name_not_in = asset_workflow_filters.get("step_name_not_in")
3837
step_status_in = asset_workflow_filters.get("step_status_in")
39-
step_status_not_in = asset_workflow_filters.get("step_status_not_in")
4038
status_in = asset_workflow_filters.get("status_in")
41-
status_not_in = asset_workflow_filters.get("status_not_in")
4239
skipped = asset_workflow_filters.get("skipped")
4340

4441
if project_workflow_version == "V2":
4542
if step_status_in is not None and status_in is not None:
4643
raise ValueError(
4744
"Filters step_status_in and status_in both given : only use filter step_status_in for this project."
4845
)
49-
if step_status_not_in is not None and status_not_in is not None:
50-
raise ValueError(
51-
"Filters step_status_not_in and status_not_in both given : "
52-
"only use filter step_status_not_in for this project."
53-
)
5446
if step_name_in is not None and status_in is not None:
5547
raise ValueError(
5648
"Filters step_name_in and status_in both given : use filter step_status_in instead of status_in for this project." # pylint: disable=line-too-long
5749
)
58-
if step_name_not_in is not None and status_not_in is not None:
59-
raise ValueError(
60-
"Filters step_name_not_in and status_not_in both given : use filter step_status_not_in instead of status_not_in for this project." # pylint: disable=line-too-long
61-
)
6250
if status_in is not None:
6351
warnings.warn(
6452
"Filter status_in given : use filters step_status_in and step_name_in instead for this project.",
6553
stacklevel=1,
6654
)
67-
if status_not_in is not None:
68-
warnings.warn(
69-
"Filter status_not_in given : use filters step_status_not_in and "
70-
"step_name_not_in instead for this project.",
71-
stacklevel=1,
72-
)
7355
if skipped is not None:
7456
warnings.warn(
7557
"Filter skipped given : only use filter step_status_in with the SKIPPED step status instead for this project", # pylint: disable=line-too-long
@@ -82,7 +64,3 @@ def check_asset_workflow_arguments(
8264
raise ValueError(
8365
"Filters step_name_in and/or step_status_in given : use filter status_in for this project."
8466
)
85-
if step_name_not_in is not None or step_status_not_in is not None:
86-
raise ValueError(
87-
"Filters step_name_not_in and/or step_status_not_in given : use filter status_not_in for this project."
88-
)

src/kili/domain_api/assets.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@ class AssetFilter(TypedDict, total=False):
8787
metadata_where: Optional[dict[str, Any]]
8888
skipped: Optional[bool]
8989
status_in: Optional[list[AssetStatus]]
90-
status_not_in: Optional[list[AssetStatus]]
9190
step_name_in: Optional[list[str]]
9291
step_name_not_in: Optional[list[str]]
9392
step_status_in: Optional[list[StatusInStep]]

src/kili/presentation/client/asset.py

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,6 @@ def assets(
156156
label_output_format: Literal["dict", "parsed_label"] = "dict",
157157
skipped: Optional[bool] = None,
158158
status_in: Optional[list[AssetStatus]] = None,
159-
status_not_in: Optional[list[AssetStatus]] = None,
160159
step_name_in: Optional[list[str]] = None,
161160
step_name_not_in: Optional[list[str]] = None,
162161
step_status_in: Optional[list[StatusInStep]] = None,
@@ -225,7 +224,6 @@ def assets(
225224
label_output_format: Literal["dict", "parsed_label"] = "dict",
226225
skipped: Optional[bool] = None,
227226
status_in: Optional[list[AssetStatus]] = None,
228-
status_not_in: Optional[list[AssetStatus]] = None,
229227
step_name_in: Optional[list[str]] = None,
230228
step_name_not_in: Optional[list[str]] = None,
231229
step_status_in: Optional[list[StatusInStep]] = None,
@@ -294,7 +292,6 @@ def assets(
294292
label_output_format: Literal["dict", "parsed_label"] = "dict",
295293
skipped: Optional[bool] = None,
296294
status_in: Optional[list[AssetStatus]] = None,
297-
status_not_in: Optional[list[AssetStatus]] = None,
298295
step_name_in: Optional[list[str]] = None,
299296
step_name_not_in: Optional[list[str]] = None,
300297
step_status_in: Optional[list[StatusInStep]] = None,
@@ -368,9 +365,6 @@ def assets(
368365
status_in: Returned assets should have a status that belongs to that list, if given.
369366
Possible choices: `TODO`, `ONGOING`, `LABELED`, `TO_REVIEW` or `REVIEWED`.
370367
Only applicable if the project is in the WorkflowV1 (legacy).
371-
status_not_in: Returned assets should have a status that does not belong to that list, if given.
372-
Possible choices: `TODO`, `ONGOING`, `LABELED`, `TO_REVIEW` or `REVIEWED`.
373-
Only applicable if the project is in the WorkflowV1 (legacy).
374368
step_name_in: Returned assets are in the step whose name belong to that list, if given.
375369
Only applicable if the project is in WorkflowV2.
376370
step_name_not_in: Returned assets are in the step whose name does not belong to that list, if given.
@@ -480,7 +474,6 @@ def assets(
480474
step_status_in is not None
481475
or step_status_not_in is not None
482476
or status_in is not None
483-
or status_not_in is not None
484477
or skipped is not None
485478
)
486479
if has_step_filters or has_status_filters:
@@ -489,7 +482,6 @@ def assets(
489482
asset_workflow_filters={
490483
"skipped": skipped,
491484
"status_in": status_in,
492-
"status_not_in": status_not_in,
493485
"step_name_in": step_name_in,
494486
"step_name_not_in": step_name_not_in,
495487
"step_status_in": step_status_in,
@@ -554,7 +546,6 @@ def assets(
554546
step_id_not_in=step_id_not_in,
555547
step_status_in=step_status_in,
556548
step_status_not_in=step_status_not_in,
557-
status_not_in=status_not_in,
558549
)
559550
assets_gen = asset_use_cases.list_assets(
560551
filters,
@@ -630,7 +621,6 @@ def count_assets(
630621
step_name_not_in: Optional[list[str]] = None,
631622
step_status_in: Optional[list[StatusInStep]] = None,
632623
step_status_not_in: Optional[list[StatusInStep]] = None,
633-
status_not_in: Optional[list[AssetStatus]] = None,
634624
) -> int:
635625
# pylint: disable=line-too-long
636626
"""Count and return the number of assets with the given constraints.
@@ -697,9 +687,6 @@ def count_assets(
697687
step_status_not_in: Returned assets have the status of their step that does not belong to that list, if given.
698688
Possible choices: `TO_DO`, `DOING`, `PARTIALLY_DONE`, `REDO`, `DONE`, `SKIPPED`.
699689
Only applicable if the project is in WorkflowV2.
700-
status_not_in: Returned assets should have a status that does not belong to that list, if given.
701-
Possible choices: `TODO`, `ONGOING`, `LABELED`, `TO_REVIEW` or `REVIEWED`.
702-
Only applicable if the project is in WorkflowV1 (legacy).
703690
704691
!!! info "Dates format"
705692
Date strings should have format: "YYYY-MM-DD"
@@ -745,10 +732,7 @@ def count_assets(
745732
step_id_not_in = None
746733
has_step_filters = step_name_in is not None or step_name_not_in is not None
747734
has_status_filters = (
748-
status_in is not None
749-
or status_not_in is not None
750-
or step_status_in is not None
751-
or step_status_not_in is not None
735+
status_in is not None or step_status_in is not None or step_status_not_in is not None
752736
)
753737
if has_step_filters or has_status_filters:
754738
project_use_cases = ProjectUseCases(self.kili_api_gateway)
@@ -765,7 +749,6 @@ def count_assets(
765749
"step_status_in": step_status_in,
766750
"step_status_not_in": step_status_not_in,
767751
"status_in": status_in,
768-
"status_not_in": status_not_in,
769752
},
770753
)
771754

@@ -826,7 +809,6 @@ def count_assets(
826809
step_id_not_in=step_id_not_in,
827810
step_status_in=step_status_in,
828811
step_status_not_in=step_status_not_in,
829-
status_not_in=status_not_in,
830812
)
831813
asset_use_cases = AssetUseCases(self.kili_api_gateway)
832814
return asset_use_cases.count_assets(filters)

tests/unit/domain_api/test_assets.py

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -109,22 +109,6 @@ def test_list_assets_as_list(self, assets_namespace):
109109
assert call_kwargs["project_id"] == "project_123"
110110
assert call_kwargs["as_generator"] is False
111111

112-
def test_list_assets_with_status_not_in_filter(self, assets_namespace):
113-
"""Test list method with status_not_in filter."""
114-
# Mock the legacy client method
115-
assets_namespace._client.assets.return_value = [
116-
{"id": "asset1", "externalId": "ext1", "status": "LABELED"},
117-
]
118-
119-
result = assets_namespace.list(
120-
project_id="project_123", filter={"status_not_in": ["TODO", "ONGOING"]}
121-
)
122-
123-
# Verify the legacy method was called with the filter
124-
assets_namespace._client.assets.assert_called_once()
125-
call_kwargs = assets_namespace._client.assets.call_args[1]
126-
assert call_kwargs["status_not_in"] == ["TODO", "ONGOING"]
127-
128112
def test_list_assets_with_step_status_not_in_filter(self, assets_namespace):
129113
"""Test list method with step_status_not_in filter."""
130114
# Mock the legacy client method
@@ -157,23 +141,6 @@ def test_list_assets_with_step_name_not_in_filter(self, assets_namespace):
157141
call_kwargs = assets_namespace._client.assets.call_args[1]
158142
assert call_kwargs["step_name_not_in"] == ["Review", "QA"]
159143

160-
def test_count_assets_with_status_not_in_filter(self, assets_namespace):
161-
"""Test count method with status_not_in filter."""
162-
# Mock the legacy client method
163-
assets_namespace._client.count_assets.return_value = 42
164-
165-
result = assets_namespace.count(
166-
project_id="project_123", filter={"status_not_in": ["REVIEWED"]}
167-
)
168-
169-
# Verify the result
170-
assert result == 42
171-
172-
# Verify the legacy method was called with the filter
173-
assets_namespace._client.count_assets.assert_called_once()
174-
call_kwargs = assets_namespace._client.count_assets.call_args[1]
175-
assert call_kwargs["status_not_in"] == ["REVIEWED"]
176-
177144
def test_count_assets_with_step_filters_not_in(self, assets_namespace):
178145
"""Test count method with step_status_not_in and step_name_not_in filters."""
179146
# Mock the legacy client method

0 commit comments

Comments
 (0)