Kaynağa Gözat

[git_common] Use kwarg syntax for memoize_one

Change-Id: I764670c1a0d90e94e437472d6bc7a8ce1d0a11cb
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5762198
Reviewed-by: Yiwei Zhang <yiwzhang@google.com>
Commit-Queue: Allen Li <ayatane@chromium.org>
Allen Li 1 yıl önce
ebeveyn
işleme
4c050c6f1a
1 değiştirilmiş dosya ile 1 ekleme ve 4 silme
  1. 1 4
      git_common.py

+ 1 - 4
git_common.py

@@ -154,7 +154,7 @@ class BadCommitRefException(Exception):
         super(BadCommitRefException, self).__init__(msg)
 
 
-def memoize_one(**kwargs):
+def memoize_one(*, threadsafe: bool):
     """Memoizes a single-argument pure function.
 
     Values of None are not cached.
@@ -172,9 +172,6 @@ def memoize_one(**kwargs):
             unittests.
         * update(other) - Updates the contents of the cache from another dict.
     """
-    assert 'threadsafe' in kwargs, 'Must specify threadsafe={True,False}'
-    threadsafe = kwargs['threadsafe']
-
     if threadsafe:
 
         def withlock(lock, f):