mirror of
				https://github.com/nvbn/thefuck.git
				synced 2025-10-31 15:12:20 +00:00 
			
		
		
		
	Merge pull request #400 from alessio/fix-memoize
Fix misinterpretation of the disabled flag
This commit is contained in:
		| @@ -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 | ||||
|   | ||||
		Reference in New Issue
	
	Block a user