comparison contrib/testparseutil.py @ 52643:5cc8deb96b48

pyupgrade: modernize calls to superclass methods This is the `legacy` fixer in `pyupgrade`, with the loop yielding the offset of `yield` statements commented out.
author Matt Harbison <matt_harbison@yahoo.com>
date Sun, 05 Jan 2025 22:23:31 -0500
parents cd3b8fd1d3eb
children 3e84e001b6c1
comparison
equal deleted inserted replaced
52642:73ab542565e0 52643:5cc8deb96b48
302 """ 302 """
303 303
304 _prefix = ' > ' 304 _prefix = ' > '
305 305
306 def __init__(self, desc, namepat): 306 def __init__(self, desc, namepat):
307 super(fileheredocmatcher, self).__init__(desc) 307 super().__init__(desc)
308 308
309 # build the pattern to match against cases below (and ">>" 309 # build the pattern to match against cases below (and ">>"
310 # variants), and to return a target filename string as 'name' 310 # variants), and to return a target filename string as 'name'
311 # group 311 # group
312 # 312 #
424 # should be rejected by Mercurial reviewers. Therefore, this 424 # should be rejected by Mercurial reviewers. Therefore, this
425 # regexp does not matche against such directive lines. 425 # regexp does not matche against such directive lines.
426 _outputre = re.compile(r' {2}$| {2}[^$]') 426 _outputre = re.compile(r' {2}$| {2}[^$]')
427 427
428 def __init__(self): 428 def __init__(self):
429 super(pydoctestmatcher, self).__init__("doctest style python code") 429 super().__init__("doctest style python code")
430 430
431 def startsat(self, line): 431 def startsat(self, line):
432 # ctx is "True" 432 # ctx is "True"
433 return line.startswith(self._prefix) 433 return line.startswith(self._prefix)
434 434
498 _startre = re.compile( 498 _startre = re.compile(
499 r' {2}\$ (\$PYTHON|"\$PYTHON"|python).*' + heredoclimitpat 499 r' {2}\$ (\$PYTHON|"\$PYTHON"|python).*' + heredoclimitpat
500 ) 500 )
501 501
502 def __init__(self): 502 def __init__(self):
503 super(pyheredocmatcher, self).__init__("heredoc python invocation") 503 super().__init__("heredoc python invocation")
504 504
505 def startsat(self, line): 505 def startsat(self, line):
506 # ctx is END-LINE-OF-EMBEDDED-CODE 506 # ctx is END-LINE-OF-EMBEDDED-CODE
507 matched = self._startre.match(line) 507 matched = self._startre.match(line)
508 if matched: 508 if matched: