From f5aeb88561baab27df10caf1f3c082bd743c7976 Mon Sep 17 00:00:00 2001 From: Ask Solem Date: Wed, 10 Nov 2010 12:28:27 +0100 Subject: [PATCH] Added kombu.utils.all() and .any() for Python 2.4 --- kombu/utils/compat.py | 24 ++++++++++++++++++++++++ setup.cfg | 1 - 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/kombu/utils/compat.py b/kombu/utils/compat.py index e94ef508..703ad959 100644 --- a/kombu/utils/compat.py +++ b/kombu/utils/compat.py @@ -1,3 +1,27 @@ +############## __builtin__.all ############################################## + +try: + all([True]) + all = all +except NameError: + def all(iterable): + for item in iterable: + if not item: + return False + return True + +############## __builtin__.any ############################################## + +try: + any([True]) + any = any +except NameError: + def any(iterable): + for item in iterable: + if item: + return True + return False + ############## collections.OrderedDict ####################################### import weakref diff --git a/setup.cfg b/setup.cfg index 1e2a55ee..a0253525 100644 --- a/setup.cfg +++ b/setup.cfg @@ -14,7 +14,6 @@ cover3-exclude = kombu kombu.transport.pycouchdb kombu.transport.mongodb kombu.transport.beanstalk - kombu.pidbox kombu.compat [build_sphinx]