Skip to content

Commit b917220

Browse files
committed
Fix linter errors
1 parent 0516c58 commit b917220

File tree

5 files changed

+30
-17
lines changed

5 files changed

+30
-17
lines changed

src/guidellm/__main__.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@
77
import click
88

99
from guidellm.backend import BackendType
10-
from guidellm.benchmark import ProfileType, benchmark_generative_text, display_benchmarks_report
10+
from guidellm.benchmark import (
11+
ProfileType,
12+
benchmark_generative_text,
13+
display_benchmarks_report,
14+
)
1115
from guidellm.config import print_config
1216
from guidellm.preprocess.dataset import ShortPromptStrategy, process_dataset
1317
from guidellm.scheduler import StrategyType

src/guidellm/benchmark/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,6 @@
6262
"SynchronousProfile",
6363
"ThroughputProfile",
6464
"benchmark_generative_text",
65-
"display_benchmarks_report",
6665
"create_profile",
66+
"display_benchmarks_report",
6767
]

src/guidellm/benchmark/entrypoints.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import os
21
from collections.abc import Iterable
32
from pathlib import Path
43
from typing import Any, Literal, Optional, Union
@@ -136,11 +135,11 @@ async def benchmark_generative_text(
136135

137136
return report, saved_path
138137

139-
def display_benchmarks_report(file: str):
138+
def display_benchmarks_report(file: Path):
140139
console = GenerativeBenchmarksConsole(enabled=True)
141-
if not os.path.exists(file):
140+
if not file.exists():
142141
console.print_line(f"File {file} not found.")
143142
return
144143
report = GenerativeBenchmarksReport.load_file(file)
145144
console.benchmarks = report.benchmarks
146-
console.print_full_report()
145+
console.print_full_report()

src/guidellm/benchmark/output.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -960,4 +960,4 @@ def print_full_report(self):
960960
self.print_benchmarks_metadata()
961961
self.print_benchmarks_info()
962962
self.print_benchmarks_stats()
963-
self.enabled = orig_enabled
963+
self.enabled = orig_enabled
Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,44 @@
1-
import os
21
import unittest
2+
from pathlib import Path
3+
34
import pytest
45

56
from guidellm.benchmark import display_benchmarks_report
67

7-
@pytest.fixture()
8+
9+
@pytest.fixture
810
def get_test_asset_dir():
9-
def _() -> str:
10-
return os.path.dirname(os.path.abspath(__file__)) + "/assets"
11+
def _() -> Path:
12+
return Path(__file__).parent / "assets"
1113

1214
return _
1315

1416

1517
def test_display_entrypoint_json(capfd, get_test_asset_dir):
16-
generic_test_display_entrypoint("benchmarks_stripped.json", capfd, get_test_asset_dir)
18+
generic_test_display_entrypoint(
19+
"benchmarks_stripped.json",
20+
capfd,
21+
get_test_asset_dir,
22+
)
1723

1824

1925
def test_display_entrypoint_yaml(capfd, get_test_asset_dir):
20-
generic_test_display_entrypoint("benchmarks_stripped.yaml", capfd, get_test_asset_dir)
26+
generic_test_display_entrypoint(
27+
"benchmarks_stripped.yaml",
28+
capfd,
29+
get_test_asset_dir,
30+
)
2131

2232

2333
def generic_test_display_entrypoint(filename, capfd, get_test_asset_dir):
2434
asset_dir = get_test_asset_dir()
25-
display_benchmarks_report(asset_dir + "/" + filename)
35+
display_benchmarks_report(asset_dir / filename)
2636
out, err = capfd.readouterr()
27-
expected_output_path = asset_dir + "/benchmarks_stripped_output.txt"
28-
with open(expected_output_path, 'r', encoding='utf_8') as file:
37+
expected_output_path = asset_dir / "benchmarks_stripped_output.txt"
38+
with expected_output_path.open(encoding="utf_8") as file:
2939
expected_output = file.read()
3040
assert out == expected_output
3141

3242

33-
if __name__ == '__main__':
43+
if __name__ == "__main__":
3444
unittest.main()

0 commit comments

Comments
 (0)