← Back to team overview

dulwich-users team mailing list archive

[PATCH 33/34] _compat: Add implementation of all().

 

From: Dave Borowitz <dborowitz@xxxxxxxxxx>

Change-Id: I40b5bf95c2ae08776a1a7383be4025e2628d65ba
---
 dulwich/_compat.py |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/dulwich/_compat.py b/dulwich/_compat.py
index 9d861b7..86bac8d 100644
--- a/dulwich/_compat.py
+++ b/dulwich/_compat.py
@@ -137,6 +137,20 @@ except ImportError:
 
 
 try:
+    all = all
+except NameError:
+    # Implementation of permutations from Python 2.6 documentation:
+    # http://docs.python.org/2.6/library/functions.html#all
+    # Copyright (c) 2001-2010 Python Software Foundation; All Rights Reserved
+    # Licensed under the Python Software Foundation License.
+    def all(iterable):
+        for element in iterable:
+            if not element:
+                return False
+        return True
+
+
+try:
     from collections import namedtuple
 except ImportError:
     # Recipe for namedtuple from http://code.activestate.com/recipes/500261/
-- 
1.7.3.1



References