Skip to content

Commit 5ccef18

Browse files
committed
Capitalized error messages
1 parent cafaf6a commit 5ccef18

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

mypy/parse.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ def __init__(self, fnam: str, errors: Errors, pyversion: int,
108108
self.errors.set_file('<input>')
109109

110110
def parse(self, s: str) -> MypyFile:
111-
self.tok = lex.lex(s, pyversion = self.pyversion)
111+
self.tok = lex.lex(s, pyversion=self.pyversion)
112112
self.ind = 0
113113
self.imports = []
114114
self.future_options = []

mypy/semanal.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1131,7 +1131,7 @@ def visit_del_stmt(self, s: DelStmt) -> None:
11311131
def visit_global_decl(self, g: GlobalDecl) -> None:
11321132
for name in g.names:
11331133
if name in self.nonlocal_decls[-1]:
1134-
self.fail("name '{}' is nonlocal and global".format(name), g)
1134+
self.fail("Name '{}' is nonlocal and global".format(name), g)
11351135
self.global_decls[-1].add(name)
11361136

11371137
def visit_nonlocal_decl(self, d: NonlocalDecl) -> None:
@@ -1143,14 +1143,14 @@ def visit_nonlocal_decl(self, d: NonlocalDecl) -> None:
11431143
if table is not None and name in table:
11441144
break
11451145
else:
1146-
self.fail("no binding for nonlocal '{}' found".format(name), d)
1146+
self.fail("No binding for nonlocal '{}' found".format(name), d)
11471147

11481148
if self.locals[-1] is not None and name in self.locals[-1]:
1149-
self.fail("name '{}' is already defined in local "
1149+
self.fail("Name '{}' is already defined in local "
11501150
"scope before nonlocal declaration".format(name), d)
11511151

11521152
if name in self.global_decls[-1]:
1153-
self.fail("name '{}' is nonlocal and global".format(name), d)
1153+
self.fail("Name '{}' is nonlocal and global".format(name), d)
11541154
self.nonlocal_decls[-1].add(name)
11551155

11561156
def visit_print_stmt(self, s: PrintStmt) -> None:

mypy/test/data/semanal-errors.test

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,7 @@ def f():
549549
x = None
550550
[out]
551551
main: In function "g":
552-
main, line 4: no binding for nonlocal 'x' found
552+
main, line 4: No binding for nonlocal 'x' found
553553
main, line 5: Name 'x' is not defined
554554

555555
[case testNonlocalDeclNotMatchingGlobal]
@@ -560,7 +560,7 @@ def f():
560560
x = None
561561
[out]
562562
main: In function "f":
563-
main, line 4: no binding for nonlocal 'x' found
563+
main, line 4: No binding for nonlocal 'x' found
564564
main, line 5: Name 'x' is not defined
565565

566566
[case testNonlocalDeclConflictingWithParameter]
@@ -572,7 +572,7 @@ def g():
572572
x = None
573573
[out]
574574
main: In function "f":
575-
main, line 5: name 'x' is already defined in local scope before nonlocal declaration
575+
main, line 5: Name 'x' is already defined in local scope before nonlocal declaration
576576

577577
[case testNonlocalDeclOutsideFunction]
578578
x = 2
@@ -591,7 +591,7 @@ def f():
591591
x = None
592592
[out]
593593
main: In function "g":
594-
main, line 7: name 'x' is nonlocal and global
594+
main, line 7: Name 'x' is nonlocal and global
595595

596596
[case testNonlocalAndGlobalDecl]
597597
import typing
@@ -604,7 +604,7 @@ def f():
604604
x = None
605605
[out]
606606
main: In function "g":
607-
main, line 7: name 'x' is nonlocal and global
607+
main, line 7: Name 'x' is nonlocal and global
608608

609609
[case testNestedFunctionAndScoping]
610610
import typing

0 commit comments

Comments
 (0)