@@ -80,7 +80,7 @@ def get_attribute_value(iteration_rule: IterationRule, person_data: list[dict[st
8080 return attribute_value
8181
8282 @staticmethod
83- def evaluate_rule (iteration_rule : IterationRule , attribute_value : Any ) -> bool : # noqa: PLR0911, ANN401
83+ def evaluate_rule (iteration_rule : IterationRule , attribute_value : Any ) -> bool : # noqa: PLR0911, ANN401, PLR0912, C901, PLR0915
8484 match iteration_rule .operator :
8585 case RuleOperator .equals :
8686 return attribute_value == iteration_rule .comparator
@@ -144,62 +144,62 @@ def evaluate_rule(iteration_rule: IterationRule, attribute_value: Any) -> bool:
144144 return attribute_value is False
145145 case RuleOperator .day_lte :
146146 attribute_date = datetime .strptime (str (attribute_value ), "%Y%m%d" ) if attribute_value else None # noqa: DTZ007
147- today_date = datetime .today ().replace (hour = 0 , minute = 0 , second = 0 , microsecond = 0 )
147+ today_date = datetime .today ().replace (hour = 0 , minute = 0 , second = 0 , microsecond = 0 ) # noqa: DTZ002
148148 cutoff = today_date + relativedelta (days = int (iteration_rule .comparator ))
149149 return (attribute_date <= cutoff ) if attribute_date else False
150150 case RuleOperator .day_lt :
151151 attribute_date = datetime .strptime (str (attribute_value ), "%Y%m%d" ) if attribute_value else None # noqa: DTZ007
152- today_date = datetime .today ().replace (hour = 0 , minute = 0 , second = 0 , microsecond = 0 )
152+ today_date = datetime .today ().replace (hour = 0 , minute = 0 , second = 0 , microsecond = 0 ) # noqa: DTZ002
153153 cutoff = today_date + relativedelta (days = int (iteration_rule .comparator ))
154154 return (attribute_date < cutoff ) if attribute_date else False
155155 case RuleOperator .day_gte :
156156 attribute_date = datetime .strptime (str (attribute_value ), "%Y%m%d" ) if attribute_value else None # noqa: DTZ007
157- today_date = datetime .today ().replace (hour = 0 , minute = 0 , second = 0 , microsecond = 0 )
157+ today_date = datetime .today ().replace (hour = 0 , minute = 0 , second = 0 , microsecond = 0 ) # noqa: DTZ002
158158 cutoff = today_date + relativedelta (days = int (iteration_rule .comparator ))
159159 return (attribute_date >= cutoff ) if attribute_date else False
160160 case RuleOperator .day_gt :
161161 attribute_date = datetime .strptime (str (attribute_value ), "%Y%m%d" ) if attribute_value else None # noqa: DTZ007
162- today_date = datetime .today ().replace (hour = 0 , minute = 0 , second = 0 , microsecond = 0 )
162+ today_date = datetime .today ().replace (hour = 0 , minute = 0 , second = 0 , microsecond = 0 ) # noqa: DTZ002
163163 cutoff = today_date + relativedelta (days = int (iteration_rule .comparator ))
164164 return (attribute_date > cutoff ) if attribute_date else False
165165 case RuleOperator .week_lte :
166166 attribute_date = datetime .strptime (str (attribute_value ), "%Y%m%d" ) if attribute_value else None # noqa: DTZ007
167- today_date = datetime .today ().replace (hour = 0 , minute = 0 , second = 0 , microsecond = 0 )
167+ today_date = datetime .today ().replace (hour = 0 , minute = 0 , second = 0 , microsecond = 0 ) # noqa: DTZ002
168168 cutoff = today_date + relativedelta (weeks = int (iteration_rule .comparator ))
169169 return (attribute_date <= cutoff ) if attribute_date else False
170170 case RuleOperator .week_lt :
171171 attribute_date = datetime .strptime (str (attribute_value ), "%Y%m%d" ) if attribute_value else None # noqa: DTZ007
172- today_date = datetime .today ().replace (hour = 0 , minute = 0 , second = 0 , microsecond = 0 )
172+ today_date = datetime .today ().replace (hour = 0 , minute = 0 , second = 0 , microsecond = 0 ) # noqa: DTZ002
173173 cutoff = today_date + relativedelta (weeks = int (iteration_rule .comparator ))
174174 return (attribute_date < cutoff ) if attribute_date else False
175175 case RuleOperator .week_gte :
176176 attribute_date = datetime .strptime (str (attribute_value ), "%Y%m%d" ) if attribute_value else None # noqa: DTZ007
177- today_date = datetime .today ().replace (hour = 0 , minute = 0 , second = 0 , microsecond = 0 )
177+ today_date = datetime .today ().replace (hour = 0 , minute = 0 , second = 0 , microsecond = 0 ) # noqa: DTZ002
178178 cutoff = today_date + relativedelta (weeks = int (iteration_rule .comparator ))
179179 return (attribute_date >= cutoff ) if attribute_date else False
180180 case RuleOperator .week_gt :
181181 attribute_date = datetime .strptime (str (attribute_value ), "%Y%m%d" ) if attribute_value else None # noqa: DTZ007
182- today_date = datetime .today ().replace (hour = 0 , minute = 0 , second = 0 , microsecond = 0 )
182+ today_date = datetime .today ().replace (hour = 0 , minute = 0 , second = 0 , microsecond = 0 ) # noqa: DTZ002
183183 cutoff = today_date + relativedelta (weeks = int (iteration_rule .comparator ))
184184 return (attribute_date > cutoff ) if attribute_date else False
185185 case RuleOperator .year_lte :
186186 attribute_date = datetime .strptime (str (attribute_value ), "%Y%m%d" ) if attribute_value else None # noqa: DTZ007
187- today_date = datetime .today ().replace (hour = 0 , minute = 0 , second = 0 , microsecond = 0 )
187+ today_date = datetime .today ().replace (hour = 0 , minute = 0 , second = 0 , microsecond = 0 ) # noqa: DTZ002
188188 cutoff = today_date + relativedelta (years = int (iteration_rule .comparator ))
189189 return (attribute_date <= cutoff ) if attribute_date else False
190190 case RuleOperator .year_lt :
191191 attribute_date = datetime .strptime (str (attribute_value ), "%Y%m%d" ) if attribute_value else None # noqa: DTZ007
192- today_date = datetime .today ().replace (hour = 0 , minute = 0 , second = 0 , microsecond = 0 )
192+ today_date = datetime .today ().replace (hour = 0 , minute = 0 , second = 0 , microsecond = 0 ) # noqa: DTZ002
193193 cutoff = today_date + relativedelta (years = int (iteration_rule .comparator ))
194194 return (attribute_date < cutoff ) if attribute_date else False
195195 case RuleOperator .year_gte :
196196 attribute_date = datetime .strptime (str (attribute_value ), "%Y%m%d" ) if attribute_value else None # noqa: DTZ007
197- today_date = datetime .today ().replace (hour = 0 , minute = 0 , second = 0 , microsecond = 0 )
197+ today_date = datetime .today ().replace (hour = 0 , minute = 0 , second = 0 , microsecond = 0 ) # noqa: DTZ002
198198 cutoff = today_date + relativedelta (years = int (iteration_rule .comparator ))
199199 return (attribute_date >= cutoff ) if attribute_date else False
200200 case RuleOperator .year_gt :
201201 attribute_date = datetime .strptime (str (attribute_value ), "%Y%m%d" ) if attribute_value else None # noqa: DTZ007
202- today = datetime .today ().replace (hour = 0 , minute = 0 , second = 0 , microsecond = 0 )
202+ today = datetime .today ().replace (hour = 0 , minute = 0 , second = 0 , microsecond = 0 ) # noqa: DTZ002
203203 cutoff = today + relativedelta (years = int (iteration_rule .comparator ))
204204 return (attribute_date > cutoff ) if attribute_date else False
205205 case _:
0 commit comments