Skip to content

Commit 8b5c2b8

Browse files
fix flake8 warnings
1 parent f1566b9 commit 8b5c2b8

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

mypy/build.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -902,7 +902,7 @@ def _find_module_non_stub_helper(
902902
) -> Optional[str]:
903903
fscache = self.fscache
904904
for count in range(len(components)):
905-
typed_file = os.path.join(pkg_dir, *components[:count+1], 'py.typed')
905+
typed_file = os.path.join(pkg_dir, *components[:count + 1], 'py.typed')
906906
if fscache.isfile(typed_file):
907907
return os.path.join(pkg_dir, *components[:-1])
908908
return None
@@ -926,7 +926,6 @@ def _find_module(self, id: str, search_paths: SearchPaths,
926926
# Third-party stub/typed packages
927927
for pkg_dir in search_paths.package_path:
928928
stub_name = components[0] + '-stubs'
929-
typed_file = os.path.join(pkg_dir, components[0], 'py.typed')
930929
stub_dir = os.path.join(pkg_dir, stub_name)
931930
if fscache.isdir(stub_dir):
932931
stub_typed_file = os.path.join(stub_dir, 'py.typed')

mypy/test/testpep561.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,7 @@ def test_typedpkg_editable(self) -> None:
203203
venv_dir=venv_dir,
204204
)
205205

206+
206207
class TestPEP561Namespace(TestCase):
207208

208209
@contextmanager
@@ -254,8 +255,14 @@ def setUp(self) -> None:
254255
self.tempfile = os.path.join(self.temp_file_dir.name, 'namespace_program.py')
255256
with open(self.tempfile, 'w+') as file:
256257
file.write(NAMESPACE_PROGRAM)
257-
self.msg_bool_str = '{0}:8: error: Argument 1 to "nested_func" has incompatible type "bool"; expected "str"\n'.format(self.tempfile)
258-
self.msg_int_bool = '{0}:9: error: Argument 1 to "namespace_func" has incompatible type "int"; expected "bool"\n'.format(self.tempfile)
258+
self.msg_bool_str = (
259+
'{0}:8: error: Argument 1 to "nested_func" has incompatible type "bool"; '
260+
'expected "str"\n'.format(self.tempfile)
261+
)
262+
self.msg_int_bool = (
263+
'{0}:9: error: Argument 1 to "namespace_func" has incompatible type "int"; '
264+
'expected "bool"\n'.format(self.tempfile)
265+
)
259266

260267
def tearDown(self) -> None:
261268
self.temp_file_dir.cleanup()
@@ -268,7 +275,7 @@ def test_nested_and_namespace(self) -> None:
268275
check_mypy_run(
269276
[self.tempfile],
270277
python_executable,
271-
expected_out=self.msg_bool_str+self.msg_int_bool,
278+
expected_out=self.msg_bool_str + self.msg_int_bool,
272279
venv_dir=venv_dir,
273280
)
274281

0 commit comments

Comments
 (0)