99
1010from typeguard import typechecked
1111
12- from kili .domain .issue import IssueId , IssueStatus , IssueType
12+ from kili .domain .issue import IssueId , IssueStatus
1313from kili .domain .label import LabelId
1414from kili .domain .project import ProjectId
1515from kili .domain .types import ListOrTuple
@@ -28,13 +28,11 @@ class IssueFilter(TypedDict, total=False):
2828 asset_id: Id of the asset whose returned issues are associated to.
2929 asset_id_in: List of Ids of assets whose returned issues are associated to.
3030 status: Status of the issues to return (e.g., 'OPEN', 'SOLVED', 'CANCELLED').
31- issue_type: Type of the issue to return. An issue object both represents issues and questions in the app.
3231 """
3332
3433 asset_id : Optional [str ]
3534 asset_id_in : Optional [List [str ]]
3635 status : Optional [IssueStatus ]
37- issue_type : Optional [IssueType ]
3836
3937
4038class IssuesNamespace (DomainNamespace ):
@@ -99,10 +97,8 @@ def list(
9997 ) -> List [Dict ]:
10098 """Get a list of issues that match a set of criteria.
10199
102- !!! Info "Issues or Questions"
103- An `Issue` object both represent an issue and a question in the app.
104- To create them, two different methods are provided: `create_issues` and `create_questions`.
105- However to query issues and questions, we currently provide this unique method that retrieves both of them.
100+ !!! Info "Issues vs Questions"
101+ This method returns only issues (type='ISSUE'). For questions, use `kili.questions.list()` instead.
106102
107103 Args:
108104 project_id: Project ID the issue belongs to.
@@ -134,7 +130,9 @@ def list(
134130 ... filter={"status": "OPEN"}
135131 ... )
136132 """
137- filter_kwargs = filter or {}
133+ filter_kwargs : Dict [str , Any ] = dict (filter or {})
134+ # Force issue_type to ISSUE
135+ filter_kwargs ["issue_type" ] = "ISSUE"
138136 return self .client .issues (
139137 as_generator = False ,
140138 disable_tqdm = disable_tqdm ,
@@ -163,10 +161,9 @@ def list_as_generator(
163161 ) -> Generator [Dict , None , None ]:
164162 """Get a generator of issues that match a set of criteria.
165163
166- !!! Info "Issues or Questions"
167- An `Issue` object both represent an issue and a question in the app.
168- To create them, two different methods are provided: `create_issues` and `create_questions`.
169- However to query issues and questions, we currently provide this unique method that retrieves both of them.
164+ !!! Info "Issues vs Questions"
165+ This method returns only issues (type='ISSUE'). For questions, use
166+ `kili.questions.list_as_generator()` instead.
170167
171168 Args:
172169 project_id: Project ID the issue belongs to.
@@ -193,7 +190,9 @@ def list_as_generator(
193190 ... ):
194191 ... print(issue["id"])
195192 """
196- filter_kwargs = filter or {}
193+ filter_kwargs : Dict [str , Any ] = dict (filter or {})
194+ # Force issue_type to ISSUE
195+ filter_kwargs ["issue_type" ] = "ISSUE"
197196 return self .client .issues (
198197 as_generator = True ,
199198 disable_tqdm = disable_tqdm ,
@@ -225,7 +224,9 @@ def count(self, project_id: str, filter: Optional[IssueFilter] = None) -> int:
225224 ... filter={"asset_id_in": ["asset_1", "asset_2"], "status": "OPEN"}
226225 ... )
227226 """
228- filter_kwargs = filter or {}
227+ filter_kwargs : Dict [str , Any ] = dict (filter or {})
228+ # Force issue_type to ISSUE
229+ filter_kwargs ["issue_type" ] = "ISSUE"
229230 return self .client .count_issues (
230231 project_id = project_id ,
231232 ** filter_kwargs ,
0 commit comments