vendor/zasync/1.1

changeset 47:94f6fc3359b5 1.1-nux

Removed trailing whitespaces
author rspivak
date Fri, 15 Feb 2008 00:03:22 +0000
parents d1489edfb620
children 790ced9e1fe8
files bucketqueue.py
diffstat 1 files changed, 17 insertions(+), 17 deletions(-) [+]
line diff
     1.1 --- a/bucketqueue.py
     1.2 +++ b/bucketqueue.py
     1.3 @@ -15,8 +15,8 @@
     1.4  __all__ = ['BucketQueue']
     1.5  
     1.6  class BucketQueue(Queue):
     1.7 -    """A queue that only allows a single item from a given bucket to be 
     1.8 -    obtained at a time.  Within a bucket, order is guaranteed.  Between 
     1.9 +    """A queue that only allows a single item from a given bucket to be
    1.10 +    obtained at a time.  Within a bucket, order is guaranteed.  Between
    1.11      unblocked buckets, order is also honored.
    1.12      """
    1.13      def __init__(self, maxsize=0):
    1.14 @@ -35,9 +35,9 @@
    1.15              return self._primed()
    1.16          finally:
    1.17              self.mutex.release()
    1.18 -    
    1.19 +
    1.20      def available(self, id=None):
    1.21 -        """Return True if there is currently an item available for this 
    1.22 +        """Return True if there is currently an item available for this
    1.23          particular thread"""
    1.24          if id is None:
    1.25              id = thread.get_ident()
    1.26 @@ -46,7 +46,7 @@
    1.27              return self._primed(self._threadbucket.get(id))
    1.28          finally:
    1.29              self.mutex.release()
    1.30 -    
    1.31 +
    1.32      def makeBucket(self, name, silent=False):
    1.33          if name is None:
    1.34              raise ValueError("Bucket name cannot be None")
    1.35 @@ -68,7 +68,7 @@
    1.36          is ignored in that case).
    1.37          """
    1.38          if bucket is not None and self._bucketsema.get(bucket) is None:
    1.39 -            raise ValueError("bucket does not exist; create with makeBucket", 
    1.40 +            raise ValueError("bucket does not exist; create with makeBucket",
    1.41                               bucket)
    1.42          if block:
    1.43              if timeout is None:
    1.44 @@ -123,15 +123,15 @@
    1.45          Otherwise raise the Full exception.
    1.46          """
    1.47          return self.put(item, False, bucket=bucket)
    1.48 -    
    1.49 +
    1.50      def releaseBucketByThreadId(self, id):
    1.51          return self._releaseBucket(id=id)
    1.52 -   
    1.53 +
    1.54      def releaseBucket(self, bucket=None):
    1.55          """Release bucket.  If bucket is None, release the bucket for this
    1.56          thread, if any."""
    1.57          return self._releaseBucket(bucket)
    1.58 -   
    1.59 +
    1.60      def _releaseBucket(self, bucket=None, id=None):
    1.61          self.mutex.acquire()
    1.62          try:
    1.63 @@ -220,13 +220,13 @@
    1.64                  self.esema.release()
    1.65              self.mutex.release()
    1.66          return item
    1.67 -    
    1.68 +
    1.69      # Override if desired (but others are more useful, below).  These are
    1.70      # only called with the appropriate locks held.
    1.71 -    
    1.72 +
    1.73      def _findNext(self, current=None):
    1.74          """return ix, bucket lock, and item of next open, where ix is the value
    1.75 -        that _removeIx needs to remove the item from the queue.  Raise 
    1.76 +        that _removeIx needs to remove the item from the queue.  Raise
    1.77          LookupError if no next item is available."""
    1.78          buckets = sets.Set()
    1.79          for ix, bucket, item in self._enumerateItems():
    1.80 @@ -238,7 +238,7 @@
    1.81                      return ix, bucket, lock, item
    1.82                  buckets.add(bucket)
    1.83          raise LookupError("No next value available")
    1.84 -    
    1.85 +
    1.86      def _primed(self, current=None):
    1.87          try:
    1.88              self._findNext(current)
    1.89 @@ -252,17 +252,17 @@
    1.90  
    1.91      def _enumerateItems(self):
    1.92          """enumerate ix, bucket name, and item of each item in the queue in
    1.93 -        preferred order (defaults to FIFO).  ix is whatever value that 
    1.94 +        preferred order (defaults to FIFO).  ix is whatever value that
    1.95          _removeIx needs to remove the item from the queue."""
    1.96          for ix, (item, bucket) in enumerate(self.queue):
    1.97              yield ix, bucket, item
    1.98 -    
    1.99 +
   1.100      def _removeIx(self, ix):
   1.101          """Given an ix of an item provided by _enumerateItems or _findNext,
   1.102          remove the associated entry from the queue"""
   1.103          del self.queue[ix]
   1.104 -    
   1.105 -    # _get, from the original Queue implementation, is not used: see 
   1.106 +
   1.107 +    # _get, from the original Queue implementation, is not used: see
   1.108      # _findNext, _enumerateItems, and _removeIx for methods that perform
   1.109      # elements of the original task of _get.
   1.110      def _get(self):