From d972b831c3ca2be979c4009a1fb66baca9dc0b77 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Tue, 27 Feb 2024 20:37:01 +0000 Subject: [PATCH] cpplint: fix deprecation warnings with docstrings Fix warnings with Python 3.8 like: .../depot_tools/cpplint.py:3006: DeprecationWarning: invalid escape sequence \% """Logs an error if we see certain non-ANSI constructs ignored by gcc-2. .../depot_tools/cpplint.py:4842: DeprecationWarning: invalid escape sequence \( """Retrieves all the text between matching open and close parentheses. Change-Id: I99987e766cda98e2b8d8476f7900b9f99d58761e Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5328187 Auto-Submit: Mike Frysinger Reviewed-by: Joanna Wang Commit-Queue: Joanna Wang --- cpplint.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cpplint.py b/cpplint.py index 32483eae3..63ba6694e 100755 --- a/cpplint.py +++ b/cpplint.py @@ -3003,7 +3003,7 @@ class NestingState(object): def CheckForNonStandardConstructs(filename, clean_lines, linenum, nesting_state, error): - """Logs an error if we see certain non-ANSI constructs ignored by gcc-2. + r"""Logs an error if we see certain non-ANSI constructs ignored by gcc-2. Complain about several constructs which gcc-2 accepts, but which are not standard C++. Warning about these in lint is one way to ease the @@ -4839,7 +4839,7 @@ def CheckIncludeLine(filename, clean_lines, linenum, include_state, error): def _GetTextInside(text, start_pattern): - """Retrieves all the text between matching open and close parentheses. + r"""Retrieves all the text between matching open and close parentheses. Given a string of lines and a regular expression string, retrieve all the text following the expression and between opening punctuation symbols like