From: Kefu Chai Date: Fri, 24 Apr 2026 13:34:43 +0000 (+0800) Subject: doc/scripts: use raw string for regex in gen_state_diagram.py X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=2178a1aa771e07457e542da3de29e11de061a7e6;p=ceph.git doc/scripts: use raw string for regex in gen_state_diagram.py Python 3.12 emits SyntaxWarning for invalid escape sequences in ordinary string literals. The re.search() call on line 162 was the only pattern in the file passed as a non-raw string, causing: doc/scripts/gen_state_diagram.py:162: SyntaxWarning: invalid escape sequence '\s' i = re.search("return\s+transit<\s*(\w*)\s*>()", line) Add the r"" prefix to match the other re.search / re.finditer / re.sub call sites in the same file. No behavior change; \s was already being interpreted as a regex whitespace class because Python leaves unknown escapes untouched, but this will become a SyntaxError in a future Python release. Signed-off-by: Kefu Chai --- diff --git a/doc/scripts/gen_state_diagram.py b/doc/scripts/gen_state_diagram.py index 50ae23dae882..a8b766cf7126 100755 --- a/doc/scripts/gen_state_diagram.py +++ b/doc/scripts/gen_state_diagram.py @@ -159,7 +159,7 @@ class StateMachineRenderer(object): if not self.context: raise Exception("no context at line: " + line) self.edges[i.group(1)].append((self.context[-1][0], i.group(2))) - i = re.search("return\s+transit<\s*(\w*)\s*>()", line) + i = re.search(r"return\s+transit<\s*(\w*)\s*>()", line) if i is not None: if not self.context: raise Exception("no context at line: " + line)