aboutsummaryrefslogtreecommitdiffstats
path: root/resources/tools
diff options
context:
space:
mode:
authorPeter Mikus <pmikus@cisco.com>2022-06-14 06:34:55 +0000
committerPeter Mikus <peter.mikus@protonmail.ch>2022-06-14 10:00:20 +0000
commitac0807e55644020c877329d3bc05adc26ce76e7f (patch)
tree9386f6e4c8bdf5247c859b141281cb9c75fcb2cd /resources/tools
parenta08e07a8f6c614899b85f891efd45d5e4e93f7f4 (diff)
fix(pylint): Some quick pylints
Signed-off-by: Peter Mikus <pmikus@cisco.com> Change-Id: Iba133914882485191ad962e36fae70b6fda0af98
Diffstat (limited to 'resources/tools')
-rw-r--r--resources/tools/telemetry/bundle_bpf.py24
-rw-r--r--resources/tools/telemetry/bundle_vpp.py8
-rw-r--r--resources/tools/telemetry/constants.py1
3 files changed, 16 insertions, 17 deletions
diff --git a/resources/tools/telemetry/bundle_bpf.py b/resources/tools/telemetry/bundle_bpf.py
index bf54db0bcd..c376da9d63 100644
--- a/resources/tools/telemetry/bundle_bpf.py
+++ b/resources/tools/telemetry/bundle_bpf.py
@@ -111,7 +111,7 @@ class BundleBpf:
if item[u"labels"][u"name"] == u"python3":
continue
if len(str(item[u'labels'][u'cpu'])) > max_len["cpu"]:
- max_len["cpu"]= len(str(item[u'labels'][u'cpu']))
+ max_len["cpu"] = len(str(item[u'labels'][u'cpu']))
if len(str(item[u'labels'][u'pid'])) > max_len[u"pid"]:
max_len[u"pid"] = len(str(item[u'labels'][u'pid']))
if len(str(item[u'labels'][u'name'])) > max_len[u"name"]:
@@ -125,23 +125,23 @@ class BundleBpf:
item_list = sorted(item_list, key=lambda x: x['labels']['cpu'])
item_list = sorted(item_list, key=lambda x: x['name'])
- for it in item_list:
- if table_name != it[u"name"]:
- table_name = it[u"name"]
+ for itl in item_list:
+ if table_name != itl[u"name"]:
+ table_name = itl[u"name"]
text += f"\n==={table_name}===\n" \
f"cpu {u' ' * (max_len[u'cpu'] - 3)} " \
f"pid {u' ' * (max_len[u'pid'] - 3)} " \
f"name {u' ' * (max_len[u'name'] - 4)} " \
f"value {u' ' * (max_len[u'value'] - 5)}\n"
text += (
- f"""{str(it[u'labels'][u'cpu']) + u' ' *
- (max_len[u"cpu"] - len(str(it[u'labels'][u'cpu'])))} """
- f"""{str(it[u'labels'][u'pid']) + u' ' *
- (max_len[u"pid"] - len(str(it[u'labels'][u'pid'])))} """
- f"""{str(it[u'labels'][u'name']) + u' ' *
- (max_len[u"name"] - len(str(it[u'labels'][u'name'])))} """
- f"""{str(it[u'value']) + u' ' *
- (max_len[u"value"] - len(str(it[u'value'])))}\n""")
+ f"""{str(itl[u'labels'][u'cpu']) + u' ' *
+ (max_len[u"cpu"] - len(str(itl[u'labels'][u'cpu'])))} """
+ f"""{str(itl[u'labels'][u'pid']) + u' ' *
+ (max_len[u"pid"] - len(str(itl[u'labels'][u'pid'])))} """
+ f"""{str(itl[u'labels'][u'name']) + u' ' *
+ (max_len[u"name"] - len(str(itl[u'labels'][u'name'])))} """
+ f"""{str(itl[u'value']) + u' ' *
+ (max_len[u"value"] - len(str(itl[u'value'])))}\n""")
getLogger(u"console_stdout").info(text)
def process_data(self):
diff --git a/resources/tools/telemetry/bundle_vpp.py b/resources/tools/telemetry/bundle_vpp.py
index 315360f63b..963690bb5d 100644
--- a/resources/tools/telemetry/bundle_vpp.py
+++ b/resources/tools/telemetry/bundle_vpp.py
@@ -263,8 +263,8 @@ class BundleVpp:
for command in zip(self.api_command_list, self.api_replies_list):
self_fn = command[0][u"api_args"][u"cmd"].replace(u" ", u"_")
self_method_list = [meth for meth in dir(self)
- if callable(getattr(self, meth)) and
- meth.startswith('__') is False]
+ if callable(getattr(self, meth)) and
+ meth.startswith('__') is False]
if self_fn not in self_method_list:
continue
try:
@@ -272,9 +272,9 @@ class BundleVpp:
self_fn(command[1].reply)
except AttributeError:
pass
- except (KeyError, ValueError, TypeError) as e:
+ except (KeyError, ValueError, TypeError) as exc:
getLogger("console_stderr").error(
- f"Failed when processing data. Error message {e}"
+ f"Failed when processing data. Error message {exc}"
)
sys.exit(Constants.err_telemetry_process)
diff --git a/resources/tools/telemetry/constants.py b/resources/tools/telemetry/constants.py
index 4b47a39d21..9961a07b8b 100644
--- a/resources/tools/telemetry/constants.py
+++ b/resources/tools/telemetry/constants.py
@@ -46,4 +46,3 @@ class Constants:
# Could not detach BPF events
err_linux_detach = 52
-