diff --git a/prospector/postfilter.py b/prospector/postfilter.py index 72c893aa..51d5a0cb 100644 --- a/prospector/postfilter.py +++ b/prospector/postfilter.py @@ -1,11 +1,10 @@ from pathlib import Path -from typing import List from prospector.message import Message from prospector.suppression import get_suppressions -def filter_messages(filepaths: List[Path], messages: List[Message]) -> List[Message]: +def filter_messages(filepaths: list[Path], messages: list[Message]) -> list[Message]: """ This method post-processes all messages output by all tools, in order to filter out any based on the overall output. diff --git a/prospector/tools/pylint/collector.py b/prospector/tools/pylint/collector.py index be49713b..1002bc10 100644 --- a/prospector/tools/pylint/collector.py +++ b/prospector/tools/pylint/collector.py @@ -1,5 +1,4 @@ from io import StringIO -from typing import List from pylint.exceptions import UnknownMessageError from pylint.message import Message as PylintMessage @@ -35,5 +34,5 @@ def handle_message(self, msg: PylintMessage) -> None: message = Message("pylint", msg_symbol, loc, msg.msg) self._messages.append(message) - def get_messages(self) -> List[Message]: + def get_messages(self) -> list[Message]: return self._messages diff --git a/pyproject.toml b/pyproject.toml index 4cddc5be..b4aa31f4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -88,6 +88,7 @@ build-backend = "poetry.core.masonry.api" [tool.ruff] line-length = 120 +target-version = "py39" [tool.ruff.lint] fixable = ["ALL"] diff --git a/tests/utils.py b/tests/utils.py index b21471fa..38217cb0 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -22,8 +22,10 @@ def patch_cwd(set_cwd: Path): # for this test to work in all python versions prospector supports, both need to # be patched (or, an "if python version" statement but it's easier to just patch both) cwd_str = str(set_cwd.absolute()) - with patch("pathlib.Path.cwd", new=lambda: set_cwd), patch("os.getcwd", new=lambda: cwd_str), patch( - "os.curdir", new=cwd_str + with ( + patch("pathlib.Path.cwd", new=lambda: set_cwd), + patch("os.getcwd", new=lambda: cwd_str), + patch("os.curdir", new=cwd_str), ): # Turns out that Python 3.10 added the `getcwd` to the _NormalAccessor instead of falling # back on os.getcwd, and so this needs to be patched too...