From 90f6ed26889de12c7c96833d6a2a99c7ffc54fc6 Mon Sep 17 00:00:00 2001 From: Brad Warren Date: Thu, 31 Mar 2016 20:19:14 -0700 Subject: [PATCH] Use sets to prevent duplicates --- letsencrypt/cli.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/letsencrypt/cli.py b/letsencrypt/cli.py index 1a28848ac..d2bcce00b 100644 --- a/letsencrypt/cli.py +++ b/letsencrypt/cli.py @@ -97,11 +97,12 @@ ZERO_ARG_ACTIONS = set(("store_const", "store_true", "store_false", "append_const", "count",)) -# Maps a config option to a list of config options that may have modified it. +# Maps a config option to a set of config options that may have modified it. # This dictionary is used recursively, so if A modifies B and B modifies C, # it is determined that C was modified by the user if A was modified. -VAR_MODIFIERS = {"account": ["server"], "server": ["dry_run", "staging"], - "webroot_map": ["webroot_path"]} +VAR_MODIFIERS = {"account": set(("server",)), + "server": set(("dry_run", "staging",)), + "webroot_map": set(("webroot_path",))} def report_config_interaction(modified, modifiers): @@ -117,12 +118,12 @@ def report_config_interaction(modified, modifiers): """ if isinstance(modified, str): - modified = [modified] + modified = (modified,) if isinstance(modifiers, str): - modifiers = [modifiers] + modifiers = (modifiers,) for var in modified: - VAR_MODIFIERS.setdefault(var, []).extend(modifiers) + VAR_MODIFIERS.setdefault(var, set()).update(modifiers) def usage_strings(plugins):