@@ -157,7 +157,7 @@ def setup(sre_compiler, error_class, flags_table):
157
157
]
158
158
159
159
160
- class SRE_Match ():
160
+ class Match ():
161
161
def __init__ (self , pattern , pos , endpos , result , input_str , compiled_regex ):
162
162
self .__result = result
163
163
self .__compiled_regex = compiled_regex
@@ -265,7 +265,7 @@ def _append_end_assert(pattern):
265
265
def _is_bytes_like (object ):
266
266
return isinstance (object , (bytes , bytearray , memoryview , mmap ))
267
267
268
- class SRE_Pattern ():
268
+ class Pattern ():
269
269
def __init__ (self , pattern , flags ):
270
270
self .__binary = isinstance (pattern , bytes )
271
271
self .pattern = pattern
@@ -333,7 +333,7 @@ def __repr__(self):
333
333
def __eq__ (self , other ):
334
334
if self is other :
335
335
return True
336
- if type (other ) != SRE_Pattern :
336
+ if type (other ) != Pattern :
337
337
return NotImplemented
338
338
return self .pattern == other .pattern and self .flags == other .flags
339
339
@@ -350,7 +350,7 @@ def _search(self, pattern, string, pos, endpos, sticky=False):
350
350
input_str = string [:endpos ]
351
351
result = tregex_call_exec (pattern .exec , input_str , min (pos , endpos % len (string ) + 1 ))
352
352
if result .isMatch :
353
- return SRE_Match (self , pos , endpos , result , input_str , pattern )
353
+ return Match (self , pos , endpos , result , input_str , pattern )
354
354
else :
355
355
return None
356
356
@@ -391,7 +391,7 @@ def finditer(self, string, pos=0, endpos=-1):
391
391
if not result .isMatch :
392
392
break
393
393
else :
394
- yield SRE_Match (self , pos , endpos , result , string , compiled_regex )
394
+ yield Match (self , pos , endpos , result , string , compiled_regex )
395
395
no_progress = (result .getStart (0 ) == result .getEnd (0 ))
396
396
pos = result .getEnd (0 ) + no_progress
397
397
return
@@ -413,7 +413,7 @@ def findall(self, string, pos=0, endpos=-1):
413
413
elif compiled_regex .groupCount == 2 :
414
414
matchlist .append (self .__sanitize_out_type (string [result .getStart (1 ):result .getEnd (1 )]))
415
415
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 ())))
417
417
no_progress = (result .getStart (0 ) == result .getEnd (0 ))
418
418
pos = result .getEnd (0 ) + no_progress
419
419
return matchlist
@@ -452,7 +452,7 @@ def repl(match):
452
452
if literal :
453
453
result .append (repl )
454
454
else :
455
- _srematch = SRE_Match (self , pos , - 1 , match_result , string , pattern )
455
+ _srematch = Match (self , pos , - 1 , match_result , string , pattern )
456
456
_repl = repl (_srematch )
457
457
result .append (_repl )
458
458
pos = end
@@ -495,7 +495,7 @@ def split(self, string, maxsplit=0):
495
495
return result
496
496
497
497
498
- _t_compile = SRE_Pattern
498
+ _t_compile = Pattern
499
499
500
500
def compile (pattern , flags , code , groups , groupindex , indexgroup ):
501
501
import _cpython_sre
0 commit comments