Skip to content

Commit 135d64b

Browse files
committed
Replace {attention -> note}_stmt
The new name is a closer match with what is presented to the user.
1 parent a601816 commit 135d64b

File tree

2 files changed

+26
-30
lines changed

2 files changed

+26
-30
lines changed

src/pip/_internal/exceptions.py

+8-12
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ def __init__(
6666
message: Union[str, Text],
6767
context: Optional[Union[str, Text]],
6868
hint_stmt: Optional[Union[str, Text]],
69-
attention_stmt: Optional[Union[str, Text]] = None,
69+
note_stmt: Optional[Union[str, Text]] = None,
7070
link: Optional[str] = None,
7171
) -> None:
7272
# Ensure a proper reference is provided.
@@ -81,7 +81,7 @@ def __init__(
8181
self.message = message
8282
self.context = context
8383

84-
self.attention_stmt = attention_stmt
84+
self.note_stmt = note_stmt
8585
self.hint_stmt = hint_stmt
8686

8787
self.link = link
@@ -94,7 +94,7 @@ def __repr__(self) -> str:
9494
f"reference={self.reference!r}, "
9595
f"message={self.message!r}, "
9696
f"context={self.context!r}, "
97-
f"attention_stmt={self.attention_stmt!r}, "
97+
f"note_stmt={self.note_stmt!r}, "
9898
f"hint_stmt={self.hint_stmt!r}"
9999
")>"
100100
)
@@ -137,12 +137,12 @@ def __rich_console__(
137137
yield ""
138138
yield self.context
139139

140-
if self.attention_stmt is not None or self.hint_stmt is not None:
140+
if self.note_stmt is not None or self.hint_stmt is not None:
141141
yield ""
142142

143-
if self.attention_stmt is not None:
143+
if self.note_stmt is not None:
144144
yield _prefix_with_indent(
145-
self.attention_stmt,
145+
self.note_stmt,
146146
console,
147147
prefix="[magenta bold]note[/]: ",
148148
indent=" ",
@@ -187,9 +187,7 @@ def __init__(self, *, package: str) -> None:
187187
"This package has an invalid pyproject.toml file.\n"
188188
R"The \[build-system] table is missing the mandatory `requires` key."
189189
),
190-
attention_stmt=(
191-
"This is an issue with the package mentioned above, not pip."
192-
),
190+
note_stmt="This is an issue with the package mentioned above, not pip.",
193191
hint_stmt=Text("See PEP 518 for the detailed specification."),
194192
)
195193

@@ -207,10 +205,8 @@ def __init__(self, *, package: str, reason: str) -> None:
207205
"pyproject.toml.\n"
208206
f"{reason}"
209207
),
208+
note_stmt="This is an issue with the package mentioned above, not pip.",
210209
hint_stmt=Text("See PEP 518 for the detailed specification."),
211-
attention_stmt=(
212-
"This is an issue with the package mentioned above, not pip."
213-
),
214210
)
215211

216212

tests/unit/test_exceptions.py

+18-18
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ def test_complete(self) -> None:
7676
reference="test-diagnostic",
7777
message="Oh no!\nIt broke. :(",
7878
context="Something went wrong\nvery wrong.",
79-
attention_stmt="You did something wrong, which is what caused this error.",
79+
note_stmt="You did something wrong, which is what caused this error.",
8080
hint_stmt="Do it better next time, by trying harder.",
8181
)
8282

@@ -100,7 +100,7 @@ def test_complete_color(self) -> None:
100100
reference="test-diagnostic",
101101
message="Oh no!\nIt broke.",
102102
context="Something went wrong\nvery wrong.",
103-
attention_stmt="You did something wrong.",
103+
note_stmt="You did something wrong.",
104104
hint_stmt="Do it better next time, by trying harder.",
105105
)
106106

@@ -127,7 +127,7 @@ def test_no_context(self) -> None:
127127
reference="test-diagnostic",
128128
message="Oh no!\nIt broke. :(",
129129
context=None,
130-
attention_stmt="You did something wrong, which is what caused this error.",
130+
note_stmt="You did something wrong, which is what caused this error.",
131131
hint_stmt="Do it better next time, by trying harder.",
132132
)
133133

@@ -148,7 +148,7 @@ def test_no_note(self) -> None:
148148
reference="test-diagnostic",
149149
message="Oh no!\nIt broke. :(",
150150
context="Something went wrong\nvery wrong.",
151-
attention_stmt=None,
151+
note_stmt=None,
152152
hint_stmt="Do it better next time, by trying harder.",
153153
)
154154

@@ -171,7 +171,7 @@ def test_no_hint(self) -> None:
171171
reference="test-diagnostic",
172172
message="Oh no!\nIt broke. :(",
173173
context="Something went wrong\nvery wrong.",
174-
attention_stmt="You did something wrong, which is what caused this error.",
174+
note_stmt="You did something wrong, which is what caused this error.",
175175
hint_stmt=None,
176176
)
177177

@@ -194,7 +194,7 @@ def test_no_context_no_hint(self) -> None:
194194
reference="test-diagnostic",
195195
message="Oh no!\nIt broke. :(",
196196
context=None,
197-
attention_stmt="You did something wrong, which is what caused this error.",
197+
note_stmt="You did something wrong, which is what caused this error.",
198198
hint_stmt=None,
199199
)
200200

@@ -214,7 +214,7 @@ def test_no_context_no_note(self) -> None:
214214
reference="test-diagnostic",
215215
message="Oh no!\nIt broke. :(",
216216
context=None,
217-
attention_stmt=None,
217+
note_stmt=None,
218218
hint_stmt="Do it better next time, by trying harder.",
219219
)
220220

@@ -234,7 +234,7 @@ def test_no_hint_no_note(self) -> None:
234234
reference="test-diagnostic",
235235
message="Oh no!\nIt broke. :(",
236236
context="Something went wrong\nvery wrong.",
237-
attention_stmt=None,
237+
note_stmt=None,
238238
hint_stmt=None,
239239
)
240240

@@ -256,7 +256,7 @@ def test_no_hint_no_note_no_context(self) -> None:
256256
message="Oh no!\nIt broke. :(",
257257
context=None,
258258
hint_stmt=None,
259-
attention_stmt=None,
259+
note_stmt=None,
260260
)
261261

262262
assert rendered_in_ascii(err) == textwrap.dedent(
@@ -286,7 +286,7 @@ def test_complete(self) -> None:
286286
reference="test-diagnostic",
287287
message="Oh no!\nIt broke. :(",
288288
context="Something went wrong\nvery wrong.",
289-
attention_stmt="You did something wrong, which is what caused this error.",
289+
note_stmt="You did something wrong, which is what caused this error.",
290290
hint_stmt="Do it better next time, by trying harder.",
291291
)
292292

@@ -309,7 +309,7 @@ def test_complete_color(self) -> None:
309309
reference="test-diagnostic",
310310
message="Oh no!\nIt broke.",
311311
context="Something went wrong\nvery wrong.",
312-
attention_stmt="You did something wrong.",
312+
note_stmt="You did something wrong.",
313313
hint_stmt="Do it better next time, by trying harder.",
314314
)
315315

@@ -335,7 +335,7 @@ def test_no_context(self) -> None:
335335
reference="test-diagnostic",
336336
message="Oh no!\nIt broke. :(",
337337
context=None,
338-
attention_stmt="You did something wrong, which is what caused this error.",
338+
note_stmt="You did something wrong, which is what caused this error.",
339339
hint_stmt="Do it better next time, by trying harder.",
340340
)
341341

@@ -356,7 +356,7 @@ def test_no_note(self) -> None:
356356
reference="test-diagnostic",
357357
message="Oh no!\nIt broke. :(",
358358
context="Something went wrong\nvery wrong.",
359-
attention_stmt=None,
359+
note_stmt=None,
360360
hint_stmt="Do it better next time, by trying harder.",
361361
)
362362

@@ -378,7 +378,7 @@ def test_no_hint(self) -> None:
378378
reference="test-diagnostic",
379379
message="Oh no!\nIt broke. :(",
380380
context="Something went wrong\nvery wrong.",
381-
attention_stmt="You did something wrong, which is what caused this error.",
381+
note_stmt="You did something wrong, which is what caused this error.",
382382
hint_stmt=None,
383383
)
384384

@@ -400,7 +400,7 @@ def test_no_context_no_hint(self) -> None:
400400
reference="test-diagnostic",
401401
message="Oh no!\nIt broke. :(",
402402
context=None,
403-
attention_stmt="You did something wrong, which is what caused this error.",
403+
note_stmt="You did something wrong, which is what caused this error.",
404404
hint_stmt=None,
405405
)
406406

@@ -420,7 +420,7 @@ def test_no_context_no_note(self) -> None:
420420
reference="test-diagnostic",
421421
message="Oh no!\nIt broke. :(",
422422
context=None,
423-
attention_stmt=None,
423+
note_stmt=None,
424424
hint_stmt="Do it better next time, by trying harder.",
425425
)
426426

@@ -440,7 +440,7 @@ def test_no_hint_no_note(self) -> None:
440440
reference="test-diagnostic",
441441
message="Oh no!\nIt broke. :(",
442442
context="Something went wrong\nvery wrong.",
443-
attention_stmt=None,
443+
note_stmt=None,
444444
hint_stmt=None,
445445
)
446446

@@ -461,7 +461,7 @@ def test_no_hint_no_note_no_context(self) -> None:
461461
message="Oh no!\nIt broke. :(",
462462
context=None,
463463
hint_stmt=None,
464-
attention_stmt=None,
464+
note_stmt=None,
465465
)
466466

467467
assert rendered(err) == textwrap.dedent(

0 commit comments

Comments
 (0)