Skip to content

Commit b10a548

Browse files
committed
has no attributes - double quotes
1 parent 2a43cb9 commit b10a548

23 files changed

+79
-79
lines changed

docs/source/class_basics.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ initialized within the class. Mypy infers the types of attributes:
2121
2222
a = A(1)
2323
a.x = 2 # OK!
24-
a.y = 3 # Error: 'A' has no attribute 'y'
24+
a.y = 3 # Error: "A" has no attribute "y"
2525
2626
This is a bit like each class having an implicitly defined
2727
:py:data:`__slots__ <object.__slots__>` attribute. This is only enforced during type

docs/source/error_code_list.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ target module can be found):
3636

3737
.. code-block:: python
3838
39-
# Error: Module 'os' has no attribute 'non_existent' [attr-defined]
39+
# Error: Module "os" has no attribute "non_existent" [attr-defined]
4040
from os import non_existent
4141
4242
A reference to a missing attribute is given the ``Any`` type. In the

mypy/plugins/attrs.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ def _determine_eq_order(ctx: 'mypy.plugin.ClassDefContext') -> bool:
212212
order = _get_decorator_optional_bool_argument(ctx, 'order')
213213

214214
if cmp is not None and any((eq is not None, order is not None)):
215-
ctx.api.fail("Don't mix `cmp` with `eq' and `order`", ctx.reason)
215+
ctx.api.fail('Don\'t mix "%s" with "%s" and "%s"' % (cmp, eq, order), ctx.reason)
216216

217217
# cmp takes precedence due to bw-compatibility.
218218
if cmp is not None:
@@ -226,7 +226,7 @@ def _determine_eq_order(ctx: 'mypy.plugin.ClassDefContext') -> bool:
226226
order = eq
227227

228228
if eq is False and order is True:
229-
ctx.api.fail("eq must be True if order is True", ctx.reason)
229+
ctx.api.fail('eq must be "True" if order is "True"', ctx.reason)
230230

231231
return order
232232

mypy/plugins/dataclasses.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ def transform(self) -> None:
137137
# Add <, >, <=, >=, but only if the class has an eq method.
138138
if decorator_arguments['order']:
139139
if not decorator_arguments['eq']:
140-
ctx.api.fail('eq must be True if order is True', ctx.cls)
140+
ctx.api.fail('eq must be "True" if order is "True"', ctx.cls)
141141

142142
for method_name in ['__lt__', '__gt__', '__le__', '__ge__']:
143143
# Like for __eq__ and __ne__, we want "other" to match

mypy/semanal.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1856,7 +1856,7 @@ def report_missing_module_attribute(
18561856
# is incomplete. Defer the current target.
18571857
self.mark_incomplete(imported_id, context)
18581858
return
1859-
message = "Module '{}' has no attribute '{}'".format(import_id, source_id)
1859+
message = 'Module "{}" has no attribute "{}"'.format(import_id, source_id)
18601860
# Suggest alternatives, if any match is found.
18611861
module = self.modules.get(import_id)
18621862
if module:

test-data/unit/check-attr.test

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -282,11 +282,11 @@ class DeprecatedTrue:
282282
class DeprecatedFalse:
283283
...
284284

285-
@attrs(cmp=False, eq=True) # E: Don't mix `cmp` with `eq' and `order`
285+
@attrs(cmp=False, eq=True) # E: Don't mix "False" with "True" and "None"
286286
class Mixed:
287287
...
288288

289-
@attrs(order=True, eq=False) # E: eq must be True if order is True
289+
@attrs(order=True, eq=False) # E: eq must be "True" if order is "True"
290290
class Confused:
291291
...
292292
[builtins fixtures/attr.pyi]

test-data/unit/check-columns.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ def f(x: object, n: int, s: str) -> None:
125125
[case testColumnHasNoAttribute]
126126
import m
127127
if int():
128-
from m import foobaz # E:5: Module 'm' has no attribute 'foobaz'; maybe "foobar"?
128+
from m import foobaz # E:5: Module "m" has no attribute "foobaz"; maybe "foobar"?
129129
1 .x # E:1: "int" has no attribute "x"
130130
(m.foobaz()) # E:2: Module has no attribute "foobaz"; maybe "foobar"?
131131

test-data/unit/check-dataclasses.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ app1 >= app3
415415
from dataclasses import dataclass
416416

417417
@dataclass(eq=False, order=True)
418-
class Application: # E: eq must be True if order is True
418+
class Application: # E: eq must be "True" if order is "True"
419419
...
420420

421421
[builtins fixtures/list.pyi]

test-data/unit/check-errorcodes.test

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
import m
77
m.x # E: Module has no attribute "x" [attr-defined]
88
'x'.foobar # E: "str" has no attribute "foobar" [attr-defined]
9-
from m import xx # E: Module 'm' has no attribute 'xx' [attr-defined]
10-
from m import think # E: Module 'm' has no attribute 'think'; maybe "thing"? [attr-defined]
9+
from m import xx # E: Module "m" has no attribute "xx" [attr-defined]
10+
from m import think # E: Module "m" has no attribute "think"; maybe "thing"? [attr-defined]
1111
for x in 1: # E: "int" has no attribute "__iter__" (not iterable) [attr-defined]
1212
pass
1313
[file m.py]
@@ -504,7 +504,7 @@ from defusedxml import xyz # E: Cannot find implementation or library stub for
504504
from nonexistent import foobar # E: Cannot find implementation or library stub for module named "nonexistent" [import]
505505
import nonexistent2 # E: Cannot find implementation or library stub for module named "nonexistent2" [import]
506506
from nonexistent3 import * # E: Cannot find implementation or library stub for module named "nonexistent3" [import]
507-
from pkg import bad # E: Module 'pkg' has no attribute 'bad' [attr-defined]
507+
from pkg import bad # E: Module "pkg" has no attribute "bad" [attr-defined]
508508
from pkg.bad2 import bad3 # E: Cannot find implementation or library stub for module named "pkg.bad2" [import]
509509
[file pkg/__init__.py]
510510

test-data/unit/check-flags.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1303,7 +1303,7 @@ implicit_reexport = True
13031303
\[mypy-other_module_2]
13041304
implicit_reexport = False
13051305
[out]
1306-
main:2: error: Module 'other_module_2' has no attribute 'a'
1306+
main:2: error: Module "other_module_2" has no attribute "a"
13071307

13081308
[case testImplicitAnyOKForNoArgs]
13091309
# flags: --disallow-any-generics --show-column-numbers

0 commit comments

Comments
 (0)