summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBernard Ogden <bernie.ogden@linaro.org>2015-11-26 08:51:32 +0000
committerBernard Ogden <bernie.ogden@linaro.org>2015-11-26 08:51:32 +0000
commitb04ee29d3c0efe9d906ff33711bcdc5485a93f25 (patch)
tree52525426efc723b6043f0817484778c4fb2a00e8
parent00a22059fe66574167d496b65825380d477a1e9d (diff)
De-duplicate entries in placeholders
Will save some env var lookups when input contains multiple instances of same variable. Also cleaner if we later want to do something with that list of variables. Change-Id: If37b75abe7366dcf49426da34c10675d8ebab132
-rwxr-xr-xyaml-to-json.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/yaml-to-json.py b/yaml-to-json.py
index bd3e0ac..4da2eae 100755
--- a/yaml-to-json.py
+++ b/yaml-to-json.py
@@ -16,7 +16,7 @@ def main():
placeholders = map(lambda match: match.group('named', 'braced'),
string.Template.pattern.finditer(template.template))
- placeholders = filter(None, itertools.chain(*placeholders))
+ placeholders = set(filter(None, itertools.chain(*placeholders)))
# Pretend that missing environment variables are set to empty strings.
# It would be better to throw an error on missing environment variables,