Skip to content

Commit 627c97e

Browse files
chenrui333google-java-format Team
authored andcommitted
chore: fix SyntaxWarning: invalid escape sequence + for py3.12
``` /opt/homebrew/Cellar/google-java-format/1.19.0/bin/google-java-format-diff:78: SyntaxWarning: invalid escape sequence '\+' match = re.search('^\+\+\+\ (.*?/){%s}(\S*)' % args.p, line) /opt/homebrew/Cellar/google-java-format/1.19.0/bin/google-java-format-diff:91: SyntaxWarning: invalid escape sequence '\+' match = re.search('^@@.*\+(\d+)(,(\d+))?', line) ``` relates to Homebrew/homebrew-core#157669 cc @cushon Fixes #1017 COPYBARA_INTEGRATE_REVIEW=#1017 from chenrui333:py3.12 36d80d1 PiperOrigin-RevId: 592246854
1 parent 0e7cc6f commit 627c97e

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

scripts/google-java-format-diff.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
#!/usr/bin/env python3
22
#
3-
#===- google-java-format-diff.py - google-java-format Diff Reformatter -----===#
3+
# ===- google-java-format-diff.py - google-java-format Diff Reformatter -----===#
44
#
55
# The LLVM Compiler Infrastructure
66
#
77
# This file is distributed under the University of Illinois Open Source
88
# License. See LICENSE.TXT for details.
99
#
10-
#===------------------------------------------------------------------------===#
10+
# ===------------------------------------------------------------------------===#
1111

1212
"""
1313
google-java-format Diff Reformatter
@@ -75,7 +75,7 @@ def main():
7575
lines_by_file = {}
7676

7777
for line in sys.stdin:
78-
match = re.search('^\+\+\+\ (.*?/){%s}(\S*)' % args.p, line)
78+
match = re.search(r'^\+\+\+\ (.*?/){%s}(\S*)' % args.p, line)
7979
if match:
8080
filename = match.group(2)
8181
if filename == None:
@@ -88,7 +88,7 @@ def main():
8888
if not re.match('^%s$' % args.iregex, filename, re.IGNORECASE):
8989
continue
9090

91-
match = re.search('^@@.*\+(\d+)(,(\d+))?', line)
91+
match = re.search(r'^@@.*\+(\d+)(,(\d+))?', line)
9292
if match:
9393
start_line = int(match.group(1))
9494
line_count = 1

0 commit comments

Comments
 (0)