Skip to content

Commit 56bc232

Browse files
authored
Use re.compile instead of the now-deprecated sre_compile (#75)
Use `re.compile` instead of now deprecated `sre_compile`
1 parent ff8d02a commit 56bc232

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

nsiqcppstyle_rulehelper.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2626
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2727

28-
import sre_compile
28+
import re
2929

3030
import nsiqcppstyle_state
3131

@@ -38,21 +38,21 @@ def Match(pattern, s):
3838
# performance reasons; factoring it out into a separate function turns out
3939
# to be noticeably expensive.
4040
if pattern not in _regexp_compile_cache:
41-
_regexp_compile_cache[pattern] = sre_compile.compile(pattern)
41+
_regexp_compile_cache[pattern] = re.compile(pattern)
4242
return _regexp_compile_cache[pattern].match(s)
4343

4444

4545
def Search(pattern, s):
4646
"""Searches the string for the pattern, caching the compiled regexp."""
4747
if pattern not in _regexp_compile_cache:
48-
_regexp_compile_cache[pattern] = sre_compile.compile(pattern)
48+
_regexp_compile_cache[pattern] = re.compile(pattern)
4949
return _regexp_compile_cache[pattern].search(s)
5050

5151

5252
def FindAll(pattern, s):
5353
"""Searches the string for the pattern, caching the compiled regexp."""
5454
if pattern not in _regexp_compile_cache:
55-
_regexp_compile_cache[pattern] = sre_compile.compile(pattern)
55+
_regexp_compile_cache[pattern] = re.compile(pattern)
5656
return _regexp_compile_cache[pattern].findall(s)
5757

5858

0 commit comments

Comments
 (0)