Skip to content

Commit 46884a5

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 2c0c0d6 commit 46884a5

File tree

7 files changed

+27
-14
lines changed

7 files changed

+27
-14
lines changed

pylint/lint/expand_modules.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
from collections.abc import Sequence
1010
from pathlib import Path
1111
from re import Pattern
12-
from typing import cast
1312

1413
from astroid import modutils
1514

pylint/lint/pylinter.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -667,8 +667,11 @@ def check(self, files_or_modules: Sequence[str]) -> None:
667667
extra_packages_paths = list(
668668
dict.fromkeys(
669669
[
670-
path for file_or_module in files_or_modules
671-
for path in discover_package_path(file_or_module, self.config.source_roots)
670+
path
671+
for file_or_module in files_or_modules
672+
for path in discover_package_path(
673+
file_or_module, self.config.source_roots
674+
)
672675
]
673676
).keys()
674677
)

pylint/pyreverse/main.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -302,8 +302,11 @@ def run(self, args: list[str]) -> int:
302302
print(self.help())
303303
return 1
304304
extra_packages_paths = list(
305-
{path for arg in args
306-
for path in discover_package_path(arg, self.config.source_roots)}
305+
{
306+
path
307+
for arg in args
308+
for path in discover_package_path(arg, self.config.source_roots)
309+
}
307310
)
308311
with augmented_sys_path(extra_packages_paths):
309312
project = project_from_files(

tests/lint/unittest_expand_modules.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,11 @@
1414
import pytest
1515

1616
from pylint.checkers import BaseChecker
17-
from pylint.lint.expand_modules import _is_in_ignore_list_re, discover_package_path, expand_modules
17+
from pylint.lint.expand_modules import (
18+
_is_in_ignore_list_re,
19+
discover_package_path,
20+
expand_modules,
21+
)
1822
from pylint.testutils import CheckerTestCase, set_config
1923
from pylint.typing import MessageDefinitionTuple, ModuleDescriptionDict
2024

@@ -307,12 +311,13 @@ def test_expand_modules_with_ignore(
307311
assert modules == expected
308312
assert not errors
309313

314+
310315
def test_discover_package_path_no_source_root_overlap(tmp_path):
311316
"""Test whether source_roots is returned even if module doesn't overlap
312-
with source_roots"""
317+
with source_roots
318+
"""
313319
source_roots = [tmp_path]
314320
package_paths = discover_package_path(__file__, source_roots)
315321

316322
expected = source_roots
317-
assert(package_paths == expected)
318-
323+
assert package_paths == expected

tests/lint/unittest_lint.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,8 @@ def test_one_arg(fake_path: list[str], case: list[str]) -> None:
133133
expected = [join(chroot, "a"), *fake_path]
134134

135135
extra_sys_paths = [
136-
path for arg in case
136+
path
137+
for arg in case
137138
for path in expand_modules.discover_package_path(arg, [])
138139
]
139140

@@ -158,7 +159,8 @@ def test_two_similar_args(fake_path: list[str], case: list[str]) -> None:
158159
expected = [join(chroot, "a"), *fake_path]
159160

160161
extra_sys_paths = [
161-
path for arg in case
162+
path
163+
for arg in case
162164
for path in expand_modules.discover_package_path(arg, [])
163165
]
164166

@@ -185,7 +187,8 @@ def test_more_args(fake_path: list[str], case: list[str]) -> None:
185187
] + fake_path
186188

187189
extra_sys_paths = [
188-
path for arg in case
190+
path
191+
for arg in case
189192
for path in expand_modules.discover_package_path(arg, [])
190193
]
191194

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
""" Test for source-roots import for implicit namespace package. The following
1+
""" Test for source-roots import for implicit namespace package. The following
22
should succeed."""
33
import namespacepkg.pkg.app

tests/test_self.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ def test_exit_zero(self) -> None:
212212
"repo", ["source_roots_src_layout", "source_roots_implicit_namespace_pkg"]
213213
)
214214
def test_source_roots_src_layout(self, repo: str) -> None:
215-
repo = join(HERE, "regrtest_data",repo)
215+
repo = join(HERE, "regrtest_data", repo)
216216
src_path = join(repo, "src")
217217
self._runtest(
218218
["-d", "unused-import", f"--source-roots={src_path}", repo], code=0

0 commit comments

Comments
 (0)