Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 203a588

Browse files
Michael0x2ailevkivskyi
authored andcommitted
Add strictness flags that can be added with no source code changes (#6237)
This diff tightens up mypy's self-check slightly by enabling some of the `--strict` flags that mypy is currently already passing. I also thought about enabling `--warn-unused-ignores` since there were only four places where we need to delete a `# type: ignore` comment, but ultimately decided against it: I don't want to complicate typeshed contributions (since typeshed's tests run mypy's self-check) and because one of those ignores looked like it was related to weird mypyc shenanigans (the lxml import in mypy/report.py). I did go ahead and remove the other three `# type: ignores` though.
1 parent bbf0fd3 commit 203a588

5 files changed

Lines changed: 11 additions & 3 deletions

File tree

mypy/fscache.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ def md5(self, path: str) -> str:
254254
def samefile(self, f1: str, f2: str) -> bool:
255255
s1 = self.stat(f1)
256256
s2 = self.stat(f2)
257-
return os.path.samestat(s1, s2) # type: ignore
257+
return os.path.samestat(s1, s2)
258258

259259

260260
def copy_os_error(e: OSError) -> OSError:

mypy/interpreted_plugin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class InterpretedPlugin:
2323

2424
def __new__(cls, *args: Any, **kwargs: Any) -> 'mypy.plugin.Plugin':
2525
from mypy.plugin import WrapperPlugin
26-
plugin = object.__new__(cls) # type: ignore
26+
plugin = object.__new__(cls)
2727
plugin.__init__(*args, **kwargs)
2828
return WrapperPlugin(plugin)
2929

mypy/test/data.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def parse_test_case(case: 'DataDrivenTestCase') -> None:
3939
if case.suite.native_sep:
4040
join = os.path.join
4141
else:
42-
join = posixpath.join # type: ignore
42+
join = posixpath.join
4343

4444
out_section_missing = case.suite.required_out_section
4545
normalize_output = True

mypy_bootstrap.ini

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
[mypy]
2+
disallow_untyped_calls = True
23
disallow_untyped_defs = True
4+
disallow_incomplete_defs = True
5+
check_untyped_defs = True
36
disallow_subclassing_any = True
47
warn_no_return = True
58
strict_optional = True
@@ -15,3 +18,4 @@ platform = mypyc
1518
# needs py2 compatibility
1619
[mypy-mypy.test.testextensions]
1720
disallow_untyped_defs = False
21+
check_untyped_defs = False

mypy_self_check.ini

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
[mypy]
2+
disallow_untyped_calls = True
23
disallow_untyped_defs = True
4+
disallow_incomplete_defs = True
5+
check_untyped_defs = True
36
disallow_subclassing_any = True
47
warn_no_return = True
58
strict_optional = True
@@ -13,3 +16,4 @@ show_traceback = True
1316
# needs py2 compatibility
1417
[mypy-mypy.test.testextensions]
1518
disallow_untyped_defs = False
19+
check_untyped_defs = False

0 commit comments

Comments
 (0)