Remove only_free param to Pool.get()

This is unused. I think I added it before iter_free(), i.e. empty()
was going to be:

  for item in self.get(only_free=True):
      item.close()

rather than:

  for item in self.iter_free():
      item.close()

Change-Id: Ie6d0de3b7453ee036412db10f37d26f04de73cf7
This commit is contained in:
Mark McLoughlin 2013-07-27 13:52:58 +01:00
parent c719dc306b
commit abf5b2bf5a
1 changed files with 2 additions and 6 deletions

View File

@ -45,21 +45,17 @@ class Pool(object):
self._items.appendleft(item)
self._cond.notify()
def get(self, only_free=False):
def get(self):
"""Return an item from the pool, when one is available.
This may cause the calling thread to block.
:param only_free: if True, return None if no free item available
:type only_free: bool
"""
with self._cond:
while True:
try:
return self._items.popleft()
except IndexError:
if only_free:
return None
pass
if self._current_size < self._max_size:
self._current_size += 1