From 4c050c6f1a34c7b1aaf503d97b871afb8540e54f Mon Sep 17 00:00:00 2001 From: Allen Li Date: Mon, 5 Aug 2024 23:54:39 +0000 Subject: [PATCH] [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 Commit-Queue: Allen Li --- git_common.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/git_common.py b/git_common.py index cd87675fe..5663a1c17 100644 --- a/git_common.py +++ b/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):