aboutsummaryrefslogtreecommitdiff
path: root/mammoth/lists.py
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2015-12-06 12:32:27 +0000
committerMichael Williamson <mike@zwobble.org>2015-12-06 12:32:59 +0000
commite315a8360b5a312b9b692408473d942de94557d1 (patch)
tree2e71949fb3ad7d33b5a9e1cb60655e0d47246654 /mammoth/lists.py
parent323aaa3aa2bcc03c9c46b173f33b9cdfac205e74 (diff)
Ensure Result.messages is always unique
Diffstat (limited to 'mammoth/lists.py')
-rw-r--r--mammoth/lists.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/mammoth/lists.py b/mammoth/lists.py
index cf39b99..6e39ae0 100644
--- a/mammoth/lists.py
+++ b/mammoth/lists.py
@@ -14,6 +14,15 @@ def _collect(values, result):
elif value is not None:
result.append(value)
+def unique(values):
+ output = []
+ seen = set()
+ for value in values:
+ if value not in seen:
+ seen.add(value)
+ output.append(value)
+ return output
+
if sys.version_info[0] == 2:
map = map