summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAsk Solem <ask@celeryproject.org>2011-04-21 18:29:51 +0200
committerAsk Solem <ask@celeryproject.org>2011-04-21 18:29:51 +0200
commit1606cd96a00eb23cf4b1fd6c3b5cf7da0836abe3 (patch)
tree1bed9496b20b0cc8bd624c52d3177fe5c66fe5a0
parent976af54e9ec1d6f5715b38acd5440756e2944979 (diff)
downloadkombu-1606cd96a00eb23cf4b1fd6c3b5cf7da0836abe3.tar.gz
Use flake8 instead of pep8+pyflakes, and add it as a step in releaseok()v1.1.3
-rw-r--r--examples/simple_eventlet_receive.py1
-rw-r--r--examples/simple_eventlet_send.py2
-rw-r--r--funtests/setup.py4
-rw-r--r--funtests/tests/test_django.py2
-rw-r--r--funtests/tests/test_pika.py3
-rw-r--r--funtests/tests/test_sqla.py2
-rw-r--r--funtests/transport.py5
-rw-r--r--kombu/serialization.py2
-rw-r--r--kombu/tests/test_compression.py2
-rw-r--r--kombu/tests/test_connection.py11
-rw-r--r--kombu/tests/test_messaging.py1
-rw-r--r--kombu/tests/test_utils.py2
-rw-r--r--kombu/tests/utils.py2
-rw-r--r--kombu/transport/pyamqplib.py2
-rw-r--r--kombu/transport/pypika.py3
-rw-r--r--kombu/transport/pyredis.py4
-rw-r--r--kombu/utils/__init__.py5
-rw-r--r--kombu/utils/compat.py8
-rw-r--r--kombu/utils/eventio.py2
-rw-r--r--kombu/utils/functional.py6
-rw-r--r--pavement.py22
-rw-r--r--setup.py16
22 files changed, 53 insertions, 54 deletions
diff --git a/examples/simple_eventlet_receive.py b/examples/simple_eventlet_receive.py
index 2cf12f2e..0b10d7a6 100644
--- a/examples/simple_eventlet_receive.py
+++ b/examples/simple_eventlet_receive.py
@@ -27,7 +27,6 @@ def wait_many(timeout=1):
password="guest",
virtual_host="/")
-
#: SimpleQueue mimics the interface of the Python Queue module.
#: First argument can either be a queue name or a kombu.Queue object.
#: If a name, then the queue will be declared with the name as the queue
diff --git a/examples/simple_eventlet_send.py b/examples/simple_eventlet_send.py
index 43b60001..325a99cc 100644
--- a/examples/simple_eventlet_send.py
+++ b/examples/simple_eventlet_send.py
@@ -12,6 +12,7 @@ from kombu import BrokerConnection
eventlet.monkey_patch()
+
def send_many(n):
#: Create connection
@@ -23,7 +24,6 @@ def send_many(n):
password="guest",
virtual_host="/")
-
#: SimpleQueue mimics the interface of the Python Queue module.
#: First argument can either be a queue name or a kombu.Queue object.
#: If a name, then the queue will be declared with the name as the queue
diff --git a/funtests/setup.py b/funtests/setup.py
index fad62e04..66b26129 100644
--- a/funtests/setup.py
+++ b/funtests/setup.py
@@ -7,8 +7,8 @@ try:
except ImportError:
from ez_setup import use_setuptools
use_setuptools()
- from setuptools import setup
- from setuptools.command.install import install
+ from setuptools import setup # noqa
+ from setuptools.command.install import install # noqa
class no_install(install):
diff --git a/funtests/tests/test_django.py b/funtests/tests/test_django.py
index 8425032d..0c0a410d 100644
--- a/funtests/tests/test_django.py
+++ b/funtests/tests/test_django.py
@@ -15,7 +15,7 @@ class test_django(transport.TransportCase):
@redirect_stdouts
def setup_django(stdout, stderr):
try:
- import djkombu
+ import djkombu # noqa
except ImportError:
raise SkipTest("django-kombu not installed")
from django.conf import settings
diff --git a/funtests/tests/test_pika.py b/funtests/tests/test_pika.py
index 807df1c3..70a667d9 100644
--- a/funtests/tests/test_pika.py
+++ b/funtests/tests/test_pika.py
@@ -9,9 +9,10 @@ class test_pika_blocking(transport.TransportCase):
def test_produce__consume_large_messages(self, *args, **kwargs):
raise SkipTest("test currently fails for sync pika")
+
class test_pika_async(transport.TransportCase):
transport = "pika"
prefix = "pika"
-
+
def test_produce__consume_large_messages(self, *args, **kwargs):
raise SkipTest("test currently fails for async pika")
diff --git a/funtests/tests/test_sqla.py b/funtests/tests/test_sqla.py
index 79afbd8c..2a01a4a2 100644
--- a/funtests/tests/test_sqla.py
+++ b/funtests/tests/test_sqla.py
@@ -11,6 +11,6 @@ class test_sqla(transport.TransportCase):
def before_connect(self):
try:
- import sqlakombu
+ import sqlakombu # noqa
except ImportError:
raise SkipTest("kombu-sqlalchemy not installed")
diff --git a/funtests/transport.py b/funtests/transport.py
index bca28119..e741a155 100644
--- a/funtests/transport.py
+++ b/funtests/transport.py
@@ -16,7 +16,7 @@ from kombu.tests.utils import skip_if_quick
if sys.version_info >= (2, 5):
from hashlib import sha256 as _digest
else:
- from sha import new as _digest
+ from sha import new as _digest # noqa
def say(msg):
@@ -127,7 +127,7 @@ class TransportCase(unittest.TestCase):
if not self.verify_alive():
return
bytes = min(filter(None, [bytes, self.message_size_limit]))
- messages = ["".join(random.choice(charset)
+ messages = ["".join(random.choice(charset)
for j in xrange(bytes)) + "--%s" % n
for i in xrange(n)]
digests = []
@@ -227,7 +227,6 @@ class TransportCase(unittest.TestCase):
self.assertIsNone(_createref()())
-
def test_cyclic_reference_connection(self):
if not self.verify_alive():
return
diff --git a/kombu/serialization.py b/kombu/serialization.py
index c9d7efcd..00073476 100644
--- a/kombu/serialization.py
+++ b/kombu/serialization.py
@@ -15,7 +15,7 @@ import pickle as pypickle
try:
import cPickle as cpickle
except ImportError:
- cpickle = None
+ cpickle = None # noqa
if sys.platform.startswith("java"):
diff --git a/kombu/tests/test_compression.py b/kombu/tests/test_compression.py
index c5a1e801..0f6a66c5 100644
--- a/kombu/tests/test_compression.py
+++ b/kombu/tests/test_compression.py
@@ -8,7 +8,7 @@ class test_compression(unittest.TestCase):
def setUp(self):
try:
- import bz2
+ import bz2 # noqa
except ImportError:
self.has_bzip2 = False
else:
diff --git a/kombu/tests/test_connection.py b/kombu/tests/test_connection.py
index 34863eab..4ebd6185 100644
--- a/kombu/tests/test_connection.py
+++ b/kombu/tests/test_connection.py
@@ -97,20 +97,17 @@ class test_Connection(unittest.TestCase):
self.assertTupleEqual(conn.connection_errors, (KeyError, ValueError))
-class test_Connection_With_Broker_Args(unittest.TestCase):
+class test_Connection_with_transport_options(unittest.TestCase):
- _extra_args = {
- 'pool_recycle': 3600,
- 'echo': True
- }
+ transport_options = {"pool_recycler": 3600, "echo": True}
def setUp(self):
self.conn = BrokerConnection(port=5672, transport=Transport,
- transport_options=self._extra_args)
+ transport_options=self.transport_options)
def test_establish_connection(self):
conn = self.conn
- self.assertEqual(conn.transport_options, self._extra_args)
+ self.assertEqual(conn.transport_options, self.transport_options)
class ResourceCase(unittest.TestCase):
diff --git a/kombu/tests/test_messaging.py b/kombu/tests/test_messaging.py
index a721a0ff..de5be1dc 100644
--- a/kombu/tests/test_messaging.py
+++ b/kombu/tests/test_messaging.py
@@ -6,7 +6,6 @@ from kombu.connection import BrokerConnection
from kombu.exceptions import MessageStateError
from kombu.messaging import Consumer, Producer
from kombu.entity import Exchange, Queue
-from kombu.serialization import bytes_type
from kombu.tests.mocks import Transport
diff --git a/kombu/tests/test_utils.py b/kombu/tests/test_utils.py
index 2723b599..058e6d9a 100644
--- a/kombu/tests/test_utils.py
+++ b/kombu/tests/test_utils.py
@@ -5,7 +5,7 @@ from kombu.tests.utils import unittest
if sys.version_info >= (3, 0):
from io import StringIO, BytesIO
else:
- from StringIO import StringIO, StringIO as BytesIO
+ from StringIO import StringIO, StringIO as BytesIO # noqa
from kombu import utils
from kombu.utils.functional import wraps
diff --git a/kombu/tests/utils.py b/kombu/tests/utils.py
index cda7050d..545f51b2 100644
--- a/kombu/tests/utils.py
+++ b/kombu/tests/utils.py
@@ -13,7 +13,7 @@ try:
import unittest
unittest.skip
except AttributeError:
- import unittest2 as unittest
+ import unittest2 as unittest # noqa
def redirect_stdouts(fun):
diff --git a/kombu/transport/pyamqplib.py b/kombu/transport/pyamqplib.py
index d801c4c9..83c495b9 100644
--- a/kombu/transport/pyamqplib.py
+++ b/kombu/transport/pyamqplib.py
@@ -13,7 +13,7 @@ import socket
try:
from ssl import SSLError
except ImportError:
- class SSLError(Exception):
+ class SSLError(Exception): # noqa
pass
from amqplib import client_0_8 as amqp
diff --git a/kombu/transport/pypika.py b/kombu/transport/pypika.py
index 069d235b..5926409f 100644
--- a/kombu/transport/pypika.py
+++ b/kombu/transport/pypika.py
@@ -10,13 +10,12 @@ Pika transport.
"""
import socket
-import pika
+from pika import channel # must be here to raise importerror for below.
try:
from pika import asyncore_adapter
except ImportError:
raise ImportError("Kombu only works with pika version 0.5.2")
from pika import blocking_adapter
-from pika import channel
from pika import connection
from pika import exceptions
from pika.spec import Basic, BasicProperties
diff --git a/kombu/transport/pyredis.py b/kombu/transport/pyredis.py
index f1a1b4ed..7e0bd42c 100644
--- a/kombu/transport/pyredis.py
+++ b/kombu/transport/pyredis.py
@@ -330,7 +330,7 @@ class Channel(virtual.Channel):
def client(self):
return self._create_client()
- @client.deleter
+ @client.deleter # noqa
def client(self, client):
client.connection.disconnect()
@@ -338,7 +338,7 @@ class Channel(virtual.Channel):
def subclient(self):
return self._create_client()
- @subclient.deleter
+ @subclient.deleter # noqa
def subclient(self, client):
client.connection.disconnect()
diff --git a/kombu/utils/__init__.py b/kombu/utils/__init__.py
index 6a4b0ed1..85822a6d 100644
--- a/kombu/utils/__init__.py
+++ b/kombu/utils/__init__.py
@@ -6,7 +6,7 @@ from uuid import UUID, uuid4 as _uuid4, _uuid_generate_random
try:
import ctypes
except ImportError:
- ctypes = None
+ ctypes = None # noqa
def say(m, *s):
@@ -32,10 +32,11 @@ def gen_unique_id():
if sys.version_info >= (3, 0):
+
def kwdict(kwargs):
return kwargs
else:
- def kwdict(kwargs):
+ def kwdict(kwargs): # noqa
"""Make sure keyword arguments are not in unicode.
This should be fixed in newer Python versions,
diff --git a/kombu/utils/compat.py b/kombu/utils/compat.py
index 439de81b..4bd2386e 100644
--- a/kombu/utils/compat.py
+++ b/kombu/utils/compat.py
@@ -6,7 +6,7 @@ try:
all([True])
all = all
except NameError:
- def all(iterable):
+ def all(iterable): # noqa
for item in iterable:
if not item:
return False
@@ -18,7 +18,7 @@ try:
any([True])
any = any
except NameError:
- def any(iterable):
+ def any(iterable): # noqa
for item in iterable:
if item:
return True
@@ -30,7 +30,7 @@ import weakref
try:
from collections import MutableMapping
except ImportError:
- from UserDict import DictMixin as MutableMapping
+ from UserDict import DictMixin as MutableMapping # noqa
from itertools import imap as _imap
from operator import eq as _eq
@@ -244,7 +244,7 @@ class CompatOrderedDict(dict, MutableMapping):
try:
from collections import OrderedDict
except ImportError:
- OrderedDict = CompatOrderedDict
+ OrderedDict = CompatOrderedDict # noqa
############## queue.LifoQueue ##############################################
from Queue import Queue
diff --git a/kombu/utils/eventio.py b/kombu/utils/eventio.py
index baa5a318..e8b41d58 100644
--- a/kombu/utils/eventio.py
+++ b/kombu/utils/eventio.py
@@ -4,7 +4,7 @@ import socket
try:
from eventlet.patcher import is_monkey_patched as is_eventlet
except ImportError:
- is_eventlet = lambda module: False
+ is_eventlet = lambda module: False # noqa
POLL_READ = 0x001
POLL_ERR = 0x008 | 0x010 | 0x2000
diff --git a/kombu/utils/functional.py b/kombu/utils/functional.py
index 85908944..ad5da24e 100644
--- a/kombu/utils/functional.py
+++ b/kombu/utils/functional.py
@@ -79,7 +79,7 @@ def _compat_partial(fun, *args, **kwargs):
try:
from functools import partial
except ImportError:
- partial = _compat_partial
+ partial = _compat_partial # noqa
WRAPPER_ASSIGNMENTS = ('__module__', '__name__', '__doc__')
WRAPPER_UPDATES = ('__dict__',)
@@ -112,7 +112,7 @@ def _compat_update_wrapper(wrapper, wrapped, assigned=WRAPPER_ASSIGNMENTS,
try:
from functools import update_wrapper
except ImportError:
- update_wrapper = _compat_update_wrapper
+ update_wrapper = _compat_update_wrapper # noqa
def _compat_wraps(wrapped, assigned=WRAPPER_ASSIGNMENTS,
@@ -132,6 +132,6 @@ def _compat_wraps(wrapped, assigned=WRAPPER_ASSIGNMENTS,
try:
from functools import wraps
except ImportError:
- wraps = _compat_wraps
+ wraps = _compat_wraps # noqa
### End from Python 2.5 functools.py ##########################################
diff --git a/pavement.py b/pavement.py
index d658e631..e00dda79 100644
--- a/pavement.py
+++ b/pavement.py
@@ -1,6 +1,6 @@
-from paver.easy import *
-from paver import doctools
-from paver.setuputils import setup
+from paver.easy import * # noqa
+from paver import doctools # noqa
+from paver.setuputils import setup # noqa
options(
sphinx=Bunch(builddir=".build"),
@@ -113,6 +113,20 @@ def test(options):
@cmdopts([
("noerror", "E", "Ignore errors"),
])
+def flake8(options):
+ noerror = getattr(options, "noerror", False)
+ complexity = getattr(options, "complexity", 22)
+ sh("""flake8 . | perl -mstrict -mwarnings -nle'
+ my $ignore = m/too complex \((\d+)\)/ && $1 le %s;
+ if (! $ignore) { print STDERR; our $FOUND_FLAKE = 1 }
+ }{exit $FOUND_FLAKE;
+ '""" % (complexity, ), ignore_error=noerror)
+
+
+@task
+@cmdopts([
+ ("noerror", "E", "Ignore errors"),
+])
def pep8(options):
noerror = getattr(options, "noerror", False)
return sh("""find kombu -name "*.py" | xargs pep8 | perl -nle'\
@@ -137,7 +151,7 @@ def gitcleanforce(options):
@task
-@needs("pep8", "autodoc", "verifyindex", "test", "gitclean")
+@needs("flake8", "autodoc", "verifyindex", "test", "gitclean")
def releaseok(options):
pass
diff --git a/setup.py b/setup.py
index e38e25e5..070c386b 100644
--- a/setup.py
+++ b/setup.py
@@ -18,12 +18,10 @@ if sys.version_info < (2, 4):
raise Exception("Kombu requires Python 2.4 or higher.")
try:
- from setuptools import setup, Extension, Feature, find_packages
+ from setuptools import setup
except ImportError:
- from distutils.core import setup, Extension, find_packages
- Feature = None
+ from distutils.core import setup # noqa
-from distutils.command.install_data import install_data
from distutils.command.install import INSTALL_SCHEMES
os.environ["KOMBU_NO_EVAL"] = "yes"
@@ -38,13 +36,6 @@ if root_dir != '':
src_dir = "kombu"
-def osx_install_data(install_data):
-
- def finalize_options(self):
- self.set_undefined_options("install", ("install_lib", "install_dir"))
- install_data.finalize_options(self)
-
-
def fullsplit(path, result=None):
if result is None:
result = []
@@ -111,5 +102,4 @@ setup(
"Topic :: Software Development :: Libraries :: Python Modules",
],
long_description=long_description,
- **extra
-)
+ **extra)