Skip to content

Commit

Permalink
fixup!: naming
Browse files Browse the repository at this point in the history
  • Loading branch information
himself65 committed Oct 14, 2023
1 parent 7a8179d commit e680bc1
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions tools/cpplint.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,10 @@
# Refs: https://github.com/python/cpython/issues/105456
# Refs: https://github.com/python/cpython/issues/91308
try:
recompile = re._compiler.compile
srecompile = re._compiler.compile
except AttributeError:
import sre_compile
recompile = sre_compile.compile
srecompile = sre_compile.compile

try:
# -- pylint: disable=used-before-assignment
Expand Down Expand Up @@ -1086,7 +1086,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] = recompile(pattern)
_regexp_compile_cache[pattern] = srecompile(pattern)
return _regexp_compile_cache[pattern].match(s)


Expand All @@ -1104,14 +1104,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] = recompile(pattern)
_regexp_compile_cache[pattern] = srecompile(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] = recompile(pattern)
_regexp_compile_cache[pattern] = srecompile(pattern)
return _regexp_compile_cache[pattern].search(s)


Expand Down

0 comments on commit e680bc1

Please sign in to comment.