Skip to content

Commit 4ac9019

Browse files
committed
Remove usage of deprecated Python import sre_compile
1 parent 4876a0e commit 4ac9019

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

scripts/cpplint.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
import math # for log
3636
import os
3737
import re
38-
import sre_compile
3938
import string
4039
import sys
4140
import sysconfig
@@ -1028,7 +1027,7 @@ def Match(pattern, s):
10281027
# performance reasons; factoring it out into a separate function turns out
10291028
# to be noticeably expensive.
10301029
if pattern not in _regexp_compile_cache:
1031-
_regexp_compile_cache[pattern] = sre_compile.compile(pattern)
1030+
_regexp_compile_cache[pattern] = re.compile(pattern)
10321031
return _regexp_compile_cache[pattern].match(s)
10331032

10341033

@@ -1046,14 +1045,14 @@ def ReplaceAll(pattern, rep, s):
10461045
string with replacements made (or original string if no replacements)
10471046
"""
10481047
if pattern not in _regexp_compile_cache:
1049-
_regexp_compile_cache[pattern] = sre_compile.compile(pattern)
1048+
_regexp_compile_cache[pattern] = re.compile(pattern)
10501049
return _regexp_compile_cache[pattern].sub(rep, s)
10511050

10521051

10531052
def Search(pattern, s):
10541053
"""Searches the string for the pattern, caching the compiled regexp."""
10551054
if pattern not in _regexp_compile_cache:
1056-
_regexp_compile_cache[pattern] = sre_compile.compile(pattern)
1055+
_regexp_compile_cache[pattern] = re.compile(pattern)
10571056
return _regexp_compile_cache[pattern].search(s)
10581057

10591058

0 commit comments

Comments
 (0)