Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add typing to filepath #4980

Merged
merged 21 commits into from
Sep 16, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix tests and errors
  • Loading branch information
DanielNoord committed Sep 15, 2021
commit 0910978f6284a30a9c5e823dd3c6eb36efee8494
6 changes: 3 additions & 3 deletions pylint/lint/pylinter.py
Original file line number Diff line number Diff line change
Expand Up @@ -1095,10 +1095,10 @@ def set_current_module(self, modname, filepath: Optional[str] = None):
self.reporter.on_set_current_module(modname, filepath)
self.current_name = modname
self.current_file = filepath or modname
self.stats["by_module"][modname] = {}
self.stats["by_module"][modname]["statement"] = 0
self.stats["by_module"][modname] = {} # type: ignore # Refactor of PyLinter.stats necessary
self.stats["by_module"][modname]["statement"] = 0 # type: ignore
for msg_cat in MSG_TYPES.values():
self.stats["by_module"][modname][msg_cat] = 0
self.stats["by_module"][modname][msg_cat] = 0 # type: ignore

@contextlib.contextmanager
def _astroid_module_checker(self):
Expand Down
3 changes: 2 additions & 1 deletion tests/benchmark/test_baseline_benchmarks.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
from pylint.checkers.base_checker import BaseChecker
from pylint.lint import PyLinter, Run, check_parallel
from pylint.testutils import GenericTestReporter as Reporter
from pylint.typing import FileItem
from pylint.utils import register_plugins


Expand Down Expand Up @@ -111,7 +112,7 @@ class TestEstablishBaselineBenchmarks:
impact everything else"""

empty_filepath = _empty_filepath()
empty_file_info = (
empty_file_info = FileItem(
"name-emptyfile-file",
_empty_filepath(),
"modname-emptyfile-mod",
Expand Down
4 changes: 2 additions & 2 deletions tests/test_regr.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,12 @@ def modify_path() -> Iterator:
def test_check_package___init__(finalize_linter: PyLinter) -> None:
filename = ["package.__init__"]
finalize_linter.check(filename)
checked = list(finalize_linter.stats["by_module"].keys())
checked = list(finalize_linter.stats["by_module"].keys()) # type: ignore # Refactor of PyLinter.stats necessary
assert checked == filename

os.chdir(join(REGR_DATA, "package"))
finalize_linter.check(["__init__"])
checked = list(finalize_linter.stats["by_module"].keys())
checked = list(finalize_linter.stats["by_module"].keys()) # type: ignore
assert checked == ["__init__"]


Expand Down