Skip to content

Commit 132a13a

Browse files
authored
Merge pull request #702 from prospector-dev/ruff-target-version
Add Ruff target Python version, update code
2 parents ea78530 + c918ea4 commit 132a13a

File tree

4 files changed

+7
-6
lines changed

4 files changed

+7
-6
lines changed

prospector/postfilter.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
from pathlib import Path
2-
from typing import List
32

43
from prospector.message import Message
54
from prospector.suppression import get_suppressions
65

76

8-
def filter_messages(filepaths: List[Path], messages: List[Message]) -> List[Message]:
7+
def filter_messages(filepaths: list[Path], messages: list[Message]) -> list[Message]:
98
"""
109
This method post-processes all messages output by all tools, in order to filter
1110
out any based on the overall output.

prospector/tools/pylint/collector.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
from io import StringIO
2-
from typing import List
32

43
from pylint.exceptions import UnknownMessageError
54
from pylint.message import Message as PylintMessage
@@ -35,5 +34,5 @@ def handle_message(self, msg: PylintMessage) -> None:
3534
message = Message("pylint", msg_symbol, loc, msg.msg)
3635
self._messages.append(message)
3736

38-
def get_messages(self) -> List[Message]:
37+
def get_messages(self) -> list[Message]:
3938
return self._messages

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ build-backend = "poetry.core.masonry.api"
8888

8989
[tool.ruff]
9090
line-length = 120
91+
target-version = "py39"
9192

9293
[tool.ruff.lint]
9394
fixable = ["ALL"]

tests/utils.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,10 @@ def patch_cwd(set_cwd: Path):
2222
# for this test to work in all python versions prospector supports, both need to
2323
# be patched (or, an "if python version" statement but it's easier to just patch both)
2424
cwd_str = str(set_cwd.absolute())
25-
with patch("pathlib.Path.cwd", new=lambda: set_cwd), patch("os.getcwd", new=lambda: cwd_str), patch(
26-
"os.curdir", new=cwd_str
25+
with (
26+
patch("pathlib.Path.cwd", new=lambda: set_cwd),
27+
patch("os.getcwd", new=lambda: cwd_str),
28+
patch("os.curdir", new=cwd_str),
2729
):
2830
# Turns out that Python 3.10 added the `getcwd` to the _NormalAccessor instead of falling
2931
# back on os.getcwd, and so this needs to be patched too...

0 commit comments

Comments
 (0)