Skip to content

Commit b0e5398

Browse files
committed
[chores] Minor formatting in commands loop
Instead of looping through the commands map, its better to loop through the allowed_commands to reduce overhead. Signed-off-by: DragnEmperor <dragnemperor@gmail.com>
1 parent 2106d23 commit b0e5398

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

openwisp_controller/connection/base/models.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,9 @@ def get_org_allowed_commands(self, organization_id=None):
445445
str(organization_id), ORGANIZATION_ENABLED_COMMANDS.get('__all__')
446446
)
447447
commands_map = dict(COMMAND_CHOICES)
448-
return [(i, commands_map[i]) for i in commands_map if i in allowed_commands]
448+
return [
449+
(cmd, commands_map[cmd]) for cmd in allowed_commands if cmd in commands_map
450+
]
449451

450452
@classmethod
451453
def get_org_schema(self, organization_id=None):

0 commit comments

Comments
 (0)