fixeria submitted this change.
scripts: fix deprecation warnings
scripts/verify_value_string_arrays_are_terminated.py:22: SyntaxWarning:
"\s" is an invalid escape sequence. Such sequences will not work in the future.
Did you mean "\\s"? A raw string is also an option.
scripts/verify_value_string_arrays_are_terminated.py:22: SyntaxWarning:
"\s" is an invalid escape sequence. Such sequences will not work in the future.
Did you mean "\\s"? A raw string is also an option.
scripts/verify_value_string_arrays_are_terminated.py:23: SyntaxWarning:
"\s" is an invalid escape sequence. Such sequences will not work in the future.
Did you mean "\\s"? A raw string is also an option.
scripts/verify_value_string_arrays_are_terminated.py:23: SyntaxWarning:
"\s" is an invalid escape sequence. Such sequences will not work in the future.
Did you mean "\\s"? A raw string is also an option.
scripts/verify_value_string_arrays_are_terminated.py:30: DeprecationWarning:
codecs.open() is deprecated. Use open() instead.
Change-Id: Ie78b84dd556266f96780a4232f95b58e0e3eabc0
---
M scripts/verify_value_string_arrays_are_terminated.py
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/scripts/verify_value_string_arrays_are_terminated.py b/scripts/verify_value_string_arrays_are_terminated.py
index abeff4d..0a6816b 100755
--- a/scripts/verify_value_string_arrays_are_terminated.py
+++ b/scripts/verify_value_string_arrays_are_terminated.py
@@ -11,7 +11,6 @@
import re
import sys
-import codecs
import os.path
value_string_array_re = re.compile(
@@ -19,15 +18,15 @@
re.MULTILINE | re.DOTALL)
members = r'(\.(value|str)\s*=\s*)?'
-terminator_re = re.compile('{\s*}|{\s*0\s*}|{\s*' + members + '(0|NULL)\s*,'
- '\s*' + members + '(0|NULL)\s*}')
+terminator_re = re.compile(r'{\s*}|{\s*0\s*}|{\s*' + members + r'(0|NULL)\s*,'
+ r'\s*' + members + r'(0|NULL)\s*}')
errors_found = 0
def check_file(f):
global errors_found
if not (f.endswith('.h') or f.endswith('.c') or f.endswith('.cpp')):
return
- arrays = value_string_array_re.findall(codecs.open(f, "r", "utf-8", errors='ignore').read())
+ arrays = value_string_array_re.findall(open(f, "r", encoding='utf-8', errors='ignore').read())
for array_def, name in arrays:
if not terminator_re.search(array_def):
print('ERROR: file contains unterminated value_string %r: %r'
To view, visit change 42615. To unsubscribe, or for help writing mail filters, visit settings.