4646 import pandas as pd
4747
4848
49+ def _warn_deprecated_gt_lt_args (
50+ consensus_mark_gt : Optional [float ],
51+ consensus_mark_lt : Optional [float ],
52+ honeypot_mark_gt : Optional [float ],
53+ honeypot_mark_lt : Optional [float ],
54+ label_consensus_mark_gt : Optional [float ],
55+ label_consensus_mark_lt : Optional [float ],
56+ label_created_at_gt : Optional [str ],
57+ label_created_at_lt : Optional [str ],
58+ label_honeypot_mark_gt : Optional [float ],
59+ label_honeypot_mark_lt : Optional [float ],
60+ ) -> None :
61+ """Warn about deprecated _gt and _lt arguments."""
62+ for arg_name , arg_value in zip (
63+ (
64+ "consensus_mark_gt" ,
65+ "consensus_mark_lt" ,
66+ "honeypot_mark_gt" ,
67+ "honeypot_mark_lt" ,
68+ "label_consensus_mark_gt" ,
69+ "label_consensus_mark_lt" ,
70+ "label_created_at_gt" ,
71+ "label_created_at_lt" ,
72+ "label_honeypot_mark_gt" ,
73+ "label_honeypot_mark_lt" ,
74+ ),
75+ (
76+ consensus_mark_gt ,
77+ consensus_mark_lt ,
78+ honeypot_mark_gt ,
79+ honeypot_mark_lt ,
80+ label_consensus_mark_gt ,
81+ label_consensus_mark_lt ,
82+ label_created_at_gt ,
83+ label_created_at_lt ,
84+ label_honeypot_mark_gt ,
85+ label_honeypot_mark_lt ,
86+ ),
87+ ):
88+ if arg_value :
89+ warnings .warn (
90+ f"'{ arg_name } ' is deprecated, please use"
91+ f" '{ arg_name .replace ('_gt' , '_gte' ).replace ('_lt' , '_lte' )} ' instead." ,
92+ DeprecationWarning ,
93+ stacklevel = 2 ,
94+ )
95+
96+
4997@for_all_methods (log_call , exclude = ["__init__" ])
5098class AssetClientMethods (BaseClientMethods ):
5199 """Methods attached to the Kili client, to run actions on assets."""
@@ -394,39 +442,18 @@ def assets(
394442 stacklevel = 1 ,
395443 )
396444
397- for arg_name , arg_value in zip (
398- (
399- "consensus_mark_gt" ,
400- "consensus_mark_lt" ,
401- "honeypot_mark_gt" ,
402- "honeypot_mark_lt" ,
403- "label_consensus_mark_gt" ,
404- "label_consensus_mark_lt" ,
405- "label_created_at_gt" ,
406- "label_created_at_lt" ,
407- "label_honeypot_mark_gt" ,
408- "label_honeypot_mark_lt" ,
409- ),
410- (
411- consensus_mark_gt ,
412- consensus_mark_lt ,
413- honeypot_mark_gt ,
414- honeypot_mark_lt ,
415- label_consensus_mark_gt ,
416- label_consensus_mark_lt ,
417- label_created_at_gt ,
418- label_created_at_lt ,
419- label_honeypot_mark_gt ,
420- label_honeypot_mark_lt ,
421- ),
422- ):
423- if arg_value :
424- warnings .warn (
425- f"'{ arg_name } ' is deprecated, please use"
426- f" '{ arg_name .replace ('_gt' , '_gte' ).replace ('_lt' , '_lte' )} ' instead." ,
427- DeprecationWarning ,
428- stacklevel = 1 ,
429- )
445+ _warn_deprecated_gt_lt_args (
446+ consensus_mark_gt = consensus_mark_gt ,
447+ consensus_mark_lt = consensus_mark_lt ,
448+ honeypot_mark_gt = honeypot_mark_gt ,
449+ honeypot_mark_lt = honeypot_mark_lt ,
450+ label_consensus_mark_gt = label_consensus_mark_gt ,
451+ label_consensus_mark_lt = label_consensus_mark_lt ,
452+ label_created_at_gt = label_created_at_gt ,
453+ label_created_at_lt = label_created_at_lt ,
454+ label_honeypot_mark_gt = label_honeypot_mark_gt ,
455+ label_honeypot_mark_lt = label_honeypot_mark_lt ,
456+ )
430457
431458 disable_tqdm = disable_tqdm_if_as_generator (as_generator , disable_tqdm )
432459
@@ -450,15 +477,15 @@ def assets(
450477
451478 step_id_in = None
452479 step_id_not_in = None
453- if (
454- step_name_in is not None
455- or step_name_not_in is not None
456- or step_status_in is not None
480+ has_step_filters = step_name_in is not None or step_name_not_in is not None
481+ has_status_filters = (
482+ step_status_in is not None
457483 or step_status_not_in is not None
458484 or status_in is not None
459485 or status_not_in is not None
460486 or skipped is not None
461- ):
487+ )
488+ if has_step_filters or has_status_filters :
462489 check_asset_workflow_arguments (
463490 project_workflow_version = project_workflow_version ,
464491 asset_workflow_filters = {
@@ -703,50 +730,29 @@ def count_assets(
703730 stacklevel = 1 ,
704731 )
705732
706- for arg_name , arg_value in zip (
707- (
708- "consensus_mark_gt" ,
709- "consensus_mark_lt" ,
710- "honeypot_mark_gt" ,
711- "honeypot_mark_lt" ,
712- "label_consensus_mark_gt" ,
713- "label_consensus_mark_lt" ,
714- "label_created_at_gt" ,
715- "label_created_at_lt" ,
716- "label_honeypot_mark_gt" ,
717- "label_honeypot_mark_lt" ,
718- ),
719- (
720- consensus_mark_gt ,
721- consensus_mark_lt ,
722- honeypot_mark_gt ,
723- honeypot_mark_lt ,
724- label_consensus_mark_gt ,
725- label_consensus_mark_lt ,
726- label_created_at_gt ,
727- label_created_at_lt ,
728- label_honeypot_mark_gt ,
729- label_honeypot_mark_lt ,
730- ),
731- ):
732- if arg_value :
733- warnings .warn (
734- f"'{ arg_name } ' is deprecated, please use"
735- f" '{ arg_name .replace ('_gt' , '_gte' ).replace ('_lt' , '_lte' )} ' instead." ,
736- DeprecationWarning ,
737- stacklevel = 1 ,
738- )
733+ _warn_deprecated_gt_lt_args (
734+ consensus_mark_gt = consensus_mark_gt ,
735+ consensus_mark_lt = consensus_mark_lt ,
736+ honeypot_mark_gt = honeypot_mark_gt ,
737+ honeypot_mark_lt = honeypot_mark_lt ,
738+ label_consensus_mark_gt = label_consensus_mark_gt ,
739+ label_consensus_mark_lt = label_consensus_mark_lt ,
740+ label_created_at_gt = label_created_at_gt ,
741+ label_created_at_lt = label_created_at_lt ,
742+ label_honeypot_mark_gt = label_honeypot_mark_gt ,
743+ label_honeypot_mark_lt = label_honeypot_mark_lt ,
744+ )
739745
740746 step_id_in = None
741747 step_id_not_in = None
742- if (
748+ has_step_filters = step_name_in is not None or step_name_not_in is not None
749+ has_status_filters = (
743750 status_in is not None
744751 or status_not_in is not None
745- or step_name_in is not None
746- or step_name_not_in is not None
747752 or step_status_in is not None
748753 or step_status_not_in is not None
749- ):
754+ )
755+ if has_step_filters or has_status_filters :
750756 project_use_cases = ProjectUseCases (self .kili_api_gateway )
751757 (
752758 project_steps ,
0 commit comments