Skip to content

Commit

Permalink
pybind/mgr: use enumerate() for accessing index in a loop
Browse files Browse the repository at this point in the history
for better readability

Signed-off-by: Kefu Chai <kchai@redhat.com>
  • Loading branch information
tchaikov committed May 2, 2019
1 parent d712aac commit aadb8ec
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/pybind/mgr/restful/module.py
Expand Up @@ -79,16 +79,16 @@ def run(self, commands):

# Gather the results (in parallel)
results = []
for index in range(len(commands)):
for index, command in enumerate(commands):
tag = '%s:%s:%d' % (__name__, self.id, index)

# Store the result
result = CommandResult(tag)
result.command = common.humanify_command(commands[index])
result.command = common.humanify_command(command)
results.append(result)

# Run the command
context.instance.send_command(result, 'mon', '', json.dumps(commands[index]), tag)
context.instance.send_command(result, 'mon', '', json.dumps(command), tag)

return results

Expand Down

0 comments on commit aadb8ec

Please sign in to comment.