Skip to content

Commit f18995e

Browse files
OddBlokeilevkivskyi
authored andcommitted
Further quoting fixes (#3898)
This resolves #3887 by consistently quoting attribute names.
1 parent 20b891c commit f18995e

File tree

5 files changed

+22
-22
lines changed

5 files changed

+22
-22
lines changed

mypy/messages.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,12 @@
4545
INCOMPATIBLE_TYPES = 'Incompatible types'
4646
INCOMPATIBLE_TYPES_IN_ASSIGNMENT = 'Incompatible types in assignment'
4747
INCOMPATIBLE_REDEFINITION = 'Incompatible redefinition'
48-
INCOMPATIBLE_TYPES_IN_AWAIT = 'Incompatible types in await'
49-
INCOMPATIBLE_TYPES_IN_ASYNC_WITH_AENTER = 'Incompatible types in "async with" for __aenter__'
50-
INCOMPATIBLE_TYPES_IN_ASYNC_WITH_AEXIT = 'Incompatible types in "async with" for __aexit__'
48+
INCOMPATIBLE_TYPES_IN_AWAIT = 'Incompatible types in "await"'
49+
INCOMPATIBLE_TYPES_IN_ASYNC_WITH_AENTER = 'Incompatible types in "async with" for "__aenter__"'
50+
INCOMPATIBLE_TYPES_IN_ASYNC_WITH_AEXIT = 'Incompatible types in "async with" for "__aexit__"'
5151
INCOMPATIBLE_TYPES_IN_ASYNC_FOR = 'Incompatible types in "async for"'
5252

53-
INCOMPATIBLE_TYPES_IN_YIELD = 'Incompatible types in yield'
53+
INCOMPATIBLE_TYPES_IN_YIELD = 'Incompatible types in "yield"'
5454
INCOMPATIBLE_TYPES_IN_YIELD_FROM = 'Incompatible types in "yield from"'
5555
INCOMPATIBLE_TYPES_IN_STR_INTERPOLATION = 'Incompatible types in string interpolation'
5656
MUST_HAVE_NONE_RETURN_TYPE = 'The return type of "{}" must be None'
@@ -1032,7 +1032,7 @@ def concrete_only_call(self, typ: Type, context: Context) -> None:
10321032
.format(self.format(typ)), context)
10331033

10341034
def note_call(self, subtype: Type, call: Type, context: Context) -> None:
1035-
self.note("'{}.__call__' has type {}".format(self.format_bare(subtype),
1035+
self.note('"{}.__call__" has type {}'.format(self.format_bare(subtype),
10361036
self.format(call, verbosity=1)), context)
10371037

10381038
def report_protocol_problems(self, subtype: Union[Instance, TupleType, TypedDictType],

test-data/unit/check-async-await.test

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ async def f() -> int:
9393
return x
9494
[typing fixtures/typing-full.pyi]
9595
[out]
96-
main:7: error: Incompatible types in await (actual type "Generator[int, None, str]", expected type "Awaitable[Any]")
96+
main:7: error: Incompatible types in "await" (actual type "Generator[int, None, str]", expected type "Awaitable[Any]")
9797

9898
[case testAwaitIteratorError]
9999

@@ -105,7 +105,7 @@ async def f() -> int:
105105
return x
106106
[typing fixtures/typing-full.pyi]
107107
[out]
108-
main:6: error: Incompatible types in await (actual type "Iterator[Any]", expected type "Awaitable[Any]")
108+
main:6: error: Incompatible types in "await" (actual type "Iterator[Any]", expected type "Awaitable[Any]")
109109

110110
[case testAwaitArgumentError]
111111

@@ -117,7 +117,7 @@ async def f() -> int:
117117
[builtins fixtures/async_await.pyi]
118118
[typing fixtures/typing-full.pyi]
119119
[out]
120-
main:5: error: Incompatible types in await (actual type "int", expected type "Awaitable[Any]")
120+
main:5: error: Incompatible types in "await" (actual type "int", expected type "Awaitable[Any]")
121121

122122
[case testAwaitResultError]
123123

@@ -290,7 +290,7 @@ class C:
290290
def __aenter__(self) -> int: pass
291291
async def __aexit__(self, x, y, z) -> None: pass
292292
async def f() -> None:
293-
async with C() as x: # E: Incompatible types in "async with" for __aenter__ (actual type "int", expected type "Awaitable[Any]")
293+
async with C() as x: # E: Incompatible types in "async with" for "__aenter__" (actual type "int", expected type "Awaitable[Any]")
294294
pass
295295
[builtins fixtures/async_await.pyi]
296296
[typing fixtures/typing-full.pyi]
@@ -312,7 +312,7 @@ class C:
312312
async def __aenter__(self) -> int: pass
313313
def __aexit__(self, x, y, z) -> int: pass
314314
async def f() -> None:
315-
async with C() as x: # E: Incompatible types in "async with" for __aexit__ (actual type "int", expected type "Awaitable[Any]")
315+
async with C() as x: # E: Incompatible types in "async with" for "__aexit__" (actual type "int", expected type "Awaitable[Any]")
316316
pass
317317
[builtins fixtures/async_await.pyi]
318318
[typing fixtures/typing-full.pyi]
@@ -419,7 +419,7 @@ from types import coroutine
419419
@coroutine
420420
def f() -> Generator[int, str, int]:
421421
x = yield 0
422-
x = yield '' # E: Incompatible types in yield (actual type "str", expected type "int")
422+
x = yield '' # E: Incompatible types in "yield" (actual type "str", expected type "int")
423423
reveal_type(x) # E: Revealed type is 'builtins.str'
424424
if x:
425425
return 0
@@ -443,7 +443,7 @@ async def g() -> AsyncGenerator[int, None]:
443443
reveal_type(value) # E: Revealed type is 'builtins.int*'
444444
yield value
445445

446-
yield 'not an int' # E: Incompatible types in yield (actual type "str", expected type "int")
446+
yield 'not an int' # E: Incompatible types in "yield" (actual type "str", expected type "int")
447447
# return without a value is fine
448448
return
449449
reveal_type(g) # E: Revealed type is 'def () -> typing.AsyncGenerator[builtins.int, builtins.None]'
@@ -466,7 +466,7 @@ from typing import AsyncIterator
466466
async def gen() -> AsyncIterator[int]:
467467
yield 3
468468

469-
yield 'not an int' # E: Incompatible types in yield (actual type "str", expected type "int")
469+
yield 'not an int' # E: Incompatible types in "yield" (actual type "str", expected type "int")
470470

471471
async def use_gen() -> None:
472472
async for item in gen():
@@ -644,11 +644,11 @@ def plain_host_generator() -> Generator[str, None, None]:
644644

645645
async def plain_host_coroutine() -> None:
646646
x = 0
647-
x = await plain_generator() # E: Incompatible types in await (actual type "Generator[str, None, int]", expected type "Awaitable[Any]")
647+
x = await plain_generator() # E: Incompatible types in "await" (actual type "Generator[str, None, int]", expected type "Awaitable[Any]")
648648
x = await plain_coroutine()
649649
x = await decorated_generator()
650650
x = await decorated_coroutine()
651-
x = await other_iterator() # E: Incompatible types in await (actual type "It", expected type "Awaitable[Any]")
651+
x = await other_iterator() # E: Incompatible types in "await" (actual type "It", expected type "Awaitable[Any]")
652652
x = await other_coroutine()
653653

654654
@coroutine
@@ -665,11 +665,11 @@ def decorated_host_generator() -> Generator[str, None, None]:
665665
@coroutine
666666
async def decorated_host_coroutine() -> None:
667667
x = 0
668-
x = await plain_generator() # E: Incompatible types in await (actual type "Generator[str, None, int]", expected type "Awaitable[Any]")
668+
x = await plain_generator() # E: Incompatible types in "await" (actual type "Generator[str, None, int]", expected type "Awaitable[Any]")
669669
x = await plain_coroutine()
670670
x = await decorated_generator()
671671
x = await decorated_coroutine()
672-
x = await other_iterator() # E: Incompatible types in await (actual type "It", expected type "Awaitable[Any]")
672+
x = await other_iterator() # E: Incompatible types in "await" (actual type "It", expected type "Awaitable[Any]")
673673
x = await other_coroutine()
674674

675675
[builtins fixtures/async_await.pyi]

test-data/unit/check-expressions.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1215,7 +1215,7 @@ from typing import Iterator, Callable
12151215
lambda: (yield)
12161216

12171217
gen: Callable[[], Iterator[str]]
1218-
gen = (lambda: (yield 1)) # E: Incompatible types in yield (actual type "int", expected type "str")
1218+
gen = (lambda: (yield 1)) # E: Incompatible types in "yield" (actual type "int", expected type "str")
12191219

12201220
def fun(cb: Callable[[], Iterator[str]]) -> None:
12211221
pass

test-data/unit/check-protocols.test

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1664,7 +1664,7 @@ reveal_type(apply_gen(Add5())) # E: Revealed type is 'builtins.int*'
16641664
def apply_str(f: Callable[[str], int], x: str) -> int:
16651665
return f(x)
16661666
apply_str(Add5(), 'a') # E: Argument 1 to "apply_str" has incompatible type "Add5"; expected "Callable[[str], int]" \
1667-
# N: 'Add5.__call__' has type "Callable[[Arg(int, 'x')], int]"
1667+
# N: "Add5.__call__" has type "Callable[[Arg(int, 'x')], int]"
16681668
[builtins fixtures/isinstancelist.pyi]
16691669

16701670
[case testMoreComplexCallableStructuralSubtyping]
@@ -1681,9 +1681,9 @@ class Bad2:
16811681
def __call__(self, y: int, *rest: str) -> int: pass
16821682
call_soon(Good())
16831683
call_soon(Bad1()) # E: Argument 1 to "call_soon" has incompatible type "Bad1"; expected "Callable[[int, VarArg(str)], int]" \
1684-
# N: 'Bad1.__call__' has type "Callable[[Arg(int, 'x'), VarArg(int)], int]"
1684+
# N: "Bad1.__call__" has type "Callable[[Arg(int, 'x'), VarArg(int)], int]"
16851685
call_soon(Bad2()) # E: Argument 1 to "call_soon" has incompatible type "Bad2"; expected "Callable[[int, VarArg(str)], int]" \
1686-
# N: 'Bad2.__call__' has type "Callable[[Arg(int, 'y'), VarArg(str)], int]"
1686+
# N: "Bad2.__call__" has type "Callable[[Arg(int, 'y'), VarArg(str)], int]"
16871687
[builtins fixtures/isinstancelist.pyi]
16881688

16891689
[case testStructuralSupportForPartial]

test-data/unit/check-statements.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1050,7 +1050,7 @@ while x == 5: ... # E: Trying to read deleted variable 'x'
10501050
from typing import Iterator
10511051
def f() -> Iterator[int]:
10521052
yield 1
1053-
yield '' # E: Incompatible types in yield (actual type "str", expected type "int")
1053+
yield '' # E: Incompatible types in "yield" (actual type "str", expected type "int")
10541054
[builtins fixtures/for.pyi]
10551055
[out]
10561056

0 commit comments

Comments
 (0)