Permalink
Browse files

[kombu3] No longer supports Python 2.5

  • Loading branch information...
ask committed Nov 8, 2012
1 parent 3405974 commit 7f9b38ff8bd59540f5304fbe391fd0987b48c805
Showing with 85 additions and 254 deletions.
  1. +0 −3 examples/complete_receive.py
  2. +0 −2 examples/complete_send.py
  3. +0 −2 examples/simple_eventlet_receive.py
  4. +0 −2 examples/simple_eventlet_send.py
  5. +0 −3 examples/simple_receive.py
  6. +0 −2 examples/simple_send.py
  7. +0 −2 examples/simple_task_queue/client.py
  8. +1 −3 examples/simple_task_queue/worker.py
  9. +1 −2 extra/release/bump_version.py
  10. +0 −126 extra/release/flakeplus.py
  11. +1 −1 funtests/transport.py
  12. +0 −1 kombu/clocks.py
  13. +0 −1 kombu/common.py
  14. +3 −4 kombu/connection.py
  15. +1 −1 kombu/messaging.py
  16. +0 −1 kombu/mixins.py
  17. +1 −2 kombu/pidbox.py
  18. +0 −1 kombu/tests/test_common.py
  19. +0 −1 kombu/tests/test_compat.py
  20. +0 −1 kombu/tests/test_connection.py
  21. +0 −1 kombu/tests/test_entities.py
  22. +0 −1 kombu/tests/test_messaging.py
  23. +0 −1 kombu/tests/test_pidbox.py
  24. +1 −1 kombu/tests/test_pools.py
  25. +0 −1 kombu/tests/test_serialization.py
  26. +0 −1 kombu/tests/test_simple.py
  27. +0 −1 kombu/tests/transport/test_base.py
  28. +0 −1 kombu/tests/transport/test_filesystem.py
  29. +0 −1 kombu/tests/transport/test_memory.py
  30. +0 −1 kombu/tests/transport/test_redis.py
  31. +0 −1 kombu/tests/transport/test_sqlalchemy.py
  32. +0 −1 kombu/tests/transport/test_transport.py
  33. +1 −2 kombu/tests/transport/virtual/test_base.py
  34. +0 −1 kombu/tests/transport/virtual/test_exchange.py
  35. +0 −1 kombu/tests/transport/virtual/test_scheduling.py
  36. +0 −1 kombu/tests/utilities/test_encoding.py
  37. +1 −1 kombu/transport/SQS.py
  38. +3 −3 kombu/transport/amqplib.py
  39. +2 −2 kombu/transport/base.py
  40. +1 −1 kombu/transport/mongodb.py
  41. +0 −1 kombu/transport/redis.py
  42. +1 −1 kombu/transport/virtual/__init__.py
  43. +6 −6 kombu/transport/zmq.py
  44. +3 −3 kombu/utils/__init__.py
  45. +2 −2 kombu/utils/encoding.py
  46. +3 −3 kombu/utils/eventio.py
  47. +53 −53 pavement.py
@@ -2,9 +2,6 @@
Example of simple consumer that waits for a single message, acknowledges it
and exits.
"""
-
-from __future__ import with_statement
-
from kombu import Connection, Exchange, Queue, Consumer, eventloop
from pprint import pformat
@@ -5,8 +5,6 @@
You can use `complete_receive.py` to receive the message sent.
"""
-from __future__ import with_statement
-
from kombu import Connection, Producer, Exchange, Queue
#: By default messages sent to exchanges are persistent (delivery_mode=2),
@@ -6,8 +6,6 @@
message sent.
"""
-from __future__ import with_statement
-
import eventlet
from Queue import Empty
@@ -6,8 +6,6 @@
message sent.
"""
-from __future__ import with_statement
-
import eventlet
from kombu import Connection
@@ -1,9 +1,6 @@
"""
Example receiving a message using the SimpleQueue interface.
"""
-
-from __future__ import with_statement
-
from kombu import Connection
#: Create connection
View
@@ -6,8 +6,6 @@
message sent.
"""
-from __future__ import with_statement
-
from kombu import Connection
#: Create connection
@@ -1,5 +1,3 @@
-from __future__ import with_statement
-
from kombu.common import maybe_declare
from kombu.pools import producers
@@ -1,5 +1,3 @@
-from __future__ import with_statement
-
from kombu.mixins import ConsumerMixin
from kombu.log import get_logger
from kombu.utils import kwdict, reprcall
@@ -25,7 +23,7 @@ def process_task(self, body, message):
logger.info('Got task: %s', reprcall(fun.__name__, args, kwargs))
try:
fun(*args, **kwdict(kwargs))
- except Exception, exc:
+ except Exception as exc:
logger.error('task raised exception: %r', exc)
message.ack()
@@ -1,7 +1,6 @@
#!/usr/bin/env python
from __future__ import absolute_import
-from __future__ import with_statement
import errno
import os
@@ -23,7 +22,7 @@ def cmd(*args):
def no_enoent():
try:
yield
- except OSError, exc:
+ except OSError as exc:
if exc.errno != errno.ENOENT:
raise
View
@@ -1,126 +0,0 @@
-#!/usr/bin/env python
-from __future__ import absolute_import
-from __future__ import with_statement
-
-import os
-import re
-import sys
-
-from collections import defaultdict
-from unipath import Path
-
-RE_COMMENT = r'^\s*\#'
-RE_NOQA = r'.+?\#\s+noqa+'
-RE_MULTILINE_COMMENT_O = r'^\s*(?:\'\'\'|""").+?(?:\'\'\'|""")'
-RE_MULTILINE_COMMENT_S = r'^\s*(?:\'\'\'|""")'
-RE_MULTILINE_COMMENT_E = r'(?:^|.+?)(?:\'\'\'|""")'
-RE_WITH = r'(?:^|\s+)with\s+'
-RE_WITH_IMPORT = r'''from\s+ __future__\s+ import\s+ with_statement'''
-RE_PRINT = r'''(?:^|\s+)print\((?:"|')(?:\W+?)?[A-Z0-9:]{2,}'''
-RE_ABS_IMPORT = r'''from\s+ __future__\s+ import\s+ absolute_import'''
-
-acc = defaultdict(lambda: {"abs": False, "print": False})
-
-
-def compile(regex):
- return re.compile(regex, re.VERBOSE)
-
-
-class FlakePP(object):
- re_comment = compile(RE_COMMENT)
- re_ml_comment_o = compile(RE_MULTILINE_COMMENT_O)
- re_ml_comment_s = compile(RE_MULTILINE_COMMENT_S)
- re_ml_comment_e = compile(RE_MULTILINE_COMMENT_E)
- re_abs_import = compile(RE_ABS_IMPORT)
- re_print = compile(RE_PRINT)
- re_with_import = compile(RE_WITH_IMPORT)
- re_with = compile(RE_WITH)
- re_noqa = compile(RE_NOQA)
- map = {"abs": True, "print": False,
- "with": False, "with-used": False}
-
- def __init__(self, verbose=False):
- self.verbose = verbose
- self.steps = (("abs", self.re_abs_import),
- ("with", self.re_with_import),
- ("with-used", self.re_with),
- ("print", self.re_print))
-
- def analyze_fh(self, fh):
- steps = self.steps
- filename = fh.name
- acc = dict(self.map)
- index = 0
- errors = [0]
-
- def error(fmt, **kwargs):
- errors[0] += 1
- self.announce(fmt, **dict(kwargs, filename=filename))
-
- for index, line in enumerate(self.strip_comments(fh)):
- for key, pattern in steps:
- if pattern.match(line):
- acc[key] = True
- if index:
- if not acc["abs"]:
- error("%(filename)s: missing abs import")
- if acc["with-used"] and not acc["with"]:
- error("%(filename)s: missing with import")
- if acc["print"]:
- error("%(filename)s: left over print statement")
-
- return filename, errors[0], acc
-
- def analyze_file(self, filename):
- with open(filename) as fh:
- return self.analyze_fh(fh)
-
- def analyze_tree(self, dir):
- for dirpath, _, filenames in os.walk(dir):
- for path in (Path(dirpath, f) for f in filenames):
- if path.endswith(".py"):
- yield self.analyze_file(path)
-
- def analyze(self, *paths):
- for path in map(Path, paths):
- if path.isdir():
- for res in self.analyze_tree(path):
- yield res
- else:
- yield self.analyze_file(path)
-
- def strip_comments(self, fh):
- re_comment = self.re_comment
- re_ml_comment_o = self.re_ml_comment_o
- re_ml_comment_s = self.re_ml_comment_s
- re_ml_comment_e = self.re_ml_comment_e
- re_noqa = self.re_noqa
- in_ml = False
-
- for line in fh.readlines():
- if in_ml:
- if re_ml_comment_e.match(line):
- in_ml = False
- else:
- if re_noqa.match(line) or re_ml_comment_o.match(line):
- pass
- elif re_ml_comment_s.match(line):
- in_ml = True
- elif re_comment.match(line):
- pass
- else:
- yield line
-
- def announce(self, fmt, **kwargs):
- sys.stderr.write((fmt + "\n") % kwargs)
-
-
-def main(argv=sys.argv, exitcode=0):
- for _, errors, _ in FlakePP(verbose=True).analyze(*argv[1:]):
- if errors:
- exitcode = 1
- return exitcode
-
-
-if __name__ == "__main__":
- sys.exit(main())
View
@@ -79,7 +79,7 @@ def setUp(self):
if self.transport:
try:
self.before_connect()
- except SkipTest, exc:
+ except SkipTest as exc:
self.skip_test_reason = str(exc)
else:
self.do_connect()
View
@@ -9,7 +9,6 @@
"""
from __future__ import absolute_import
-from __future__ import with_statement
import threading
View
@@ -9,7 +9,6 @@
"""
from __future__ import absolute_import
-from __future__ import with_statement
import os
import socket
View
@@ -9,7 +9,6 @@
"""
from __future__ import absolute_import
-from __future__ import with_statement
import errno
import os
@@ -287,7 +286,7 @@ def drain_nowait(self, *args, **kwargs):
except socket.timeout:
self.more_to_read = False
return False
- except socket.error, exc:
+ except socket.error as exc:
if exc.errno in (errno.EAGAIN, errno.EINTR):
self.more_to_read = False
return False
@@ -423,7 +422,7 @@ def _ensured(*args, **kwargs):
for retries in count(0): # for infinity
try:
return fun(*args, **kwargs)
- except self.connection_errors, exc:
+ except self.connection_errors as exc:
if got_connection:
raise
if max_retries is not None and retries > max_retries:
@@ -446,7 +445,7 @@ def _ensured(*args, **kwargs):
if on_revive:
on_revive(new_channel)
got_connection += 1
- except self.channel_errors, exc:
+ except self.channel_errors as exc:
if max_retries is not None and retries > max_retries:
raise
self._debug('ensure channel error: %r', exc, exc_info=1)
View
@@ -499,7 +499,7 @@ def _receive_callback(self, message):
if m2p:
message = m2p(message)
decoded = None if on_m else message.decode()
- except Exception, exc:
+ except Exception as exc:
if not self.on_decode_error:
raise
self.on_decode_error(message, exc)
View
@@ -9,7 +9,6 @@
"""
from __future__ import absolute_import
-from __future__ import with_statement
import socket
View
@@ -9,7 +9,6 @@
"""
from __future__ import absolute_import
-from __future__ import with_statement
import socket
@@ -83,7 +82,7 @@ def dispatch(self, method, arguments=None, reply_to=None, ticket=None,
reply = handle(method, kwdict(arguments))
except SystemExit:
raise
- except Exception, exc:
+ except Exception as exc:
reply = {'error': repr(exc)}
if reply_to:
@@ -1,5 +1,4 @@
from __future__ import absolute_import
-from __future__ import with_statement
import socket
@@ -1,5 +1,4 @@
from __future__ import absolute_import
-from __future__ import with_statement
from mock import patch
@@ -1,5 +1,4 @@
from __future__ import absolute_import
-from __future__ import with_statement
import pickle
@@ -1,5 +1,4 @@
from __future__ import absolute_import
-from __future__ import with_statement
from kombu import Connection
from kombu.entity import Exchange, Queue
@@ -1,5 +1,4 @@
from __future__ import absolute_import
-from __future__ import with_statement
import anyjson
@@ -1,5 +1,4 @@
from __future__ import absolute_import
-from __future__ import with_statement
import socket
@@ -1,4 +1,4 @@
-from __future__ import with_statement
+from __future__ import absolute_import
from kombu import Connection
from kombu import pools
@@ -1,7 +1,6 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
-from __future__ import with_statement
import sys
@@ -1,5 +1,4 @@
from __future__ import absolute_import
-from __future__ import with_statement
from Queue import Empty
@@ -1,5 +1,4 @@
from __future__ import absolute_import
-from __future__ import with_statement
from kombu import Connection, Consumer, Producer, Queue
from kombu.transport.base import Message, StdChannel, Transport
@@ -1,5 +1,4 @@
from __future__ import absolute_import
-from __future__ import with_statement
import tempfile
@@ -1,5 +1,4 @@
from __future__ import absolute_import
-from __future__ import with_statement
import socket
@@ -1,5 +1,4 @@
from __future__ import absolute_import
-from __future__ import with_statement
import socket
import types
Oops, something went wrong.

0 comments on commit 7f9b38f

Please sign in to comment.