Skip to content

Commit efbe8ea

Browse files
authored
Fix linter issues in GenAi-Perf (#573)
1 parent 61c4f03 commit efbe8ea

File tree

16 files changed

+295
-277
lines changed

16 files changed

+295
-277
lines changed

.pre-commit-config.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,3 +72,13 @@ repos:
7272
- id: mixed-line-ending
7373
- id: requirements-txt-fixer
7474
- id: trailing-whitespace
75+
76+
- repo: https://github.com/pre-commit/mirrors-mypy
77+
rev: v1.9.0
78+
hooks:
79+
- id: mypy
80+
types_or: [python, cython]
81+
additional_dependencies: [tokenize-rt==3.2.0, types-requests]
82+
exclude: >-
83+
(?x)
84+
^(?!(src/c\+\+/perf_analyzer/genai-perf/)).*\.py$

src/c++/perf_analyzer/genai-perf/genai_perf/graphs/base_plot.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,12 @@ def create_plot(
6363
"""
6464
raise NotImplementedError
6565

66-
def _generate_parquet(self, dataframe: DataFrame, file: str):
66+
def _generate_parquet(self, dataframe: DataFrame, file: str) -> None:
6767
dataframe.to_parquet(
6868
f"{DEFAULT_ARTIFACT_DIR}/data/{file}.gzip", compression="gzip"
6969
)
7070

71-
def _generate_graph_file(self, fig: Figure, file: str, title: str):
71+
def _generate_graph_file(self, fig: Figure, file: str, title: str) -> None:
7272
if file.endswith("jpeg"):
7373
print(f"Generating '{title}' jpeg")
7474
fig.write_image(f"{DEFAULT_ARTIFACT_DIR}/images/{file}")

src/c++/perf_analyzer/genai-perf/genai_perf/graphs/box_plot.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def create_plot(
5555
x_label: str = "",
5656
y_label: str = "",
5757
filename_root: str = "",
58-
):
58+
) -> None:
5959
df = pd.DataFrame({y_metric: self._metrics_data[y_key]})
6060
fig = px.box(
6161
df,

src/c++/perf_analyzer/genai-perf/genai_perf/graphs/heat_map.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2626
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2727

28-
from typing import Dict
28+
from typing import Dict, Optional
2929

3030
import pandas as pd
3131
import plotly.express as px
@@ -38,7 +38,7 @@ class HeatMap(BasePlot):
3838
Generate a heat map in jpeg and html format.
3939
"""
4040

41-
def __init__(self, stats: Statistics, extra_data: Dict | None = None) -> None:
41+
def __init__(self, stats: Statistics, extra_data: Optional[Dict] = None) -> None:
4242
super().__init__(stats, extra_data)
4343

4444
def create_plot(
@@ -51,7 +51,7 @@ def create_plot(
5151
x_label: str = "",
5252
y_label: str = "",
5353
filename_root: str = "",
54-
):
54+
) -> None:
5555
x_values = self._metrics_data[x_key]
5656
y_values = self._metrics_data[y_key]
5757
df = pd.DataFrame(

src/c++/perf_analyzer/genai-perf/genai_perf/graphs/scatter_plot.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2626
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2727

28-
from typing import Dict
28+
from typing import Dict, Optional
2929

3030
import pandas as pd
3131
import plotly.express as px
@@ -38,7 +38,7 @@ class ScatterPlot(BasePlot):
3838
Generate a scatter plot in jpeg and html format.
3939
"""
4040

41-
def __init__(self, stats: Statistics, extra_data: Dict | None = None) -> None:
41+
def __init__(self, stats: Statistics, extra_data: Optional[Dict] = None) -> None:
4242
super().__init__(stats, extra_data)
4343

4444
def create_plot(
@@ -51,7 +51,7 @@ def create_plot(
5151
x_label: str = "",
5252
y_label: str = "",
5353
filename_root: str = "",
54-
):
54+
) -> None:
5555
x_values = self._metrics_data[x_key]
5656
y_values = self._metrics_data[y_key]
5757

0 commit comments

Comments
 (0)