[refactoring] inline useless variable
authorLaurent Peuch <cortex@worlddomination.be>
Thu, 05 Dec 2019 18:34:59 +0100
changeset 12803 bf940d5416e5
parent 12802 f6662c603730
child 12804 6de3af773073
[refactoring] inline useless variable
cubicweb/server/repository.py
--- a/cubicweb/server/repository.py	Wed Dec 11 00:01:38 2019 +0100
+++ b/cubicweb/server/repository.py	Thu Dec 05 18:34:59 2019 +0100
@@ -159,14 +159,12 @@
         super(_CnxSetPool, self).__init__()
 
     def qsize(self):
-        q = self._queue
-        if q is None:
+        if self._queue is None:
             return None
-        return q.qsize()
+        return self._queue.qsize()
 
     def get(self):
-        q = self._queue
-        if q is None:
+        if self._queue is None:
             return self._source.wrapped_connection()
         try:
             return self._queue.get(True, timeout=5)
@@ -178,8 +176,7 @@
                             'connections pool size)')
 
     def release(self, cnxset):
-        q = self._queue
-        if q is None:
+        if self._queue is None:
             cnxset.close(True)
         else:
             self._queue.put_nowait(cnxset)
@@ -189,10 +186,9 @@
             yield cnxset
 
     def close(self):
-        q = self._queue
-        if q is not None:
-            while not q.empty():
-                cnxset = q.get_nowait()
+        if self._queue is not None:
+            while not self._queue.empty():
+                cnxset = self._queue.get_nowait()
                 try:
                     cnxset.close(True)
                 except Exception: