##// END OF EJS Templates
typing: make minor adjustments to mercurial/util.py to pass pytype checking...
Matt Harbison -
r47663:51841b23 default
parent child Browse files
Show More
@@ -1265,7 +1265,8 b' class cow(object):'
1265 1265 """call this before writes, return self or a copied new object"""
1266 1266 if getattr(self, '_copied', 0):
1267 1267 self._copied -= 1
1268 return self.__class__(self)
1268 # Function cow.__init__ expects 1 arg(s), got 2 [wrong-arg-count]
1269 return self.__class__(self) # pytype: disable=wrong-arg-count
1269 1270 return self
1270 1271
1271 1272 def copy(self):
@@ -1408,8 +1409,8 b' class _lrucachenode(object):'
1408 1409 __slots__ = ('next', 'prev', 'key', 'value', 'cost')
1409 1410
1410 1411 def __init__(self):
1411 self.next = None
1412 self.prev = None
1412 self.next = self
1413 self.prev = self
1413 1414
1414 1415 self.key = _notset
1415 1416 self.value = None
@@ -1448,9 +1449,7 b' class lrucachedict(object):'
1448 1449 def __init__(self, max, maxcost=0):
1449 1450 self._cache = {}
1450 1451
1451 self._head = head = _lrucachenode()
1452 head.prev = head
1453 head.next = head
1452 self._head = _lrucachenode()
1454 1453 self._size = 1
1455 1454 self.capacity = max
1456 1455 self.totalcost = 0
@@ -1555,6 +1554,7 b' class lrucachedict(object):'
1555 1554 """
1556 1555 try:
1557 1556 node = self._cache[k]
1557 assert node is not None # help pytype
1558 1558 return node.value
1559 1559 except KeyError:
1560 1560 if default is _notset:
@@ -1612,6 +1612,9 b' class lrucachedict(object):'
1612 1612 # Walk the linked list backwards starting at tail node until we hit
1613 1613 # a non-empty node.
1614 1614 n = self._head.prev
1615
1616 assert n is not None # help pytype
1617
1615 1618 while n.key is _notset:
1616 1619 n = n.prev
1617 1620
@@ -89,7 +89,6 b' development, but may be a hinderance for'
89 89 > -x mercurial/ui.py \
90 90 > -x mercurial/unionrepo.py \
91 91 > -x mercurial/upgrade.py \
92 > -x mercurial/util.py \
93 92 > -x mercurial/utils/procutil.py \
94 93 > -x mercurial/utils/stringutil.py \
95 94 > -x mercurial/utils/memorytop.py \
General Comments 0
You need to be logged in to leave comments. Login now