@cryptotaxi247 / netdata-1 / commits / 025d0c753

Remove unneeded keys() from unbound.chart.conf.

Improves performance and makes code a bit tidier.

Austin S. Hemmelgarn committed May 2, 2018 at 10:37 UTC 025d0c753521536b30d6678b3fc75da1f660a0fb
1 file changed +6 -6
python.d/unbound.chart.py
+6 -6
@@ -106,13 +106,13 @@ class Service(SocketService):
106 self.definitions.update(EXTENDED_CHARTS)
107 if self.unix_socket:
108 self.debug('Using unix socket: {0}'.format(self.unix_socket))
109 - for key in self.definitions.keys():
109 + for key in self.definitions:
110 self.definitions[key]['options'][4] = 'Local'
111 else:
112 self.debug('Connecting to: {0}:{1}'.format(self.host, self.port))
113 self.debug('Using key: {0}'.format(self.key))
114 self.debug('Using certificate: {0}'.format(self.cert))
115 - for key in self.definitions.keys():
115 + for key in self.definitions:
116 self.definitions[key]['options'][4] = self.host
117
118 def _auto_config(self):
@@ -120,9 +120,9 @@ class Service(SocketService):
120 self.debug('Unbound config: {0}'.format(self.ubconf))
121 conf = YamlOrderedLoader.load_config_from_file(self.ubconf)[0]
122 if self.ext is None:
123 - if 'extended-statistics' in conf['server'].keys():
123 + if 'extended-statistics' in conf['server']:
124 self.ext = conf['server']['extended-statistics']
125 - if 'remote-control' in conf.keys():
125 + if 'remote-control' in conf:
126 if conf['remote-control'].get('control-use-cert', False):
127 if not self.key:
128 self.key = conf['remote-control'].get('control-key-file')
@@ -161,7 +161,7 @@ class Service(SocketService):
161 for line in raw.splitlines():
162 stat = line.split('=')
163 tmp[stat[0]] = stat[1]
164 - for item in STAT_MAP.keys():
165 - if item in tmp.keys():
164 + for item in STAT_MAP:
165 + if item in tmp:
166 data[STAT_MAP[item][0]] = float(tmp[item]) * STAT_MAP[item][1]
167 return data