Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(497)

Unified Diff: tools/json_schema_compiler/memoize.py

Issue 26418002: Docserver: Pull knowledge of host file systems into a single (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: cleanup Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: tools/json_schema_compiler/memoize.py
diff --git a/tools/json_schema_compiler/memoize.py b/tools/json_schema_compiler/memoize.py
index 1402a6ecd80990db3192a92be40d71f67f24fabb..228e7e3f82d26d8a23d3557a97b02624c1c73cc3 100644
--- a/tools/json_schema_compiler/memoize.py
+++ b/tools/json_schema_compiler/memoize.py
@@ -6,8 +6,9 @@ def memoize(fn):
'''Decorates |fn| to memoize.
'''
memory = {}
- def impl(*args):
- if args not in memory:
- memory[args] = fn(*args)
- return memory[args]
+ def impl(*args, **optargs):
+ full_args = args + tuple(optargs.iteritems())
+ if full_args not in memory:
+ memory[full_args] = fn(*args, **optargs)
+ return memory[full_args]
return impl

Powered by Google App Engine
This is Rietveld 408576698