[nyx/master] Unable to index into dict keys/values

commit a272168174e2dc2c57b2a027c02ebf87276aa660 Author: Damian Johnson <atagar@torproject.org> Date: Sun Aug 28 10:22:08 2016 -0700 Unable to index into dict keys/values The dict's keys() and values() methods provide iterators which we can't index into... TypeError: 'dict_values' object does not support indexing --- nyx/panel/config.py | 2 +- nyx/panel/connection.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/nyx/panel/config.py b/nyx/panel/config.py index 3a4a67b..d67afae 100644 --- a/nyx/panel/config.py +++ b/nyx/panel/config.py @@ -58,7 +58,7 @@ class ConfigEntry(object): self.name = name self.value_type = value_type self.manual = manual.config_options.get(name, stem.manual.ConfigOption(name)) - self._index = manual.config_options.keys().index(name) if name in manual.config_options else 99999 + self._index = list(manual.config_options.keys()).index(name) if name in manual.config_options else 99999 def value(self): """ diff --git a/nyx/panel/connection.py b/nyx/panel/connection.py index d30742f..16175d9 100644 --- a/nyx/panel/connection.py +++ b/nyx/panel/connection.py @@ -598,7 +598,7 @@ def _draw_details(subwindow, selected): subwindow.addstr(2, 3, 'No consensus data found', *attr) elif len(matches) == 1 or selected.connection.remote_port in matches: controller = tor_controller() - fingerprint = matches.values()[0] if len(matches) == 1 else matches[selected.connection.remote_port] + fingerprint = list(matches.values())[0] if len(matches) == 1 else matches[selected.connection.remote_port] router_status_entry = controller.get_network_status(fingerprint, None) subwindow.addstr(15, 2, 'fingerprint: %s' % fingerprint, *attr)
participants (1)
-
atagar@torproject.org