Mercurial > public > mercurial-scm > hg
comparison mercurial/smartset.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 | f4733654f144 |
children | e627cc25b6f3 |
comparison
equal
deleted
inserted
replaced
52642:73ab542565e0 | 52643:5cc8deb96b48 |
---|---|
353 s = baseset( | 353 s = baseset( |
354 data=getattr(self._set, op)(other._set), istopo=self._istopo | 354 data=getattr(self._set, op)(other._set), istopo=self._istopo |
355 ) | 355 ) |
356 s._ascending = self._ascending | 356 s._ascending = self._ascending |
357 else: | 357 else: |
358 s = getattr(super(baseset, self), op)(other) | 358 s = getattr(super(), op)(other) |
359 return s | 359 return s |
360 | 360 |
361 def __and__(self, other): | 361 def __and__(self, other): |
362 return self._fastsetop(other, '__and__') | 362 return self._fastsetop(other, '__and__') |
363 | 363 |
784 elif iterasc: | 784 elif iterasc: |
785 typ = _generatorsetasc | 785 typ = _generatorsetasc |
786 else: | 786 else: |
787 typ = _generatorsetdesc | 787 typ = _generatorsetdesc |
788 | 788 |
789 return super(generatorset, cls).__new__(typ) | 789 return super().__new__(typ) |
790 | 790 |
791 def __init__(self, gen, iterasc=None): | 791 def __init__(self, gen, iterasc=None): |
792 """ | 792 """ |
793 gen: a generator producing the values for the generatorset. | 793 gen: a generator producing the values for the generatorset. |
794 """ | 794 """ |
1091 return None | 1091 return None |
1092 | 1092 |
1093 def _slice(self, start, stop): | 1093 def _slice(self, start, stop): |
1094 if self._hiddenrevs: | 1094 if self._hiddenrevs: |
1095 # unoptimized since all hidden revisions in range has to be scanned | 1095 # unoptimized since all hidden revisions in range has to be scanned |
1096 return super(_spanset, self)._slice(start, stop) | 1096 return super()._slice(start, stop) |
1097 if self._ascending: | 1097 if self._ascending: |
1098 x = min(self._start + start, self._end) | 1098 x = min(self._start + start, self._end) |
1099 y = min(self._start + stop, self._end) | 1099 y = min(self._start + stop, self._end) |
1100 else: | 1100 else: |
1101 x = max(self._end - stop, self._start) | 1101 x = max(self._end - stop, self._start) |
1114 This class exists to host special optimization and magic to handle virtual | 1114 This class exists to host special optimization and magic to handle virtual |
1115 revisions such as "null". | 1115 revisions such as "null". |
1116 """ | 1116 """ |
1117 | 1117 |
1118 def __init__(self, repo): | 1118 def __init__(self, repo): |
1119 super(fullreposet, self).__init__( | 1119 super().__init__(0, len(repo), True, repo.changelog.filteredrevs) |
1120 0, len(repo), True, repo.changelog.filteredrevs | |
1121 ) | |
1122 | 1120 |
1123 def __and__(self, other): | 1121 def __and__(self, other): |
1124 """As self contains the whole repo, all of the other set should also be | 1122 """As self contains the whole repo, all of the other set should also be |
1125 in self. Therefore `self & other = other`. | 1123 in self. Therefore `self & other = other`. |
1126 | 1124 |