From d4a4d55ccfd1fcb130543f1bafa549ea9ab5967a Mon Sep 17 00:00:00 2001 From: Joost Ruis Date: Sat, 29 Aug 2020 14:28:04 +0200 Subject: [PATCH] async became a keyword in python 3.7 Thus we renamed it to async_mode. Please see https://docs.python.org/3/whatsnew/3.7.html --- lib/entropy/cache.py | 16 ++++++++-------- lib/entropy/client/interfaces/dep.py | 6 +++--- lib/entropy/db/skel.py | 2 +- lib/tests/client.py | 2 +- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/lib/entropy/cache.py b/lib/entropy/cache.py index ba1d21c2b..57b6d8eec 100644 --- a/lib/entropy/cache.py +++ b/lib/entropy/cache.py @@ -65,7 +65,7 @@ class EntropyCacher(Singleton): >>> # now store something into its cache >>> cacher.push('my_identifier1', [1, 2, 3]) >>> # now store something synchronously - >>> cacher.push('my_identifier2', [1, 2, 3], async = False) + >>> cacher.push('my_identifier2', [1, 2, 3], async_mode = False) ... >>> # now flush all the caches to disk, and make sure all >>> # is written @@ -75,7 +75,7 @@ class EntropyCacher(Singleton): >>> data = cacher.pop('my_identifier1') [1, 2, 3] ... - >>> # now discard all the cached (async) writes + >>> # now discard all the cached (async_mode) writes >>> cacher.discard() ... >>> # and stop EntropyCacher @@ -329,18 +329,18 @@ class EntropyCacher(Singleton): raise IOError("cannot store %s to %s. err: %s" % ( key, cache_dir, repr(err))) - def push(self, key, data, async = True, cache_dir = None): + def push(self, key, data, async_mode = True, cache_dir = None): """ This is the place where data is either added - to the write queue or written to disk (if async == False) + to the write queue or written to disk (if async_mode == False) only and only if start() method has been called. @param key: cache data identifier @type key: string @param data: picklable object @type data: any picklable object - @keyword async: store cache asynchronously or not - @type async: bool + @keyword async_mode: store cache asynchronously or not + @type async_mode: bool @keyword cache_dir: alternative cache directory @type cache_dir: string """ @@ -350,7 +350,7 @@ class EntropyCacher(Singleton): if cache_dir is None: cache_dir = self.current_directory() - if async: + if async_mode: try: obj_copy = self.__copy_obj(data) self.__cache_buffer.push(((key, cache_dir,), obj_copy,)) @@ -365,7 +365,7 @@ class EntropyCacher(Singleton): sys.stdout.flush() #if const_debug_enabled(): # const_debug_write(__name__, - # "EntropyCacher.push, async push %s, into %s" % ( + # "EntropyCacher.push, async_mode push %s, into %s" % ( # key, cache_dir,)) else: #if const_debug_enabled(): diff --git a/lib/entropy/client/interfaces/dep.py b/lib/entropy/client/interfaces/dep.py index ecbae5e4d..4bda68192 100644 --- a/lib/entropy/client/interfaces/dep.py +++ b/lib/entropy/client/interfaces/dep.py @@ -2432,7 +2432,7 @@ class CalculatorsMixin: } if self.xcache: - self._cacher.push(cache_key, data, async = False) + self._cacher.push(cache_key, data, async_mode = False) return data @@ -3070,7 +3070,7 @@ class CalculatorsMixin: data = (atoms, matches) if self.xcache: - self._cacher.push(cache_key, data, async = False) + self._cacher.push(cache_key, data, async_mode = False) return data @@ -3396,7 +3396,7 @@ class CalculatorsMixin: } if self.xcache: - self._cacher.push(cache_key, outcome, async = False) + self._cacher.push(cache_key, outcome, async_mode = False) self._cacher.sync() if not update: diff --git a/lib/entropy/db/skel.py b/lib/entropy/db/skel.py index c3919f84f..9af22b4b9 100644 --- a/lib/entropy/db/skel.py +++ b/lib/entropy/db/skel.py @@ -5558,7 +5558,7 @@ class EntropyRepositoryBase(TextInterface, EntropyRepositoryPluginStore): hash_str, ), kwargs.get('result'), - async = False) + async_mode = False) def __filterSlot(self, package_id, slot): if slot is None: diff --git a/lib/tests/client.py b/lib/tests/client.py index d30fe6b53..2bf05ec8c 100644 --- a/lib/tests/client.py +++ b/lib/tests/client.py @@ -137,7 +137,7 @@ class EntropyClientTest(unittest.TestCase): tmp_dir = const_mkdtemp() cacher.stop() try: - cacher.push("bar", "foo", async = False, cache_dir = tmp_dir) + cacher.push("bar", "foo", async_mode = False, cache_dir = tmp_dir) # must return None cacher.sync() self.assertEqual(cacher.pop("bar", cache_dir = tmp_dir), None)