# HG changeset patch # User Anton Shestakov # Date 1720784652 -14400 # Node ID 417f775d3eee56e566b76917eb4b512ffe14bddb # Parent 47c7b5ccabd0fe9b408d9b3468a6f955c7f476aa topic: we checked that branchmap.branchcache exists, let pytype know this diff -r 47c7b5ccabd0 -r 417f775d3eee hgext3rd/topic/topicmap.py --- a/hgext3rd/topic/topicmap.py Fri Jul 12 15:43:01 2024 +0400 +++ b/hgext3rd/topic/topicmap.py Fri Jul 12 15:44:12 2024 +0400 @@ -133,6 +133,8 @@ branchmap.remotebranchcache = remotetopiccache else: # hg <= 6.7 (ec640dc9cebd) + assert hasattr(branchmap, 'branchcache') # help pytype + class topiccache(_topiccache, branchmap.branchcache): pass branchmap.branchcache = topiccache @@ -162,6 +164,7 @@ def copy(self): """return an deep copy of the branchcache object""" + assert hasattr(branchmap, 'branchcache') # help pytype assert isinstance(self, (branchmap.branchcache, branchmap.remotebranchcache)) # help pytype args = (self._entries, self.tipnode, self.tiprev, self.filteredhash, self._closednodes) @@ -176,6 +179,7 @@ """call branchmap.load(), and then transform branch names to be in the new "//" format """ + assert hasattr(branchmap, 'branchcache') # help pytype assert isinstance(self, branchmap.branchcache) # help pytype super(_topiccache, self).load(repo, lineiter) @@ -189,6 +193,7 @@ - False when cached tipnode is unknown or if we detect a strip. - True when cache is up to date or a subset of current repo.""" + assert hasattr(branchmap, 'branchcache') # help pytype assert isinstance(self, (branchmap.branchcache, branchmap.remotebranchcache)) # help pytype valid = super(_topiccache, self).validfor(repo) if not valid: @@ -225,6 +230,7 @@ missing heads, and a generator of nodes that are strictly a superset of heads missing, this function updates self to be correct. """ + assert hasattr(branchmap, 'branchcache') # help pytype assert isinstance(self, (branchmap.branchcache, branchmap.remotebranchcache)) # help pytype if not istopicfilter(repo.filtername): return super(_topiccache, self).update(repo, revgen) @@ -284,6 +290,7 @@ """ # we expect mutable set to be small enough to be that computing it all # the time will be fast enough + assert isinstance(self, branchmap.BranchCacheV2) # help pytype if not istopicfilter(repo.filtername): entries = self._entries.copy()