From c895bfc842095f487ac1ee18c36945a4f6900a63 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Karl=20Hasselstr=C3=B6m?= Date: Tue, 11 Sep 2007 03:34:08 +0200 Subject: [PATCH] Add the any() and all() utility functions from Python 2.5 MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Karl Hasselström --- stgit/utils.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/stgit/utils.py b/stgit/utils.py index 02e98e9..34c0f96 100644 --- a/stgit/utils.py +++ b/stgit/utils.py @@ -214,3 +214,18 @@ def make_patch_name(msg, unacceptable, default_name = 'patch'): suffix += 1 patchname = '%s-%d' % (patchname, suffix) return patchname + +# any and all functions are builtin in Python 2.5 and higher, but not +# in 2.4. +if not 'any' in dir(__builtins__): + def any(bools): + for b in bools: + if b: + return True + return False +if not 'all' in dir(__builtins__): + def all(bools): + for b in bools: + if not b: + return False + return True -- 2.11.0