# HG changeset patch # User Anton Shestakov # Date 1704142445 10800 # Node ID 757fdf2216a3b55688a86be17996e54603a78cde # Parent 5d6d1ce4905b9eb523dc68436b95d98ce769adcc evolve: let pytype ignore python2-style metaclasses It's easier to ignore this pytype issue altogether than to figure out how to port these classes to support both Python 2 and 3 at the same time. diff -r 5d6d1ce4905b -r 757fdf2216a3 hgext3rd/evolve/stablerange.py --- a/hgext3rd/evolve/stablerange.py Sun Dec 31 19:16:21 2023 -0300 +++ b/hgext3rd/evolve/stablerange.py Mon Jan 01 17:54:05 2024 -0300 @@ -493,7 +493,7 @@ else: ui.status(b'%s - %s\n' % (rstr, subsstr)) -class abstractstablerange(object): +class abstractstablerange(object): # pytype: disable=ignored-metaclass """The official API for a stablerange""" __metaclass__ = abc.ABCMeta @@ -541,7 +541,8 @@ assert standard_start < rangedepth slicepoint = standard_start return slicepoint -class stablerangebasic(abstractstablerange): + +class stablerangebasic(abstractstablerange): # pytype: disable=ignored-metaclass """a very dummy implementation of stablerange the implementation is here to lay down the basic algorithm in the stable @@ -628,7 +629,7 @@ def _sortfunction(self, repo, headrev): return stablesort.stablesort_mergepoint_head_basic(repo, [headrev]) -class stablerangecached(abstractstablerange): +class stablerangecached(abstractstablerange): # pytype: disable=ignored-metaclass """an implementation of stablerange using caching""" __metaclass__ = abc.ABCMeta @@ -646,6 +647,9 @@ headrev, index = rangeid[0], rangeid[1] return self.depthrev(repo, headrev) - index + def _subranges(self, repo, rangeid): + raise NotImplementedError() + def subranges(self, repo, rangeid): assert 0 <= rangeid[1] <= rangeid[0], rangeid cached = self._getsub(rangeid) diff -r 5d6d1ce4905b -r 757fdf2216a3 hgext3rd/evolve/stablerangecache.py --- a/hgext3rd/evolve/stablerangecache.py Sun Dec 31 19:16:21 2023 -0300 +++ b/hgext3rd/evolve/stablerangecache.py Mon Jan 01 17:54:05 2024 -0300 @@ -168,7 +168,7 @@ body = r' OR '.join(_querysuperrangesbody % r for r in ranges) return _querysuperrangesmain % body -class stablerangesqlbase(stablerange.stablerangecached): +class stablerangesqlbase(stablerange.stablerangecached): # pytype: disable=ignored-metaclass """class that can handle all the bits needed to store range into sql """ @@ -368,8 +368,6 @@ class stablerangesql(stablerangesqlbase, stablerangeondiskbase): """base clase able to preserve data to disk as sql""" - __metaclass__ = abc.ABCMeta - # self._cachekey = (tiprev, tipnode) @property