Skip to content

Commit ed117bc

Browse files
committed
2to3 suggested changes
1 parent 924a0eb commit ed117bc

File tree

6 files changed

+20
-21
lines changed

6 files changed

+20
-21
lines changed

tests/searchcommands/test_decorators.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -356,9 +356,9 @@ def test_option(self):
356356

357357
options.reset()
358358
missing = options.get_missing()
359-
self.assertListEqual(missing, [option.name for option in options.values() if option.is_required])
360-
self.assertListEqual(presets, [str(option) for option in options.values() if option.value is not None])
361-
self.assertListEqual(presets, [str(option) for option in options.values() if str(option) != option.name + '=None'])
359+
self.assertListEqual(missing, [option.name for option in list(options.values()) if option.is_required])
360+
self.assertListEqual(presets, [str(option) for option in list(options.values()) if option.value is not None])
361+
self.assertListEqual(presets, [str(option) for option in list(options.values()) if str(option) != option.name + '=None'])
362362

363363
test_option_values = {
364364
validators.Boolean: ('0', 'non-boolean value'),
@@ -375,7 +375,7 @@ def test_option(self):
375375
validators.RegularExpression: ('\\s+', '(poorly formed regular expression'),
376376
validators.Set: ('bar', 'non-existent set entry')}
377377

378-
for option in options.values():
378+
for option in list(options.values()):
379379
validator = option.validator
380380

381381
if validator is None:
@@ -434,9 +434,9 @@ def test_option(self):
434434
self.maxDiff = None
435435

436436
tuplewrap = lambda x: x if isinstance(x, tuple) else (x,)
437-
invert = lambda x: {v: k for k, v in x.items()}
437+
invert = lambda x: {v: k for k, v in list(x.items())}
438438

439-
for x in command.options.values():
439+
for x in list(command.options.values()):
440440
# isinstance doesn't work for some reason
441441
if type(x.value).__name__ == 'Code':
442442
self.assertEqual(expected[x.name], x.value.source)

tests/searchcommands/test_internals_v1.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def fix_up(cls, command_class): pass
5555
command = TestCommandLineParserCommand()
5656
CommandLineParser.parse(command, options)
5757

58-
for option in command.options.values():
58+
for option in list(command.options.values()):
5959
if option.name in ['logging_configuration', 'logging_level', 'record', 'show_configuration']:
6060
self.assertFalse(option.is_set)
6161
continue
@@ -72,7 +72,7 @@ def fix_up(cls, command_class): pass
7272
command = TestCommandLineParserCommand()
7373
CommandLineParser.parse(command, options + fieldnames)
7474

75-
for option in command.options.values():
75+
for option in list(command.options.values()):
7676
if option.name in ['logging_configuration', 'logging_level', 'record', 'show_configuration']:
7777
self.assertFalse(option.is_set)
7878
continue
@@ -87,7 +87,7 @@ def fix_up(cls, command_class): pass
8787
command = TestCommandLineParserCommand()
8888
CommandLineParser.parse(command, ['required_option=true'] + fieldnames)
8989

90-
for option in command.options.values():
90+
for option in list(command.options.values()):
9191
if option.name in ['unnecessary_option', 'logging_configuration', 'logging_level', 'record',
9292
'show_configuration']:
9393
self.assertFalse(option.is_set)
@@ -282,7 +282,7 @@ def test_input_header(self):
282282
'sentence': 'hello world!'}
283283

284284
input_header = InputHeader()
285-
text = reduce(lambda value, item: value + f'{item[0]}:{item[1]}\n', collection.items(), '') + '\n'
285+
text = reduce(lambda value, item: value + f'{item[0]}:{item[1]}\n', list(collection.items()), '') + '\n'
286286

287287
with closing(StringIO(text)) as input_file:
288288
input_header.read(input_file)

tests/searchcommands/test_internals_v2.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ def test_record_writer_with_random_data(self, save_recording=False):
205205

206206
test_data['metrics'] = metrics
207207

208-
for name, metric in metrics.items():
208+
for name, metric in list(metrics.items()):
209209
writer.write_metric(name, metric)
210210

211211
self.assertEqual(writer._chunk_count, 0)
@@ -220,8 +220,8 @@ def test_record_writer_with_random_data(self, save_recording=False):
220220
self.assertListEqual(writer._inspector['messages'], messages)
221221

222222
self.assertDictEqual(
223-
dict(k_v for k_v in writer._inspector.items() if k_v[0].startswith('metric.')),
224-
dict(('metric.' + k_v1[0], k_v1[1]) for k_v1 in metrics.items()))
223+
dict(k_v for k_v in list(writer._inspector.items()) if k_v[0].startswith('metric.')),
224+
dict(('metric.' + k_v1[0], k_v1[1]) for k_v1 in list(metrics.items())))
225225

226226
writer.flush(finished=True)
227227

tests/test_conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ def test_confs(self):
8787
testlib.tmpname(): testlib.tmpname()}
8888
stanza.submit(values)
8989
stanza.refresh()
90-
for key, value in values.items():
90+
for key, value in list(values.items()):
9191
self.assertTrue(key in stanza)
9292
self.assertEqual(value, stanza[key])
9393

tests/test_input.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ def setUp(self):
200200

201201
def tearDown(self):
202202
super().tearDown()
203-
for entity in self._test_entities.values():
203+
for entity in list(self._test_entities.values()):
204204
try:
205205
self.service.inputs.delete(
206206
kind=entity.kind,
@@ -231,7 +231,7 @@ def test_lists_modular_inputs(self):
231231

232232
def test_create(self):
233233
inputs = self.service.inputs
234-
for entity in self._test_entities.values():
234+
for entity in list(self._test_entities.values()):
235235
self.check_entity(entity)
236236
self.assertTrue(isinstance(entity, client.Input))
237237

@@ -242,7 +242,7 @@ def test_get_kind_list(self):
242242

243243
def test_read(self):
244244
inputs = self.service.inputs
245-
for this_entity in self._test_entities.values():
245+
for this_entity in list(self._test_entities.values()):
246246
kind, name = this_entity.kind, this_entity.name
247247
read_entity = inputs[name, kind]
248248
self.assertEqual(this_entity.kind, read_entity.kind)
@@ -258,7 +258,7 @@ def test_read_indiviually(self):
258258

259259
def test_update(self):
260260
inputs = self.service.inputs
261-
for entity in self._test_entities.values():
261+
for entity in list(self._test_entities.values()):
262262
kind, name = entity.kind, entity.name
263263
kwargs = {'host': 'foo'}
264264
entity.update(**kwargs)
@@ -269,7 +269,7 @@ def test_update(self):
269269
def test_delete(self):
270270
inputs = self.service.inputs
271271
remaining = len(self._test_entities) - 1
272-
for input_entity in self._test_entities.values():
272+
for input_entity in list(self._test_entities.values()):
273273
name = input_entity.name
274274
kind = input_entity.kind
275275
self.assertTrue(name in inputs)

utils/__init__.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414

1515
"""Utility module shared by the SDK unit tests."""
1616

17-
from __future__ import absolute_import
1817
from utils.cmdopts import *
1918

2019

@@ -96,7 +95,7 @@ def dslice(value, *args):
9695
result = {}
9796
for arg in args:
9897
if isinstance(arg, dict):
99-
for k, v in (arg.items()):
98+
for k, v in (list(arg.items())):
10099
if k in value:
101100
result[v] = value[k]
102101
elif isinstance(arg, list):

0 commit comments

Comments
 (0)