mirror of
https://github.com/certbot/certbot.git
synced 2026-06-05 06:42:10 -04:00
fix itervalues usage
This commit is contained in:
parent
63b903f67d
commit
c3555c159b
6 changed files with 11 additions and 11 deletions
|
|
@ -101,7 +101,7 @@ class AccountMemoryStorage(interfaces.AccountStorage):
|
|||
self.accounts = initial_accounts if initial_accounts is not None else {}
|
||||
|
||||
def find_all(self):
|
||||
return list(six.itervalues(self.accounts))
|
||||
return list(self.accounts.values())
|
||||
|
||||
def save(self, account, client):
|
||||
if account.id in self.accounts:
|
||||
|
|
|
|||
|
|
@ -276,7 +276,7 @@ class PluginsRegistry(Mapping):
|
|||
def init(self, config):
|
||||
"""Initialize all plugins in the registry."""
|
||||
return [plugin_ep.init(config) for plugin_ep
|
||||
in six.itervalues(self._plugins)]
|
||||
in self._plugins.values()]
|
||||
|
||||
def filter(self, pred):
|
||||
"""Filter plugins based on predicate."""
|
||||
|
|
@ -297,7 +297,7 @@ class PluginsRegistry(Mapping):
|
|||
|
||||
def prepare(self):
|
||||
"""Prepare all plugins in the registry."""
|
||||
return [plugin_ep.prepare() for plugin_ep in six.itervalues(self._plugins)]
|
||||
return [plugin_ep.prepare() for plugin_ep in self._plugins.values()]
|
||||
|
||||
def available(self):
|
||||
"""Filter plugins based on availability."""
|
||||
|
|
@ -319,7 +319,7 @@ class PluginsRegistry(Mapping):
|
|||
|
||||
"""
|
||||
# use list instead of set because PluginEntryPoint is not hashable
|
||||
candidates = [plugin_ep for plugin_ep in six.itervalues(self._plugins)
|
||||
candidates = [plugin_ep for plugin_ep in self._plugins.values()
|
||||
if plugin_ep.initialized and plugin_ep.init() is plugin]
|
||||
assert len(candidates) <= 1
|
||||
if candidates:
|
||||
|
|
@ -329,9 +329,9 @@ class PluginsRegistry(Mapping):
|
|||
def __repr__(self):
|
||||
return "{0}({1})".format(
|
||||
self.__class__.__name__, ','.join(
|
||||
repr(p_ep) for p_ep in six.itervalues(self._plugins)))
|
||||
repr(p_ep) for p_ep in self._plugins.values()))
|
||||
|
||||
def __str__(self):
|
||||
if not self._plugins:
|
||||
return "No plugins"
|
||||
return "\n\n".join(str(p_ep) for p_ep in six.itervalues(self._plugins))
|
||||
return "\n\n".join(str(p_ep) for p_ep in self._plugins.values())
|
||||
|
|
|
|||
|
|
@ -108,7 +108,7 @@ def pick_plugin(config, default, plugins, question, ifaces):
|
|||
|
||||
if len(prepared) > 1:
|
||||
logger.debug("Multiple candidate plugins: %s", prepared)
|
||||
plugin_ep = choose_plugin(list(six.itervalues(prepared)), question)
|
||||
plugin_ep = choose_plugin(list(prepared.values()), question)
|
||||
if plugin_ep is None:
|
||||
return None
|
||||
return plugin_ep.init()
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ to serve all files under specified web root ({0})."""
|
|||
for achall in achalls:
|
||||
self.conf("map").setdefault(achall.domain, webroot_path)
|
||||
else:
|
||||
known_webroots = list(set(six.itervalues(self.conf("map"))))
|
||||
known_webroots = list(set(self.conf("map").values()))
|
||||
for achall in achalls:
|
||||
if achall.domain not in self.conf("map"):
|
||||
new_webroot = self._prompt_for_webroot(achall.domain,
|
||||
|
|
|
|||
|
|
@ -153,7 +153,7 @@ def lock_dir_until_exit(dir_path):
|
|||
|
||||
|
||||
def _release_locks():
|
||||
for dir_lock in six.itervalues(_LOCKS):
|
||||
for dir_lock in _LOCKS.values():
|
||||
try:
|
||||
dir_lock.release()
|
||||
except: # pylint: disable=bare-except
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ class AuthenticatorTest(unittest.TestCase):
|
|||
self.assertTrue(self.achall.domain in call[0][0])
|
||||
self.assertTrue(all(
|
||||
webroot in call[0][1]
|
||||
for webroot in six.itervalues(self.config.webroot_map)))
|
||||
for webroot in self.config.webroot_map.values()))
|
||||
self.assertEqual(self.config.webroot_map[self.achall.domain],
|
||||
self.path)
|
||||
|
||||
|
|
@ -100,7 +100,7 @@ class AuthenticatorTest(unittest.TestCase):
|
|||
self.assertTrue(self.achall.domain in call[0][0])
|
||||
self.assertTrue(all(
|
||||
webroot in call[0][1]
|
||||
for webroot in six.itervalues(self.config.webroot_map)))
|
||||
for webroot in self.config.webroot_map.values()))
|
||||
|
||||
@test_util.patch_get_utility()
|
||||
def test_new_webroot(self, mock_get_utility):
|
||||
|
|
|
|||
Loading…
Reference in a new issue