@@ -54,14 +54,14 @@ def __init__(self, pattern_input, isMatch, groupCount, start, end):
5454 self .input = pattern_input
5555 self .isMatch = isMatch
5656 self .groupCount = groupCount
57- self .start = start
58- self .end = end
57+ self ._start = start
58+ self ._end = end
5959
6060 def getStart (self , grpidx ):
61- return self .start [grpidx ]
61+ return self ._start [grpidx ]
6262
6363 def getEnd (self , grpidx ):
64- return self .end [grpidx ]
64+ return self ._end [grpidx ]
6565
6666
6767def _str_to_bytes (arg ):
@@ -158,7 +158,7 @@ def __init__(self, pattern, pos, endpos, result, input_str, compiled_regex):
158158 self .input_str = input_str
159159
160160 def end (self , groupnum = 0 ):
161- return self .result .end [ groupnum ]
161+ return self .result .getEnd ( groupnum )
162162
163163 def group (self , * args ):
164164 if not args :
@@ -185,11 +185,11 @@ def __groupidx__(self, idx):
185185
186186 def __group__ (self , idx ):
187187 idxarg = self .__groupidx__ (idx )
188- start = self .result .start [ idxarg ]
188+ start = self .result .getStart ( idxarg )
189189 if start < 0 :
190190 return None
191191 else :
192- return self .input_str [start :self .result .end [ idxarg ] ]
192+ return self .input_str [start :self .result .getEnd ( idxarg ) ]
193193
194194 def groupdict (self , default = None ):
195195 d = {}
@@ -202,11 +202,11 @@ def groupdict(self, default=None):
202202
203203 def span (self , groupnum = 0 ):
204204 idxarg = self .__groupidx__ (groupnum )
205- return (self .result .start [ idxarg ] , self .result .end [ idxarg ] )
205+ return (self .result .getStart ( idxarg ) , self .result .getEnd ( idxarg ) )
206206
207207 def start (self , groupnum = 0 ):
208208 idxarg = self .__groupidx__ (groupnum )
209- return self .result .start [ idxarg ]
209+ return self .result .getStart ( idxarg )
210210
211211 @property
212212 def string (self ):
@@ -218,7 +218,7 @@ def lastgroup(self):
218218
219219 @property
220220 def lastindex (self ):
221- return self .result .end [ 0 ]
221+ return self .result .getEnd ( 0 )
222222
223223 def __repr__ (self ):
224224 return "<re.Match object; span=%r, match=%r>" % (self .span (), self .group ())
@@ -341,8 +341,8 @@ def finditer(self, string, pos=0, endpos=-1):
341341 break
342342 else :
343343 yield SRE_Match (self , pos , endpos , result , string , compiled_regex )
344- no_progress = (result .start [ 0 ] == result .end [ 0 ] )
345- pos = result .end [ 0 ] + no_progress
344+ no_progress = (result .getStart ( 0 ) == result .getEnd ( 0 ) )
345+ pos = result .getEnd ( 0 ) + no_progress
346346 return
347347
348348 def findall (self , string , pos = 0 , endpos = - 1 ):
@@ -358,21 +358,21 @@ def findall(self, string, pos=0, endpos=-1):
358358 if not result .isMatch :
359359 break
360360 elif result .groupCount == 1 :
361- matchlist .append (self .__sanitize_out_type (string [result .start [ 0 ] :result .end [ 0 ] ]))
361+ matchlist .append (self .__sanitize_out_type (string [result .getStart ( 0 ) :result .getEnd ( 0 ) ]))
362362 elif result .groupCount == 2 :
363- matchlist .append (self .__sanitize_out_type (string [result .start [ 1 ] :result .end [ 1 ] ]))
363+ matchlist .append (self .__sanitize_out_type (string [result .getStart ( 1 ) :result .getEnd ( 1 ) ]))
364364 else :
365365 matchlist .append (tuple (map (self .__sanitize_out_type , SRE_Match (self , pos , endpos , result , string , compiled_regex ).groups ())))
366- no_progress = (result .start [ 0 ] == result .end [ 0 ] )
367- pos = result .end [ 0 ] + no_progress
366+ no_progress = (result .getStart ( 0 ) == result .getEnd ( 0 ) )
367+ pos = result .getEnd ( 0 ) + no_progress
368368 return matchlist
369369
370370 def __replace_groups (self , repl , string , match_result , pattern ):
371371 def group (match_result , group_nr , string ):
372372 if group_nr >= match_result .groupCount :
373373 return None
374- group_start = match_result .start [ group_nr ]
375- group_end = match_result .end [ group_nr ]
374+ group_start = match_result .getStart ( group_nr )
375+ group_end = match_result .getEnd ( group_nr )
376376 return string [group_start :group_end ]
377377
378378 n = len (repl )
@@ -442,8 +442,8 @@ def sub(self, repl, string, count=0):
442442 if not match_result .isMatch :
443443 break
444444 n += 1
445- start = match_result .start [ 0 ]
446- end = match_result .end [ 0 ]
445+ start = match_result .getStart ( 0 )
446+ end = match_result .getEnd ( 0 )
447447 result .append (string [pos :start ])
448448 if is_string_rep :
449449 result .append (self .__replace_groups (repl , string , match_result , pattern ))
@@ -473,14 +473,14 @@ def split(self, string, maxsplit=0):
473473 if not match_result .isMatch :
474474 break
475475 n += 1
476- start = match_result .start [ 0 ]
477- end = match_result .end [ 0 ]
476+ start = match_result .getStart ( 0 )
477+ end = match_result .getEnd ( 0 )
478478 result .append (self .__sanitize_out_type (string [collect_pos :start ]))
479479 # add all group strings
480480 for i in range (1 , match_result .groupCount ):
481- groupStart = match_result .start [ i ]
481+ groupStart = match_result .getStart ( i )
482482 if groupStart >= 0 :
483- result .append (self .__sanitize_out_type (string [groupStart :match_result .end [ i ] ]))
483+ result .append (self .__sanitize_out_type (string [groupStart :match_result .getEnd ( i ) ]))
484484 else :
485485 result .append (None )
486486 collect_pos = end
0 commit comments