mirror of
https://github.com/nvbn/thefuck.git
synced 2025-01-19 04:21:14 +00:00
Merge pull request #400 from alessio/fix-memoize
Fix misinterpretation of the disabled flag
This commit is contained in:
commit
fe91008a9c
@ -23,11 +23,16 @@ def memoize(fn):
|
||||
|
||||
@wraps(fn)
|
||||
def wrapper(*args, **kwargs):
|
||||
key = pickle.dumps((args, kwargs))
|
||||
if key not in memo or memoize.disabled:
|
||||
memo[key] = fn(*args, **kwargs)
|
||||
if not memoize.disabled:
|
||||
key = pickle.dumps((args, kwargs))
|
||||
if key not in memo:
|
||||
memo[key] = fn(*args, **kwargs)
|
||||
value = memo[key]
|
||||
else:
|
||||
# Memoize is disabled, call the function
|
||||
value = fn(*args, **kwargs)
|
||||
|
||||
return memo[key]
|
||||
return value
|
||||
|
||||
return wrapper
|
||||
memoize.disabled = False
|
||||
|
Loading…
x
Reference in New Issue
Block a user