Changeset 52565 for vendor

Show
Ignore:
Timestamp:
02/15/08 01:03:22 (8 months ago)
Author:
rspivak
Message:

Removed trailing whitespaces

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • vendor/zasync/branches/1.1-nux/bucketqueue.py

    r31431 r52565  
    1616 
    1717class BucketQueue(Queue): 
    18     """A queue that only allows a single item from a given bucket to be  
    19     obtained at a time.  Within a bucket, order is guaranteed.  Between  
     18    """A queue that only allows a single item from a given bucket to be 
     19    obtained at a time.  Within a bucket, order is guaranteed.  Between 
    2020    unblocked buckets, order is also honored. 
    2121    """ 
     
    3636        finally: 
    3737            self.mutex.release() 
    38      
     38 
    3939    def available(self, id=None): 
    40         """Return True if there is currently an item available for this  
     40        """Return True if there is currently an item available for this 
    4141        particular thread""" 
    4242        if id is None: 
     
    4747        finally: 
    4848            self.mutex.release() 
    49      
     49 
    5050    def makeBucket(self, name, silent=False): 
    5151        if name is None: 
     
    6969        """ 
    7070        if bucket is not None and self._bucketsema.get(bucket) is None: 
    71             raise ValueError("bucket does not exist; create with makeBucket",  
     71            raise ValueError("bucket does not exist; create with makeBucket", 
    7272                             bucket) 
    7373        if block: 
     
    124124        """ 
    125125        return self.put(item, False, bucket=bucket) 
    126      
     126 
    127127    def releaseBucketByThreadId(self, id): 
    128128        return self._releaseBucket(id=id) 
    129     
     129 
    130130    def releaseBucket(self, bucket=None): 
    131131        """Release bucket.  If bucket is None, release the bucket for this 
    132132        thread, if any.""" 
    133133        return self._releaseBucket(bucket) 
    134     
     134 
    135135    def _releaseBucket(self, bucket=None, id=None): 
    136136        self.mutex.acquire() 
     
    221221            self.mutex.release() 
    222222        return item 
    223      
     223 
    224224    # Override if desired (but others are more useful, below).  These are 
    225225    # only called with the appropriate locks held. 
    226      
     226 
    227227    def _findNext(self, current=None): 
    228228        """return ix, bucket lock, and item of next open, where ix is the value 
    229         that _removeIx needs to remove the item from the queue.  Raise  
     229        that _removeIx needs to remove the item from the queue.  Raise 
    230230        LookupError if no next item is available.""" 
    231231        buckets = sets.Set() 
     
    239239                buckets.add(bucket) 
    240240        raise LookupError("No next value available") 
    241      
     241 
    242242    def _primed(self, current=None): 
    243243        try: 
     
    253253    def _enumerateItems(self): 
    254254        """enumerate ix, bucket name, and item of each item in the queue in 
    255         preferred order (defaults to FIFO).  ix is whatever value that  
     255        preferred order (defaults to FIFO).  ix is whatever value that 
    256256        _removeIx needs to remove the item from the queue.""" 
    257257        for ix, (item, bucket) in enumerate(self.queue): 
    258258            yield ix, bucket, item 
    259      
     259 
    260260    def _removeIx(self, ix): 
    261261        """Given an ix of an item provided by _enumerateItems or _findNext, 
    262262        remove the associated entry from the queue""" 
    263263        del self.queue[ix] 
    264      
    265     # _get, from the original Queue implementation, is not used: see  
     264 
     265    # _get, from the original Queue implementation, is not used: see 
    266266    # _findNext, _enumerateItems, and _removeIx for methods that perform 
    267267    # elements of the original task of _get.