PEP8ify + pyflakes

This commit is contained in:
Ask Solem 2010-07-22 16:18:49 +02:00
parent 5bad838982
commit c6e033bc76
3 changed files with 7 additions and 10 deletions

View File

@ -1,7 +1,3 @@
import weakref
import functools
import itertools
from pika import asyncore_adapter from pika import asyncore_adapter
from pika import blocking_adapter from pika import blocking_adapter
from pika import channel from pika import channel

View File

@ -4,7 +4,7 @@ from kombu import entity
from kombu import messaging from kombu import messaging
def iterconsume(connection, consumer): def iterconsume(connection, consumer, no_ack=False, limit=None):
consumer.consume(no_ack=no_ack) consumer.consume(no_ack=no_ack)
for iteration in count(0): for iteration in count(0):
if limit and iteration >= limit: if limit and iteration >= limit:
@ -161,7 +161,7 @@ class Consumer(messaging.Consumer):
return self.purge() return self.purge()
def iterconsume(self, limit=None, no_ack=None): def iterconsume(self, limit=None, no_ack=None):
return iterconsume(self.connection, self) return iterconsume(self.connection, self, no_ack, limit)
def wait(self, limit=None): def wait(self, limit=None):
it = self.iterconsume(limit) it = self.iterconsume(limit)
@ -175,6 +175,7 @@ class Consumer(messaging.Consumer):
raise StopIteration raise StopIteration
yield item yield item
class _CSet(messaging.Consumer): class _CSet(messaging.Consumer):
def __init__(self, connection, *args, **kwargs): def __init__(self, connection, *args, **kwargs):
@ -182,8 +183,8 @@ class _CSet(messaging.Consumer):
self.backend = connection.channel() self.backend = connection.channel()
super(_CSet, self).__init__(self.backend, *args, **kwargs) super(_CSet, self).__init__(self.backend, *args, **kwargs)
def iterconsume(self): def iterconsume(self, limit=None, no_ack=False):
return iterconsume(self.connection, self) return iterconsume(self.connection, self, no_ack, limit)
def discard_all(self): def discard_all(self):
return self.purge() return self.purge()
@ -204,7 +205,8 @@ def ConsumerSet(connection, from_dict=None, consumers=None,
bindings = [] bindings = []
if consumers: if consumers:
map(bindings.extend, consumer.bindings) for consumer in consumers:
map(bindings.extend, consumer.bindings)
if from_dict: if from_dict:
for queue_name, queue_options in from_dict.items(): for queue_name, queue_options in from_dict.items():
bindings.append(entry_to_binding(queue_name, **queue_options)) bindings.append(entry_to_binding(queue_name, **queue_options))

View File

@ -68,7 +68,6 @@ class Producer(object):
immediate) immediate)
class Consumer(object): class Consumer(object):
no_ack = False no_ack = False
auto_declare = True auto_declare = True