D7674: typing: add a couple of assertions to lrucachedict to help pytype
mharbison72 (Matt Harbison)
phabricator at mercurial-scm.org
Mon Dec 16 04:13:07 UTC 2019
mharbison72 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.
REVISION SUMMARY
Fixes the following warnings:
line 1488, in pop: No attribute 'markempty' on None [attribute-error]
In Optional[Union[Any, _lrucachenode, nothing]]
line 1578, in popoldest: No attribute 'markempty' on None [attribute-error]
In Optional[Union[Any, _lrucachenode, nothing]]
REPOSITORY
rHG Mercurial
REVISION DETAIL
https://phab.mercurial-scm.org/D7674
AFFECTED FILES
mercurial/util.py
CHANGE DETAILS
diff --git a/mercurial/util.py b/mercurial/util.py
--- a/mercurial/util.py
+++ b/mercurial/util.py
@@ -1480,6 +1480,8 @@
if default is _notset:
raise
return default
+
+ assert node is not None # help pytype
value = node.value
self.totalcost -= node.cost
node.markempty()
@@ -1567,6 +1569,8 @@
while n.key is _notset:
n = n.prev
+ assert n is not None # help pytype
+
key, value = n.key, n.value
# And remove it from the cache and mark it as empty.
To: mharbison72, #hg-reviewers
Cc: mercurial-devel
More information about the Mercurial-devel
mailing list