summaryrefslogtreecommitdiff
path: root/mammoth/lists.py
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2013-12-01 20:47:05 +0000
committerMichael Williamson <mike@zwobble.org>2013-12-01 20:47:05 +0000
commit4d26fc0b174beccd0129220de74fe0b44c6c7edf (patch)
tree97633a4d0198e64c9ee9522825efcbef4d3a63a4 /mammoth/lists.py
parentb167af309185c04815c07271b7f8ed8db1d485db (diff)
Add support for w:ins
Diffstat (limited to 'mammoth/lists.py')
-rw-r--r--mammoth/lists.py20
1 files changed, 12 insertions, 8 deletions
diff --git a/mammoth/lists.py b/mammoth/lists.py
index 24fa7c4..a1e188e 100644
--- a/mammoth/lists.py
+++ b/mammoth/lists.py
@@ -1,11 +1,15 @@
import sys
-__all__ = ["filter"]
-
-if sys.version_info[0] == 2:
- filter = filter
-else:
- import builtins
- def filter(*args, **kwargs):
- return list(builtins.filter(*args, **kwargs))
+def collect(values):
+ result = []
+ _collect(values, result)
+ return result
+
+
+def _collect(values, result):
+ for value in values:
+ if isinstance(value, list):
+ _collect(value, result)
+ elif value is not None:
+ result.append(value)