[StGit PATCH 2/7] Add the any() and all() utility functions from Python 2.5

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Catalin Marinas <catalin.marinas@...>
Cc: <git@...>, Karl <kha@...>
Date: Tuesday, September 11, 2007 - 12:50 am

Signed-off-by: Karl Hasselström <kha@treskal.com>

---

 stgit/utils.py |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)


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

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[StGit PATCH 0/7] Assorted enhancements, Karl , (Tue Sep 11, 12:49 am)
[StGit PATCH 2/7] Add the any() and all() utility functions ..., Karl , (Tue Sep 11, 12:50 am)