Skip to content

Commit 62d2842

Browse files
author
Dmytro Parfeniuk
committed
💚 Linter is happy
1 parent 94b92ed commit 62d2842

File tree

5 files changed

+17
-11
lines changed

5 files changed

+17
-11
lines changed

pyproject.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,10 @@ exclude = ["venv", ".tox"]
104104
# Check: https://mypy.readthedocs.io/en/latest/config_file.html#import-discovery
105105
follow_imports = 'silent'
106106

107+
[[tool.mypy.overrides]]
108+
module = ["datasets.*"]
109+
ignore_missing_imports=true
110+
107111

108112
[tool.ruff]
109113
line-length = 88
@@ -122,6 +126,8 @@ ignore = [
122126
"ISC001",
123127
"TCH002",
124128
"PLW1514", # allow Path.open without encoding
129+
"RET505", # allow `else` blocks
130+
"RET506" # allow `else` blocks
125131

126132
]
127133
select = [

src/guidellm/request/transformers.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
from pathlib import Path
22
from typing import Optional, Union
33

4-
from datasets import DatasetDict # type: ignore # noqa: PGH003
5-
from datasets import Dataset, IterableDataset, IterableDatasetDict
4+
from datasets import (
5+
Dataset,
6+
DatasetDict, # type: ignore # noqa: PGH003
7+
IterableDataset,
8+
IterableDatasetDict,
9+
)
610
from loguru import logger
711
from transformers import PreTrainedTokenizer # type: ignore # noqa: PGH003
812

@@ -73,7 +77,7 @@ def __init__(
7377

7478
def __len__(self) -> int:
7579
if not isinstance(self._hf_dataset, Dataset):
76-
raise ValueError(f"Can't get dataset size for IterableDataset object")
80+
raise ValueError("Can't get dataset size for IterableDataset object")
7781
else:
7882
return len(self._hf_dataset)
7983

src/guidellm/utils/cli_params.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,7 @@ def convert(
2323
return value
2424

2525
try:
26-
value = int(value)
27-
return value
26+
return int(value)
2827
except ValueError:
2928
if value == "dataset":
3029
return value

tests/unit/cli/test_custom_type_params.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from guidellm.utils import cli_params
55

66

7-
@pytest.fixture
7+
@pytest.fixture()
88
def max_requests_param_type():
99
return cli_params.MaxRequestsType()
1010

tests/unit/test_main.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -279,9 +279,9 @@ def test_generate_benchmark_report_emulated_with_dataset_requests(
279279
def test_generate_benchmark_report_cli_emulated_with_dataset_requests(
280280
mock_backend, mock_request_generator_emulated, mock_executor
281281
):
282+
runner = CliRunner()
282283
with pytest.raises(ValueError, match="Cannot use 'dataset' for emulated data"):
283-
runner = CliRunner()
284-
result = runner.invoke(
284+
runner.invoke(
285285
generate_benchmark_report_cli,
286286
[
287287
"--target",
@@ -303,6 +303,3 @@ def test_generate_benchmark_report_cli_emulated_with_dataset_requests(
303303
],
304304
catch_exceptions=False,
305305
)
306-
307-
if result.stdout:
308-
print(result.stdout) # noqa: T201

0 commit comments

Comments
 (0)