From a50e5e165f40498eae5f15b286383038c6a9d879 Mon Sep 17 00:00:00 2001 From: "Maarten A. Breddels" Date: Tue, 14 Dec 2021 21:37:11 +0100 Subject: [PATCH] minimize diff --- .../ipywidgets/ipywidgets/widgets/widget.py | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/python/ipywidgets/ipywidgets/widgets/widget.py b/python/ipywidgets/ipywidgets/widgets/widget.py index bce74e45e0b..e8de35af10c 100644 --- a/python/ipywidgets/ipywidgets/widgets/widget.py +++ b/python/ipywidgets/ipywidgets/widgets/widget.py @@ -648,20 +648,6 @@ def _lock_property(self, **properties): finally: self._property_lock = {} - @contextmanager - def hold_sync(self): - """Hold syncing any state until the outermost context manager exits""" - if self._holding_sync is True: - yield - else: - try: - self._holding_sync = True - yield - finally: - self._holding_sync = False - self.send_state(self._states_to_send) - self._states_to_send.clear() - @contextmanager def _hold_sync_frontend(self): """Same as hold_sync, but will not sync back traits tagged as no_echo""" @@ -676,6 +662,20 @@ def _hold_sync_frontend(self): finally: self._holding_sync_from_frontend_update = False + @contextmanager + def hold_sync(self): + """Hold syncing any state until the outermost context manager exits""" + if self._holding_sync is True: + yield + else: + try: + self._holding_sync = True + yield + finally: + self._holding_sync = False + self.send_state(self._states_to_send) + self._states_to_send.clear() + def _should_send_property(self, key, value): """Check the property lock (property_lock)""" to_json = self.trait_metadata(key, 'to_json', self._trait_to_json)