@@ -110,8 +110,11 @@ def assets(
110110 label_output_format : Literal ["dict" , "parsed_label" ] = "dict" ,
111111 skipped : Optional [bool ] = None ,
112112 status_in : Optional [List [AssetStatus ]] = None ,
113+ status_not_in : Optional [List [AssetStatus ]] = None ,
113114 step_name_in : Optional [List [str ]] = None ,
115+ step_name_not_in : Optional [List [str ]] = None ,
114116 step_status_in : Optional [List [StatusInStep ]] = None ,
117+ step_status_not_in : Optional [List [StatusInStep ]] = None ,
115118 * ,
116119 as_generator : Literal [True ],
117120 ) -> Generator [Dict , None , None ]:
@@ -176,8 +179,11 @@ def assets(
176179 label_output_format : Literal ["dict" , "parsed_label" ] = "dict" ,
177180 skipped : Optional [bool ] = None ,
178181 status_in : Optional [List [AssetStatus ]] = None ,
182+ status_not_in : Optional [List [AssetStatus ]] = None ,
179183 step_name_in : Optional [List [str ]] = None ,
184+ step_name_not_in : Optional [List [str ]] = None ,
180185 step_status_in : Optional [List [StatusInStep ]] = None ,
186+ step_status_not_in : Optional [List [StatusInStep ]] = None ,
181187 * ,
182188 as_generator : Literal [False ] = False ,
183189 ) -> List [Dict ]:
@@ -242,8 +248,11 @@ def assets(
242248 label_output_format : Literal ["dict" , "parsed_label" ] = "dict" ,
243249 skipped : Optional [bool ] = None ,
244250 status_in : Optional [List [AssetStatus ]] = None ,
251+ status_not_in : Optional [List [AssetStatus ]] = None ,
245252 step_name_in : Optional [List [str ]] = None ,
253+ step_name_not_in : Optional [List [str ]] = None ,
246254 step_status_in : Optional [List [StatusInStep ]] = None ,
255+ step_status_not_in : Optional [List [StatusInStep ]] = None ,
247256 * ,
248257 as_generator : bool = False ,
249258 ) -> Union [Iterable [Dict ], "pd.DataFrame" ]:
@@ -313,10 +322,18 @@ def assets(
313322 status_in: Returned assets should have a status that belongs to that list, if given.
314323 Possible choices: `TODO`, `ONGOING`, `LABELED`, `TO_REVIEW` or `REVIEWED`.
315324 Only applicable if the project is in the WorkflowV1 (legacy).
325+ status_not_in: Returned assets should have a status that does not belong to that list, if given.
326+ Possible choices: `TODO`, `ONGOING`, `LABELED`, `TO_REVIEW` or `REVIEWED`.
327+ Only applicable if the project is in the WorkflowV1 (legacy).
316328 step_name_in: Returned assets are in the step whose name belong to that list, if given.
317329 Only applicable if the project is in WorkflowV2.
330+ step_name_not_in: Returned assets are in the step whose name does not belong to that list, if given.
331+ Only applicable if the project is in WorkflowV2.
318332 step_status_in: Returned assets have the status in their step that belongs to that list, if given.
319333 Only applicable if the project is in WorkflowV2.
334+ step_status_not_in: Returned assets have the status in their step that does not belong to that list, if given.
335+ Possible choices: `TO_DO`, `DOING`, `PARTIALLY_DONE`, `REDO`, `DONE`, `SKIPPED`.
336+ Only applicable if the project is in WorkflowV2.
320337
321338 !!! info "Dates format"
322339 Date strings should have format: "YYYY-MM-DD"
@@ -432,26 +449,38 @@ def assets(
432449 )
433450
434451 step_id_in = None
452+ step_id_not_in = None
435453 if (
436454 step_name_in is not None
455+ or step_name_not_in is not None
437456 or step_status_in is not None
457+ or step_status_not_in is not None
438458 or status_in is not None
459+ or status_not_in is not None
439460 or skipped is not None
440461 ):
441462 check_asset_workflow_arguments (
442463 project_workflow_version = project_workflow_version ,
443464 asset_workflow_filters = {
444465 "skipped" : skipped ,
445466 "status_in" : status_in ,
467+ "status_not_in" : status_not_in ,
446468 "step_name_in" : step_name_in ,
469+ "step_name_not_in" : step_name_not_in ,
447470 "step_status_in" : step_status_in ,
471+ "step_status_not_in" : step_status_not_in ,
448472 },
449473 )
450474 if project_workflow_version == "V2" and step_name_in is not None :
451475 step_id_in = extract_step_ids_from_project_steps (
452476 project_steps = project_steps ,
453477 step_name_in = step_name_in ,
454478 )
479+ if project_workflow_version == "V2" and step_name_not_in is not None :
480+ step_id_not_in = extract_step_ids_from_project_steps (
481+ project_steps = project_steps ,
482+ step_name_in = step_name_not_in ,
483+ )
455484
456485 asset_use_cases = AssetUseCases (self .kili_api_gateway )
457486 filters = AssetFilters (
@@ -497,7 +526,10 @@ def assets(
497526 issue_status = issue_status ,
498527 issue_type = issue_type ,
499528 step_id_in = step_id_in ,
529+ step_id_not_in = step_id_not_in ,
500530 step_status_in = step_status_in ,
531+ step_status_not_in = step_status_not_in ,
532+ status_not_in = status_not_in ,
501533 )
502534 assets_gen = asset_use_cases .list_assets (
503535 filters ,
@@ -570,7 +602,10 @@ def count_assets(
570602 external_id_strictly_in : Optional [List [str ]] = None ,
571603 external_id_in : Optional [List [str ]] = None ,
572604 step_name_in : Optional [List [str ]] = None ,
605+ step_name_not_in : Optional [List [str ]] = None ,
573606 step_status_in : Optional [List [StatusInStep ]] = None ,
607+ step_status_not_in : Optional [List [StatusInStep ]] = None ,
608+ status_not_in : Optional [List [AssetStatus ]] = None ,
574609 ) -> int :
575610 # pylint: disable=line-too-long
576611 """Count and return the number of assets with the given constraints.
@@ -629,9 +664,17 @@ def count_assets(
629664 For example, with `external_id_in=['abc']`, any asset with an external id containing `'abc'` will be returned.
630665 step_name_in: Returned assets are in a step whose name belong to that list, if given.
631666 Only applicable if the project is in WorkflowV2.
667+ step_name_not_in: Returned assets are in a step whose name does not belong to that list, if given.
668+ Only applicable if the project is in WorkflowV2.
632669 step_status_in: Returned assets have the status of their step that belongs to that list, if given.
633670 Possible choices: `TO_DO`, `DOING`, `PARTIALLY_DONE`, `REDO`, `DONE`, `SKIPPED`.
634671 Only applicable if the project is in WorkflowV2.
672+ step_status_not_in: Returned assets have the status of their step that does not belong to that list, if given.
673+ Possible choices: `TO_DO`, `DOING`, `PARTIALLY_DONE`, `REDO`, `DONE`, `SKIPPED`.
674+ Only applicable if the project is in WorkflowV2.
675+ status_not_in: Returned assets should have a status that does not belong to that list, if given.
676+ Possible choices: `TODO`, `ONGOING`, `LABELED`, `TO_REVIEW` or `REVIEWED`.
677+ Only applicable if the project is in WorkflowV1 (legacy).
635678
636679 !!! info "Dates format"
637680 Date strings should have format: "YYYY-MM-DD"
@@ -695,7 +738,15 @@ def count_assets(
695738 )
696739
697740 step_id_in = None
698- if status_in is not None or step_name_in is not None or step_status_in is not None :
741+ step_id_not_in = None
742+ if (
743+ status_in is not None
744+ or status_not_in is not None
745+ or step_name_in is not None
746+ or step_name_not_in is not None
747+ or step_status_in is not None
748+ or step_status_not_in is not None
749+ ):
699750 project_use_cases = ProjectUseCases (self .kili_api_gateway )
700751 (
701752 project_steps ,
@@ -706,8 +757,11 @@ def count_assets(
706757 asset_workflow_filters = {
707758 "skipped" : skipped ,
708759 "step_name_in" : step_name_in ,
760+ "step_name_not_in" : step_name_not_in ,
709761 "step_status_in" : step_status_in ,
762+ "step_status_not_in" : step_status_not_in ,
710763 "status_in" : status_in ,
764+ "status_not_in" : status_not_in ,
711765 },
712766 )
713767
@@ -716,6 +770,11 @@ def count_assets(
716770 project_steps = project_steps ,
717771 step_name_in = step_name_in ,
718772 )
773+ if project_workflow_version == "V2" and step_name_not_in is not None :
774+ step_id_not_in = extract_step_ids_from_project_steps (
775+ project_steps = project_steps ,
776+ step_name_in = step_name_not_in ,
777+ )
719778
720779 filters = AssetFilters (
721780 project_id = ProjectId (project_id ),
@@ -760,7 +819,10 @@ def count_assets(
760819 issue_status = issue_status ,
761820 issue_type = issue_type ,
762821 step_id_in = step_id_in ,
822+ step_id_not_in = step_id_not_in ,
763823 step_status_in = step_status_in ,
824+ step_status_not_in = step_status_not_in ,
825+ status_not_in = status_not_in ,
764826 )
765827 asset_use_cases = AssetUseCases (self .kili_api_gateway )
766828 return asset_use_cases .count_assets (filters )
0 commit comments