Skip to content

feat: Add support to module 'sre_compile' is deprecated #614

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions build_support/cpplint.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@
import math # for log
import os
import re
import sre_compile
import string
import sys
import sysconfig
Expand Down Expand Up @@ -800,7 +799,7 @@ def Match(pattern, s):
# performance reasons; factoring it out into a separate function turns out
# to be noticeably expensive.
if pattern not in _regexp_compile_cache:
_regexp_compile_cache[pattern] = sre_compile.compile(pattern)
_regexp_compile_cache[pattern] = re._compiler.compile(pattern)
return _regexp_compile_cache[pattern].match(s)


Expand All @@ -818,14 +817,14 @@ def ReplaceAll(pattern, rep, s):
string with replacements made (or original string if no replacements)
"""
if pattern not in _regexp_compile_cache:
_regexp_compile_cache[pattern] = sre_compile.compile(pattern)
_regexp_compile_cache[pattern] = re._compiler.compile(pattern)
return _regexp_compile_cache[pattern].sub(rep, s)


def Search(pattern, s):
"""Searches the string for the pattern, caching the compiled regexp."""
if pattern not in _regexp_compile_cache:
_regexp_compile_cache[pattern] = sre_compile.compile(pattern)
_regexp_compile_cache[pattern] = re._compiler.compile(pattern)
return _regexp_compile_cache[pattern].search(s)


Expand Down