Skip to content

Commit 3afba18

Browse files
authored
Merge pull request #3079 from locustio/update-ruff
Update ruff to 0.10.0
2 parents 1a510d7 + 78a92a0 commit 3afba18

File tree

8 files changed

+168
-168
lines changed

8 files changed

+168
-168
lines changed

Diff for: .git-blame-ignore-revs

+3
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,6 @@ b5324820b299b1fe7da0608f0cc8ec47f58b1e40
1313
f99e9df700a8020e4c1967eb42dcb37ddd26e296
1414
# apply ruff 0.3.0
1515
64428a0b4dfc75a00b175b4231db33704d8f5d36
16+
# apply ruff 0.10.0
17+
92268e16d5666d429ccea1742ecb90475f284c89
18+
496c5bd40347b97f917ccacfaf57ceed8f6690b5

Diff for: .pre-commit-config.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
repos:
22
- repo: https://github.com/astral-sh/ruff-pre-commit
33
# Ruff version.
4-
rev: v0.7.3 # Pin the same version in the pyproject.toml file
4+
rev: v0.10.0 # Pin the same version in the pyproject.toml file
55
hooks:
66
# Run the linter.
77
- id: ruff

Diff for: examples/extend_web_ui.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ def content_length_csv():
138138

139139
if stats:
140140
for url, inner_stats in stats.items():
141-
rows.append(f"\"{url}\",{inner_stats['content-length']:.2f}")
141+
rows.append(f'"{url}",{inner_stats["content-length"]:.2f}')
142142
return "\n".join(rows)
143143

144144
# register our new routes and extended UI with the Locust web UI

Diff for: locust/contrib/fasthttp.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,7 @@ def rest_(self, method, url, name=None, **kwargs) -> Generator[RestResponseConte
471471
separator = "&" if "?" in url else "?"
472472
if name is None:
473473
name = url + separator + "_=..."
474-
with self.rest(method, f"{url}{separator}_={int(time.time()*1000)}", name=name, **kwargs) as resp:
474+
with self.rest(method, f"{url}{separator}_={int(time.time() * 1000)}", name=name, **kwargs) as resp:
475475
yield resp
476476

477477

Diff for: locust/runners.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -209,9 +209,9 @@ def spawn(user_class: str, spawn_count: int) -> list[User]:
209209
new_users: list[User] = []
210210
while n < spawn_count:
211211
new_user = self.user_classes_by_name[user_class](self.environment)
212-
assert hasattr(
213-
new_user, "environment"
214-
), f"Attribute 'environment' is missing on user {user_class}. Perhaps you defined your own __init__ and forgot to call the base constructor? (super().__init__(*args, **kwargs))"
212+
assert hasattr(new_user, "environment"), (
213+
f"Attribute 'environment' is missing on user {user_class}. Perhaps you defined your own __init__ and forgot to call the base constructor? (super().__init__(*args, **kwargs))"
214+
)
215215
new_user.start(self.user_greenlets)
216216
new_users.append(new_user)
217217
n += 1

Diff for: locust/stats.py

+4-7
Original file line numberDiff line numberDiff line change
@@ -827,7 +827,7 @@ def get_stats_summary(stats: RequestStats, current=True) -> list[str]:
827827
("%-" + str(STATS_TYPE_WIDTH) + "s %-" + str(name_column_width) + "s %7s %12s |%7s %7s %7s%7s | %7s %11s")
828828
% ("Type", "Name", "# reqs", "# fails", "Avg", "Min", "Max", "Med", "req/s", "failures/s")
829829
)
830-
separator = f'{"-" * STATS_TYPE_WIDTH}|{"-" * (name_column_width)}|{"-" * 7}|{"-" * 13}|{"-" * 7}|{"-" * 7}|{"-" * 7}|{"-" * 7}|{"-" * 8}|{"-" * 11}'
830+
separator = f"{'-' * STATS_TYPE_WIDTH}|{'-' * (name_column_width)}|{'-' * 7}|{'-' * 13}|{'-' * 7}|{'-' * 7}|{'-' * 7}|{'-' * 7}|{'-' * 8}|{'-' * 11}"
831831
summary.append(separator)
832832
for key in sorted(stats.entries.keys()):
833833
r = stats.entries[key]
@@ -850,14 +850,11 @@ def get_percentile_stats_summary(stats: RequestStats) -> list[str]:
850850
summary = ["Response time percentiles (approximated)"]
851851
headers = ("Type", "Name") + tuple(get_readable_percentiles(PERCENTILES_TO_REPORT)) + ("# reqs",)
852852
summary.append(
853-
(
854-
f"%-{str(STATS_TYPE_WIDTH)}s %-{str(STATS_NAME_WIDTH)}s %8s "
855-
f"{' '.join(['%6s'] * len(PERCENTILES_TO_REPORT))}"
856-
)
853+
(f"%-{str(STATS_TYPE_WIDTH)}s %-{str(STATS_NAME_WIDTH)}s %8s {' '.join(['%6s'] * len(PERCENTILES_TO_REPORT))}")
857854
% headers
858855
)
859856
separator = (
860-
f'{"-" * STATS_TYPE_WIDTH}|{"-" * STATS_NAME_WIDTH}|{"-" * 8}|{("-" * 6 + "|") * len(PERCENTILES_TO_REPORT)}'
857+
f"{'-' * STATS_TYPE_WIDTH}|{'-' * STATS_NAME_WIDTH}|{'-' * 8}|{('-' * 6 + '|') * len(PERCENTILES_TO_REPORT)}"
861858
)[:-1]
862859
summary.append(separator)
863860
for key in sorted(stats.entries.keys()):
@@ -880,7 +877,7 @@ def print_error_report(stats: RequestStats) -> None:
880877
def get_error_report_summary(stats) -> list[str]:
881878
summary = ["Error report"]
882879
summary.append("%-18s %-100s" % ("# occurrences", "Error"))
883-
separator = f'{"-" * 18}|{"-" * ((80 + STATS_NAME_WIDTH) - 19)}'
880+
separator = f"{'-' * 18}|{'-' * ((80 + STATS_NAME_WIDTH) - 19)}"
884881
summary.append(separator)
885882
for error in stats.errors.values():
886883
summary.append("%-18i %-100s" % (error.occurrences, error.to_name()))

Diff for: pyproject.toml

+4-3
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ test = [
7474
]
7575
lint = [
7676
"pre-commit>=3.7.1,<4.0.0",
77-
"ruff==0.7.3",
77+
"ruff==0.10.0",
7878
"mypy>=1.13.0,<2.0.0",
7979
"types-requests>=2.32.0.20240622,<3.0.0",
8080
]
@@ -132,8 +132,9 @@ extend-exclude = [
132132
"examples/issue_*.py",
133133
"src/readthedocs-sphinx-search/",
134134
]
135-
lint.ignore = ["E402", "E501", "E713", "E731", "E741"]
135+
lint.ignore = ["E402", "E501", "E713", "E731", "E741", "UP031"]
136136
lint.select = ["E", "F", "W", "UP", "FA102", "I001"]
137+
lint.dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?)|resp)$"
137138

138139
[tool.ruff.lint.per-file-ignores]
139140
"examples/*" = ["F841"]
@@ -233,7 +234,7 @@ python = ["3.12"]
233234
[tool.hatch.envs.lint]
234235
detached = true
235236
dependencies = [
236-
"ruff==0.7.3",
237+
"ruff==0.10.0",
237238
"mypy>=1.13.0,<2.0.0",
238239
"types-requests>=2.32.0.20240622,<3.0.0",
239240
]

0 commit comments

Comments
 (0)