Modernize usage of re.sub deprecated in Python 3.13

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
This commit is contained in:
Gilles Peskine
2026-02-18 20:10:27 +01:00
parent f41a9f6056
commit 316ec76508
3 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -143,7 +143,7 @@ class TextChangelogFormat(ChangelogFormat):
@classmethod
def version_title_text(cls, version_title):
return re.sub(r'\n.*', version_title, re.DOTALL)
return re.sub(r'\n.*', version_title, flags=re.DOTALL)
_category_title_re = re.compile(r'(^\w.*)\n+', re.MULTILINE)
@classmethod
+1 -1
View File
@@ -762,7 +762,7 @@ def escaped_split(inp_str, split_char):
raise ValueError('Expected split character. Found string!')
out = re.sub(r'(\\.)|' + split_char,
lambda m: m.group(1) or '\n', inp_str,
len(inp_str)).split('\n')
count=len(inp_str)).split('\n')
out = [x for x in out if x]
return out
@@ -359,7 +359,7 @@ class Base:
"""Preprocessor symbol used as a guard against multiple inclusion."""
# Heuristic to strip irrelevant leading directories
filename = re.sub(r'.*include[\\/]', r'', filename)
return re.sub(r'[^0-9A-Za-z]', r'_', filename, re.A).upper()
return re.sub(r'[^0-9A-Za-z]', r'_', filename, flags=re.A).upper()
def write_h_file(self, filename: str) -> None:
"""Output a header file with function wrapper declarations and macro definitions."""