From 8e5d04d5cafeed5a377d2830178e9441799d9d17 Mon Sep 17 00:00:00 2001 From: Gilles Peskine Date: Fri, 21 Aug 2026 13:48:52 +0200 Subject: [PATCH] audit-validity-dates: stop using generate_test_code.FileWrapper Signed-off-by: Gilles Peskine --- scripts/audit-validity-dates.py | 34 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/scripts/audit-validity-dates.py b/scripts/audit-validity-dates.py index d59ee9ac3..123f7bdc0 100755 --- a/scripts/audit-validity-dates.py +++ b/scripts/audit-validity-dates.py @@ -26,8 +26,6 @@ from typing import Callable, Dict, Iterator, List, Optional, Tuple import cryptography from cryptography import x509 -from generate_test_code import FileWrapper - from mbedtls_framework import build_tree from mbedtls_framework import logging_util from mbedtls_framework import typing_util @@ -345,20 +343,21 @@ def parse_suite_data(filename: str) -> Iterator[Tuple[int, List[str]]]: :param data_f: file object of the data file. :return: Generator that yields test function argument list. """ - for line in data_f: - line = line.strip() - # Skip comments - if line.startswith('#'): - continue + with open(filename) as data_f: + for line_no, line in enumerate(data_f): + line = line.strip() + # Skip comments + if line.startswith('#'): + continue - # Check parameters line - match = re.search(r'\A\w+(.*:)?\"', line) - if match: - # Read test vectors - parts = re.split(r'(?[0-9a-fA-F]+)"', test_arg) if not match: @@ -391,7 +389,7 @@ class SuiteDataAuditor(Auditor): if audit_data is None: continue audit_data.locations.append("{}:{}:#{}".format(filename, - data_f.line_no, + line_no, idx + 1)) audit_data_list.append(audit_data)