From 710128607be36aafe7285f2cecd9126d9081f927 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Fri, 16 Oct 2020 18:51:04 +0800 Subject: [PATCH] mgr/dashboard: do not use "l" for variable name see also https://www.flake8rules.com/rules/E741.html also silences flake8 warnings like: 2: {tty:'./controllers/home.py:90:26: E741 ambiguous variable name 'l'':'./controllers/home.py:90:26: E741 ambiguous variable name 'l''} 2: {tty:'./controllers/logs.py:52:13: E741 ambiguous variable name 'l'':'./controllers/logs.py:52:13: E741 ambiguous variable name 'l''} 2: {tty:'./services/ganesha.py:36:40: E741 ambiguous variable name 'l'':'./services/ganesha.py:36:40: E741 ambiguous variable name 'l''} 2: 3 E741 ambiguous variable name 'l' Signed-off-by: Kefu Chai --- src/pybind/mgr/dashboard/controllers/home.py | 2 +- src/pybind/mgr/dashboard/controllers/logs.py | 4 ++-- src/pybind/mgr/dashboard/services/ganesha.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/pybind/mgr/dashboard/controllers/home.py b/src/pybind/mgr/dashboard/controllers/home.py index 705d7c456c8..793b241dd75 100644 --- a/src/pybind/mgr/dashboard/controllers/home.py +++ b/src/pybind/mgr/dashboard/controllers/home.py @@ -87,7 +87,7 @@ class HomeController(BaseController, LanguageMixin): result.sort(key=lambda l: l[0]) result.sort(key=lambda l: l[1], reverse=True) logger.debug("language preference: %s", result) - return [l[0] for l in result] + return [r[0] for r in result] def _language_dir(self, langs): for lang in langs: diff --git a/src/pybind/mgr/dashboard/controllers/logs.py b/src/pybind/mgr/dashboard/controllers/logs.py index 9717552969e..97995110746 100644 --- a/src/pybind/mgr/dashboard/controllers/logs.py +++ b/src/pybind/mgr/dashboard/controllers/logs.py @@ -49,8 +49,8 @@ class Logs(BaseController): def load_buffer(self, buf, channel_name): lines = CephService.send_command( 'mon', 'log last', channel=channel_name, num=LOG_BUFFER_SIZE, level='debug') - for l in lines: - buf.appendleft(l) + for line in lines: + buf.appendleft(line) def initialize_buffers(self): if not self._log_initialized: diff --git a/src/pybind/mgr/dashboard/services/ganesha.py b/src/pybind/mgr/dashboard/services/ganesha.py index 35a9b9a7ac1..128d5981a13 100644 --- a/src/pybind/mgr/dashboard/services/ganesha.py +++ b/src/pybind/mgr/dashboard/services/ganesha.py @@ -33,7 +33,7 @@ class Ganesha(object): raise NFSException("Ganesha config location is not configured. " "Please set the GANESHA_RADOS_POOL_NAMESPACE " "setting.") - location_list = [l.strip() for l in location_list_str.split(",")] + location_list = [loc.strip() for loc in location_list_str.split(",")] for location in location_list: cluster = None pool = None -- 2.47.3