Skip to content

Commit 80882db

Browse files
committed
lint: Enable flake8-annotations
Signed-off-by: Jussi Kukkonen <jkukkonen@google.com>
1 parent dc5194e commit 80882db

3 files changed

Lines changed: 8 additions & 3 deletions

File tree

pyproject.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ line-length=80
8383
[tool.ruff.lint]
8484
select = [
8585
"A", # flake8-builtins
86+
"ANN", # flake8-annotations
8687
"ARG", # flake8-unused-arguments
8788
"B", # flake8-bugbear
8889
"BLE", # flake8-blind-except
@@ -109,6 +110,7 @@ select = [
109110
"W", # pycodestyle-warning
110111
]
111112
ignore = [
113+
"ANN101", "ANN102", # nonsense, deprecated in ruff
112114
"D400", "D415", "D213", "D205", "D202", "D107", "D407", "D413", "D212", "D104", "D406", "D105", "D411", "D401", "D200", "D203",
113115
"PLR0913", "PLR2004",
114116
"ISC001", # incompatible with ruff formatter
@@ -130,6 +132,9 @@ ignore = [
130132
"S603", # bandit: this flags all uses of subprocess.run as vulnerable
131133
]
132134

135+
[tool.ruff.lint.flake8-annotations]
136+
mypy-init-return = true
137+
133138
# mypy section
134139
# Read more here: https://mypy.readthedocs.io/en/stable/config_file.html#using-a-pyproject-toml-file
135140
[tool.mypy]

tests/test_fetcher_ng.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ def test_http_error(self) -> None:
105105

106106
# Response read timeout error
107107
@patch.object(requests.Session, "get")
108-
def test_response_read_timeout(self, mock_session_get: Any) -> None:
108+
def test_response_read_timeout(self, mock_session_get: Mock) -> None:
109109
mock_response = Mock()
110110
attr = {
111111
"iter_content.side_effect": requests.exceptions.ConnectionError(
@@ -125,7 +125,7 @@ def test_response_read_timeout(self, mock_session_get: Any) -> None:
125125
"get",
126126
side_effect=requests.exceptions.Timeout("Simulated timeout"),
127127
)
128-
def test_session_get_timeout(self, mock_session_get: Any) -> None:
128+
def test_session_get_timeout(self, mock_session_get: Mock) -> None:
129129
with self.assertRaises(exceptions.SlowRetrievalError):
130130
self.fetcher.fetch(self.url)
131131
mock_session_get.assert_called_once()

tuf/api/_payload.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1491,7 +1491,7 @@ def __init__(
14911491
self.unrecognized_fields = unrecognized_fields
14921492

14931493
@property
1494-
def custom(self) -> Any:
1494+
def custom(self) -> Any: # noqa: ANN401
14951495
"""Get implementation specific data related to the target.
14961496
14971497
python-tuf does not use or validate this data.

0 commit comments

Comments
 (0)