Format source code to PEP8 using Ruff (#36)

* added ruff docs

* style: Run ruff and black before yapf pass

* yapf -r -i (23 fixes)

* fixed conf.py and ran ruff format .

* fixed conf.py 2

* formatted argparser.py

* formatted src/rocprof_compute_analyze

* formatted src/rocprof_compute_profile

* formatted soc_base.py

* formatted rocprof_compute_tui

* formatted gui_components

* formatted src/utils

* formatted tests/

* format extra files

* cleanup

* fix test_utils.py

* fixed typos

* Update pyproject.toml

* Update README.md

* Update test_utils.py

---------

Signed-off-by: jamessiddeley-amd <James.Siddeley@amd.com>
Co-authored-by: James Siddeley <James.Siddeley@amd.com>
Co-authored-by: systems-assistant[bot] <systems-assistant[bot]@users.noreply.github.com>
This commit is contained in:
systems-assistant[bot]
2025-08-08 15:32:30 -04:00
committed by GitHub
parent d3f9ab25eb
commit 58d2a016ce
72 changed files with 3272 additions and 2395 deletions
@@ -23,7 +23,6 @@
##############################################################################
import os
import re
from collections import OrderedDict
@@ -50,7 +49,9 @@ top_stats_build_in_config = {
1: {
"id": 1,
"title": "Dispatch List",
"data source": [{"raw_csv_table": {"id": 2, "source": "pmc_dispatch_info.csv"}}],
"data source": [
{"raw_csv_table": {"id": 2, "source": "pmc_dispatch_info.csv"}}
],
},
}
@@ -72,7 +73,8 @@ def load_panel_configs(dir):
if f.endswith(".yaml"):
with open(str(Path(root).joinpath(f))) as file:
config = yaml.safe_load(file)
# metric key can be None due to some metric tables not having any metrics
# metric key can be None due to some metric tables
# not having any metrics
# metric key should be empty dict instead of None
for data_source in config["Panel Config"]["data source"]:
metric_table = data_source.get("metric_table")
@@ -80,7 +82,8 @@ def load_panel_configs(dir):
metric_table["metric"] = {}
d[config["Panel Config"]["id"]] = config["Panel Config"]
# TODO: sort metrics as the header order in case they are not defined in the same order
# TODO: sort metrics as the header order in case they-
# are not defined in the same order
od = OrderedDict(sorted(d.items()))
# for key, value in od.items():
@@ -157,9 +160,9 @@ def create_df_kernel_top_stats(
axis=1,
)
grouped = time_stats.groupby(by=["Kernel_Name"]).agg(
{"ExeTime": ["count", "sum", "mean", "median"]}
)
grouped = time_stats.groupby(by=["Kernel_Name"]).agg({
"ExeTime": ["count", "sum", "mean", "median"]
})
time_unit_str = "(" + time_unit + ")"
grouped.columns = [
@@ -205,8 +208,8 @@ def create_df_pmc(
dfs = []
coll_levels = []
df = pd.DataFrame()
new_df = pd.DataFrame()
df = pd.DataFrame() # noqa: F841
new_df = pd.DataFrame() # noqa: F841
for root, dirs, files in os.walk(raw_data_dir):
for f in files:
# print("file ", f)
@@ -250,7 +253,9 @@ def create_df_pmc(
else:
# regular single node case
if nodes is None:
return create_single_df_pmc(raw_data_root_dir, None, kernel_verbose, verbose)
return create_single_df_pmc(
raw_data_root_dir, None, kernel_verbose, verbose
)
# "empty list" means all nodes
elif not nodes: