changeset 6628:757fdf2216a3

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.
author Anton Shestakov <av6@dwimlabs.net>
date Mon, 01 Jan 2024 17:54:05 -0300
parents 5d6d1ce4905b
children c3b3a0620f3b
files hgext3rd/evolve/stablerange.py hgext3rd/evolve/stablerangecache.py
diffstat 2 files changed, 8 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- 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)
--- 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