@@ -16,26 +16,26 @@ class Config:
1616
1717 from_attributes = True
1818
19- # @staticmethod
20- # def compute_totals(validation_report) -> tuple[int, int, int, int, int, int]:
21- # """Compute the total number of errors, info, and warnings from a validation report,
22- # and count the number of distinct codes for each."""
23- # total_info, total_warning, total_error = 0, 0, 0
24- # info_codes, warning_codes, error_codes = set(), set(), set()
25- # for notice in validation_report.notices:
26- # match notice.severity:
27- # case "INFO":
28- # total_info += notice.total_notices
29- # info_codes.add(notice.notice_code)
30- # case "WARNING":
31- # total_warning += notice.total_notices
32- # warning_codes.add(notice.notice_code)
33- # case "ERROR":
34- # total_error += notice.total_notices
35- # error_codes.add(notice.notice_code)
36- # case _:
37- # ValidationReportImpl._get_logger().warning(f"Unknown severity: {notice.severity}")
38- # return total_error, total_info, total_warning, len(error_codes), len(info_codes), len(warning_codes)
19+ @staticmethod
20+ def compute_totals (validation_report ) -> tuple [int , int , int , int , int , int ]:
21+ """Compute the total number of errors, info, and warnings from a validation report,
22+ and count the number of distinct codes for each."""
23+ total_info , total_warning , total_error = 0 , 0 , 0
24+ info_codes , warning_codes , error_codes = set (), set (), set ()
25+ for notice in validation_report .notices :
26+ match notice .severity :
27+ case "INFO" :
28+ total_info += notice .total_notices
29+ info_codes .add (notice .notice_code )
30+ case "WARNING" :
31+ total_warning += notice .total_notices
32+ warning_codes .add (notice .notice_code )
33+ case "ERROR" :
34+ total_error += notice .total_notices
35+ error_codes .add (notice .notice_code )
36+ case _:
37+ ValidationReportImpl ._get_logger ().warning (f"Unknown severity: { notice .severity } " )
38+ return total_error , total_info , total_warning , len (error_codes ), len (info_codes ), len (warning_codes )
3939
4040 @classmethod
4141 def _get_logger (cls ):
0 commit comments