Skip to content

Commit 0a56b51

Browse files
committed
Rename matchand pattern classes
1 parent 50c01e5 commit 0a56b51

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

graalpython/lib-graalpython/_sre.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ def setup(sre_compiler, error_class, flags_table):
157157
]
158158

159159

160-
class SRE_Match():
160+
class Match():
161161
def __init__(self, pattern, pos, endpos, result, input_str, compiled_regex):
162162
self.__result = result
163163
self.__compiled_regex = compiled_regex
@@ -265,7 +265,7 @@ def _append_end_assert(pattern):
265265
def _is_bytes_like(object):
266266
return isinstance(object, (bytes, bytearray, memoryview, mmap))
267267

268-
class SRE_Pattern():
268+
class Pattern():
269269
def __init__(self, pattern, flags):
270270
self.__binary = isinstance(pattern, bytes)
271271
self.pattern = pattern
@@ -333,7 +333,7 @@ def __repr__(self):
333333
def __eq__(self, other):
334334
if self is other:
335335
return True
336-
if type(other) != SRE_Pattern:
336+
if type(other) != Pattern:
337337
return NotImplemented
338338
return self.pattern == other.pattern and self.flags == other.flags
339339

@@ -350,7 +350,7 @@ def _search(self, pattern, string, pos, endpos, sticky=False):
350350
input_str = string[:endpos]
351351
result = tregex_call_exec(pattern.exec, input_str, min(pos, endpos % len(string) + 1))
352352
if result.isMatch:
353-
return SRE_Match(self, pos, endpos, result, input_str, pattern)
353+
return Match(self, pos, endpos, result, input_str, pattern)
354354
else:
355355
return None
356356

@@ -391,7 +391,7 @@ def finditer(self, string, pos=0, endpos=-1):
391391
if not result.isMatch:
392392
break
393393
else:
394-
yield SRE_Match(self, pos, endpos, result, string, compiled_regex)
394+
yield Match(self, pos, endpos, result, string, compiled_regex)
395395
no_progress = (result.getStart(0) == result.getEnd(0))
396396
pos = result.getEnd(0) + no_progress
397397
return
@@ -413,7 +413,7 @@ def findall(self, string, pos=0, endpos=-1):
413413
elif compiled_regex.groupCount == 2:
414414
matchlist.append(self.__sanitize_out_type(string[result.getStart(1):result.getEnd(1)]))
415415
else:
416-
matchlist.append(tuple(map(self.__sanitize_out_type, SRE_Match(self, pos, endpos, result, string, compiled_regex).groups())))
416+
matchlist.append(tuple(map(self.__sanitize_out_type, Match(self, pos, endpos, result, string, compiled_regex).groups())))
417417
no_progress = (result.getStart(0) == result.getEnd(0))
418418
pos = result.getEnd(0) + no_progress
419419
return matchlist
@@ -452,7 +452,7 @@ def repl(match):
452452
if literal:
453453
result.append(repl)
454454
else:
455-
_srematch = SRE_Match(self, pos, -1, match_result, string, pattern)
455+
_srematch = Match(self, pos, -1, match_result, string, pattern)
456456
_repl = repl(_srematch)
457457
result.append(_repl)
458458
pos = end
@@ -495,7 +495,7 @@ def split(self, string, maxsplit=0):
495495
return result
496496

497497

498-
_t_compile = SRE_Pattern
498+
_t_compile = Pattern
499499

500500
def compile(pattern, flags, code, groups, groupindex, indexgroup):
501501
import _cpython_sre

0 commit comments

Comments
 (0)