comparison mercurial/revlog.py @ 51868:5e79783d4bc7

revlog: make `clearcaches()` signature consistent with ManifestRevlog I'm not sure if this a newly added bug, because of using a different version of pytype, or if the recent work around avoiding the zope interface types in the type checking phase (see 5eb98ea78fd7 and friends)... but pytype 2023.11.21 started flagging this series since it was last pushed ~6 weeks ago: File "/mnt/c/Users/Matt/hg/mercurial/bundlerepo.py", line 204, in <module>: Overriding method signature mismatch [signature-mismatch] Base signature: 'def mercurial.manifest.ManifestRevlog.clearcaches(self, clear_persisted_data: Any = ...) -> None'. Subclass signature: 'def mercurial.revlog.revlog.clearcaches(self) -> None'. Not enough positional parameters in overriding method. Maybe the multiple inheritance in `bundlerepo.bundlemanifest` is bad, but it seems like a `ManifestRevlog` is-a `revlog`, even though the class hierarchy isn't coded that way. Additionally, it looks like `revlog.clearcaches()` is dealing with some persistent data, so maybe this is useful to have there anyway. Also sprinkle some trivial type hints on the method, because there are other `clearcaches()` definitions in the codebase with these hints, and I don't feel like waiting for another pytype run to see if it cares that specifically about the signature matching.
author Matt Harbison <matt_harbison@yahoo.com>
date Wed, 18 Sep 2024 17:46:46 -0400
parents cfd30df0f8e4
children 22da1dc97281
comparison
equal deleted inserted replaced
51867:cfd30df0f8e4 51868:5e79783d4bc7
1864 if transaction is None: 1864 if transaction is None:
1865 nodemaputil.update_persistent_nodemap(self) 1865 nodemaputil.update_persistent_nodemap(self)
1866 else: 1866 else:
1867 nodemaputil.setup_persistent_nodemap(transaction, self) 1867 nodemaputil.setup_persistent_nodemap(transaction, self)
1868 1868
1869 def clearcaches(self): 1869 def clearcaches(self, clear_persisted_data: bool = False) -> None:
1870 """Clear in-memory caches""" 1870 """Clear in-memory caches"""
1871 self._chainbasecache.clear() 1871 self._chainbasecache.clear()
1872 self._inner.clear_cache() 1872 self._inner.clear_cache()
1873 self._pcache = {} 1873 self._pcache = {}
1874 self._nodemap_docket = None 1874 self._nodemap_docket = None