comparison mercurial/util.py @ 43880:eff050dbb703

util: rename a variable to avoid confusing pytype Fixes the following warning: line 1205, in f: No attribute 'append' on Dict[nothing, nothing] [attribute-error] In Union[Dict[nothing, nothing], list] Differential Revision: https://phab.mercurial-scm.org/D7673
author Matt Harbison <matt_harbison@yahoo.com>
date Sun, 15 Dec 2019 21:26:21 -0500
parents 40bd667491a7
children b5655f337bd7
comparison
equal deleted inserted replaced
43879:40bd667491a7 43880:eff050dbb703
1193 1193
1194 def cachefunc(func): 1194 def cachefunc(func):
1195 '''cache the result of function calls''' 1195 '''cache the result of function calls'''
1196 # XXX doesn't handle keywords args 1196 # XXX doesn't handle keywords args
1197 if func.__code__.co_argcount == 0: 1197 if func.__code__.co_argcount == 0:
1198 cache = [] 1198 listcache = []
1199 1199
1200 def f(): 1200 def f():
1201 if len(cache) == 0: 1201 if len(listcache) == 0:
1202 cache.append(func()) 1202 listcache.append(func())
1203 return cache[0] 1203 return listcache[0]
1204 1204
1205 return f 1205 return f
1206 cache = {} 1206 cache = {}
1207 if func.__code__.co_argcount == 1: 1207 if func.__code__.co_argcount == 1:
1208 # we gain a small amount of time because 1208 # we gain a small amount of time because