From 0fb77b81e0aebdfdf666be6ff3be89fa21ed5a2e Mon Sep 17 00:00:00 2001 From: Paul Marillonnet Date: Thu, 28 Jun 2018 14:15:41 +0200 Subject: [PATCH] avoid function parameters named 'async' (#28450) --- tests/test_storage.py | 2 +- wcs/qommon/storage.py | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/test_storage.py b/tests/test_storage.py index e0397b2c..d0f85b54 100644 --- a/tests/test_storage.py +++ b/tests/test_storage.py @@ -406,7 +406,7 @@ def test_concurrent_hashed_indexes(): test = Foobar() test.value = 'x' test.dict_value = {'plop': random.randint(0, 10)} - test.store(async=False) + test.store(async_ops=False) os._exit(0) for pid in children_pids: diff --git a/wcs/qommon/storage.py b/wcs/qommon/storage.py index aa7c481a..35d6ab36 100644 --- a/wcs/qommon/storage.py +++ b/wcs/qommon/storage.py @@ -56,7 +56,7 @@ def fix_key(k): if not k: return k return str(k).replace('/', '-') -def atomic_write(path, content, async=False): +def atomic_write(path, content, async_ops=False): '''Rewrite a complete file automatically, that is write to new file with temporary name, fsync, then rename to final name. Use threads to remove blocking.''' def doit(): @@ -76,7 +76,7 @@ def atomic_write(path, content, async=False): os.fsync(f.fileno()) f.close() os.rename(temp, path) - if async: + if async_ops: _thread.start_new_thread(doit, ()) else: doit() @@ -497,7 +497,7 @@ class StorableObject(object): def storage_dumps(cls, object): return pickle.dumps(object) - def store(self, async=False): + def store(self, async_ops=False): objects_dir = self.get_objects_dir() new_object = False if self._filename: @@ -526,7 +526,7 @@ class StorableObject(object): ignore_errors=True, ignore_migration=True) s = self.storage_dumps(self) - atomic_write(object_filename, s, async) + atomic_write(object_filename, s, async_ops) # update last modified time if os.path.exists(objects_dir): os.utime(objects_dir, None) -- 2.18.0