From 43fb703cb4615715709fb51533ed7b8c662ed930 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Piotr=20Ma=C5=9Blanka?= <piotr.maslanka@henrietta.com.pl>
Date: Tue, 5 Mar 2024 17:32:14 +0100
Subject: [PATCH] fix pylint issues

---
 satella/coding/concurrent/sync.py | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/satella/coding/concurrent/sync.py b/satella/coding/concurrent/sync.py
index 9dda7e2c..c1bd6676 100644
--- a/satella/coding/concurrent/sync.py
+++ b/satella/coding/concurrent/sync.py
@@ -19,6 +19,17 @@ def _while_sync_threadpool(tpe, max_wait, measurement, futures):
         time.sleep(0.5)
 
 
+def _max_wait_atm_n(measurement, max_wait, atm_n):
+    while measurement() < max_wait:
+        try:
+            atm_n.wait_until_equal(0, 1)
+            break
+        except WouldWaitMore:
+            continue
+    else:
+        raise WouldWaitMore('timeout exceeded')
+
+
 def sync_threadpool(tpe: tp.Union[ExecutorWrapper, ThreadPoolExecutor],
                     max_wait: tp.Optional[float] = None) -> None:
     """
@@ -54,13 +65,6 @@ def sync_threadpool(tpe: tp.Union[ExecutorWrapper, ThreadPoolExecutor],
         if max_wait is None:
             atm_n.wait_until_equal(0)
         else:
-            while measurement() < max_wait:
-                try:
-                    atm_n.wait_until_equal(0, 1)
-                    break
-                except WouldWaitMore:
-                    continue
-            else:
-                raise WouldWaitMore('timeout exceeded')
+            _max_wait_atm_n(measurement, max_wait, atm_n)
         cond.notify_all()
         wait(futures)
-- 
GitLab