From ffa22e25e5bcfca4f5f1472589b4397bdea9dcf4 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Thu, 2 May 2019 22:20:16 +0800 Subject: [PATCH] pybind/mgr: use enumerate() for accessing index in a loop for better readability Signed-off-by: Kefu Chai (cherry picked from commit aadb8ec856659a015f16d319efe4d4588362f97f) --- src/pybind/mgr/restful/module.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/pybind/mgr/restful/module.py b/src/pybind/mgr/restful/module.py index a2d6793eaf2..cad8fe581e5 100644 --- a/src/pybind/mgr/restful/module.py +++ b/src/pybind/mgr/restful/module.py @@ -79,16 +79,16 @@ class CommandsRequest(object): # 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 -- 2.47.3